svn commit: r186265 - projects/makefs
Sam Leffler
sam at FreeBSD.org
Wed Dec 17 20:38:48 PST 2008
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);
- }
}
More information about the svn-src-projects
mailing list