panic: getblk: size(%d) > MAXBSIZE(%d)

Andriy Gapon avg at freebsd.org
Fri Apr 9 08:08:15 UTC 2010


Some context.  Recently we've investigated a problem with FAT filesystems that
have more than 64K bytes per cluster (on media with sector size > 512).  One of
the symptoms was panic in the subject line.  I've got curious why we have that
check and what would go wrong if we allowed that condition to be violated.

The check was added quite a long time ago, in 1996.
I wonder if anyone remembers details of a problem that it fixed.
Also, if MAXBSIZE limit was chosen appropriately.
And, if the protected code changed enough since then to warrant a re-evaluation
of this check.

I tried to inspect the code and find any hard limits that would be exceeded when
a large enough size parameter is passed.
The only limit that I've found so far is a size of b_pages array in struct buf:
struct  vm_page *b_pages[btoc(MAXPHYS)];

Of course, current default value of MAXPHYS is only 2 * MAXBSIZE.
But many people already use higher non-default values and there was a talk of
bumping the default value too.  (Also there is a question of appropriate uses
for MAXBSIZE, but that's a different topic).

If the b_pages is the only limit indeed, then the check could be changed to
something like:
if (size > MAXPHYS) ...

Also, there is a question if larger size would lead to a suboptimal behavior in
buffer cache / VM code even if it doesn't break anything.

Thank you in advance for any information and analysis!
-- 
Andriy Gapon


More information about the freebsd-arch mailing list