From owner-svn-src-projects@FreeBSD.ORG Thu Dec 18 04:38:47 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E266B106564A; Thu, 18 Dec 2008 04:38:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8A518FC20; Thu, 18 Dec 2008 04:38:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBI4cl8p026943; Thu, 18 Dec 2008 04:38:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBI4clYH026942; Thu, 18 Dec 2008 04:38:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812180438.mBI4clYH026942@svn.freebsd.org> From: Sam Leffler Date: Thu, 18 Dec 2008 04:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186265 - projects/makefs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Dec 2008 04:38:48 -0000 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); - } }