review needed for a simple fix to growfs

Matthew Jacob mj at feral.com
Thu Oct 1 16:55:11 UTC 2009


I have a simple fix to growfs that eliminates some issues Doug was 
seeing. I probably don't know enough to know some of the implications of 
the change and wonder if anyone would care to comment on it?

The symptoms would be fsck failures on the grown filesystem- my take is 
that it was because the new cylinder groups were being initialized as 
having all the inodes allocated. This is puzzling me because, like, how 
could this ever have worked?

It was trivial for me to reproduce- see 
http://people.freebsd.org/~mjacob/growfs.failure.txt.

The second change, btw, is not essential- it just adjusts maxino down if 
you had to drop the number of cylinder groups down.


Index: growfs.c
===================================================================
--- growfs.c    (revision 197658)
+++ growfs.c    (working copy)
@@ -401,7 +401,6 @@
        acg.cg_magic = CG_MAGIC;
        acg.cg_cgx = cylno;
        acg.cg_niblk = sblock.fs_ipg;
-       acg.cg_initediblk = sblock.fs_ipg;
        acg.cg_ndblk = dmax - cbase;
        if (sblock.fs_contigsumsize > 0)
                acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
@@ -2217,6 +2216,7 @@
                printf("Warning: %jd sector(s) cannot be allocated.\n",
                    (intmax_t)fsbtodb(&sblock, sblock.fs_size % 
sblock.fs_fpg));
                sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg;
+               maxino -= sblock.fs_ipg;
        }

        /*



More information about the freebsd-fs mailing list