Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2007 21:08:13 -0700
From:      "Loren M. Lang" <lorenl@north-winds.org>
To:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Bug in Newfs setting max-extend-size
Message-ID:  <46D4F12D.3080107@north-winds.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig3468D36E3974A45E7EA54A01
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I was reading through the newfs source code for FreeBSD 6.1-RELEASE and
noticed some oddities between the man page for newfs and it's source
related to max-extent-size (-d).  Newfs claims that the default is 16
times the filesystem blocksize. ("... It is presently limited to its
default value which is 16 times the file system blocksize.")  However,
in the source code, if maxbsize is not specified, it is assigned bsize,
not 16*bsize.
newfs.c:

        if (maxbsize =3D=3D 0)
                maxbsize =3D bsize;

Also, in mkfs.c, mkfs() does some sanity checks on maxbsize, but in the
second if statement on line 211, it checks sblock.fs_maxbsize, not
maxbsize, but as far as I can tell, sblock.fs_maxbsize is not yet
initialized.
mkfs.c:

        if (maxbsize < bsize || !POWEROF2(maxbsize)) {
                sblock.fs_maxbsize =3D sblock.fs_bsize;
                printf("Extent size set to %d\n", sblock.fs_maxbsize);
        } else if (sblock.fs_maxbsize > FS_MAXCONTIG * sblock.fs_bsize) {=

                sblock.fs_maxbsize =3D FS_MAXCONTIG * sblock.fs_bsize;
                printf("Extent size reduced to %d\n", sblock.fs_maxbsize)=
;
        } else {
                sblock.fs_maxbsize =3D maxbsize;
        }

Unless I am misunderstanding something, the else if() should read:

        } else if (maxbsize > FS_MAXCONTIG * sblock.fs_bsize) {

This appears to be the same in FreeBSD-CURRENT as well.
--=20
Loren M. Lang
lorenl@north-winds.org
http://www.north-winds.org/


Public Key: ftp://ftp.north-winds.org/pub/lorenl_pubkey.asc
Fingerprint: CEE1 AAE2 F66C 59B5 34CA  C415 6D35 E847 0118 A3D2



--------------enig3468D36E3974A45E7EA54A01
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG1PE2SHsHRHUO+igRAkbPAKDqe+DiUGz7r0AoHZNUPYYaLonywgCgnmBj
M84udkGCe3H1yQWDMuw9mzY=
=xLYZ
-----END PGP SIGNATURE-----

--------------enig3468D36E3974A45E7EA54A01--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46D4F12D.3080107>