Date: Fri, 09 Apr 2010 11:18:37 +0300 From: Andriy Gapon <avg@freebsd.org> To: arch@freebsd.org Subject: (in)appropriate uses for MAXBSIZE Message-ID: <4BBEE2DD.3090409@freebsd.org>
next in thread | raw e-mail | index | archive | help
As you know MAXBSIZE is currently defined to 64K (seems to a popular value for constants). There is the following comment for this parameter and its value: MAXBSIZE - Filesystems are made out of blocks of at most MAXBSIZE bytes per block. MAXBSIZE may be made larger without effecting any existing filesystems as long as it does not exceed MAXPHYS, and may be made smaller at the risk of not being able to use filesystems which require a block size exceeding MAXBSIZE. I haven't done any historical research but I think that history behind MAXBSIZE could be something like this. There was only one filesystem and it was UFS. People liked to use statically allocated/sized arrays for various stuff, so they came with a limit for a UFS block size. A sufficiently high and reasonable value was chosen for it. As time passed MAXBSIZE proliferated beyond UFS through VFS and other infrastructure code, partly because for correct reasons, partly because of lazy programming, partly because it just worked. Then, new filesystems had to obey this limit too. MAXBSIZE proliferated even further. And I'd argued that it became a more fundamental constant than what it is documented to be. Nowadays several questions could be asked about MAXBSIZE. - Will we have to consider increasing MAXBSIZE? Provided ever increasing media sizes, typical filesystem sizes, typical file sizes (all that multimedia) and even media sector sizes. - Do we need a universal limit on block size for all filesystems? E.g. ZFS already has maximum block size greater than MAXBSIZE, but it lives (has to live?) in a somewhat parallel world to other filesystems. - What are appropriate and inappropriate uses for MAXBSIZE given the questions above? In other words, what would immediately break were we to simplemindedly bump MAXBSIZE value. I have no answers but have some observations. I strongly believe that all uses of MAXBSIZE in sys/dev/ are inappropriate. For me it's inconceivable that a hardware driver would need to know maximum size of a filesystem block. There are 39 occurrences of MAXBSIZE in sys/dev/. Perhaps DFLTPHYS (currently has the same 64K value) was supposed to be used there? Or even MAXPHYS? Probably each driver needs to be evaluated individually. Curiously enough there are only 14 occurrences of DFLTPHYS in sys/dev/. Feedback welcome. Thanks! -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BBEE2DD.3090409>