Date: Thu, 18 Dec 2008 04:38:47 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r186265 - projects/makefs Message-ID: <200812180438.mBI4clYH026942@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sam Date: Thu Dec 18 04:38:47 2008 New Revision: 186265 URL: http://svn.freebsd.org/changeset/base/186265 Log: If the filesystem size rounded up to a multiple of the block size is larger than what a user specified then round down to get something that works but wastes a little space. This happens reliably for me when building filesystems for CF parts >1G; not sure why noone else is complaining. Modified: projects/makefs/ffs.c Modified: projects/makefs/ffs.c ============================================================================== --- projects/makefs/ffs.c Thu Dec 18 04:36:44 2008 (r186264) +++ projects/makefs/ffs.c Thu Dec 18 04:38:47 2008 (r186265) @@ -281,6 +281,7 @@ ffs_validate(const char *dir, fsnode *ro #if notyet int32_t spc, nspf, ncyl, fssize; #endif + off_t size; assert(dir != NULL); assert(root != NULL); @@ -365,7 +366,16 @@ ffs_validate(const char *dir, fsnode *ro fsopts->size = fsopts->minsize; /* round up to the next block */ - fsopts->size = roundup(fsopts->size, fsopts->bsize); + size = roundup(fsopts->size, fsopts->bsize); + + /* now check calculated sizes vs requested sizes */ + if (fsopts->maxsize > 0 && size > fsopts->maxsize) { + warnx("`%s' size of %lld is larger than the maxsize of %lld; rounding down to %lld.", + dir, (long long)size, (long long)fsopts->maxsize, + rounddown(fsopts->size, fsopts->bsize)); + size = rounddown(fsopts->size, fsopts->bsize); + } + fsopts->size = size; /* calculate density if necessary */ if (fsopts->density == -1) @@ -378,12 +388,6 @@ ffs_validate(const char *dir, fsnode *ro dir, (long long)fsopts->size, (long long)fsopts->inodes); } sectorsize = fsopts->sectorsize; /* XXX - see earlier */ - - /* now check calculated sizes vs requested sizes */ - if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) { - errx(1, "`%s' size of %lld is larger than the maxsize of %lld.", - dir, (long long)fsopts->size, (long long)fsopts->maxsize); - } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812180438.mBI4clYH026942>