Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jul 1996 21:36:09 -0600 (MDT)
From:      marcs@worldgate.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   docs/1374: incorrect default for the -i option in the newfs(8) man page
Message-ID:  <199607070336.VAA03344@gras-varg.worldgate.com>
Resent-Message-ID: <199607070340.UAA21771@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1374
>Category:       docs
>Synopsis:       the default listed in the newfs -i man page does not agree with that in the source
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul  6 20:40:03 PDT 1996
>Last-Modified:
>Originator:     marcs
>Organization:
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

Tested using 2.1.0-STABLE from late June/96 on a system using the 
below IDE drive.  The source that is directly relevant is the same in
release and current.

wdc1: unit 1 (wd3): <Maxtor 71260 AT>, 32-bit, multi-block-16
wd3: 1204MB (2467584 sectors), 2448 cyls, 16 heads, 63 S/T, 512 B/S


>Description:

The newfs man page says:

     -i number of bytes per inode
                 This specifies the density of inodes in the file system.  The
                 default is to create an inode for each 2048 bytes of data
                 space.  If fewer inodes are desired, a larger number should
                 be used; to create more inodes a smaller number should be
                 given.

However, sbin/newfs/newfs.c says:

-------------------
/*
 * Each file system has a number of inodes statically allocated.
 * We allocate one inode slot per NFPI fragments, expecting this
 * to be far more than we will ever need.
 */
#define NFPI            4
[...]
                case 'i':
                        if ((density = atoi(optarg)) <= 0)
                                fatal("%s: bad bytes per inode\n", optarg);
                        break;
[...]
        if (density == 0)
                density = NFPI * fsize;

[...]
        if (fsize == 0) {
                fsize = pp->p_fsize;
                if (fsize <= 0)
                        fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);


---------------
When p_fsize is 1024, this works out to giving one inode for every
4096 bytes of drive space; a reasonable default, but not what the man
page says.


>How-To-Repeat:

A 'newfs /dev/wd3s1e' results in a drive with:
Filesystem   1K-blocks     Used    Avail Capacity iused   ifree %iused  Mounted on
/dev/wd3s1e    1164863   324946   746728    30%   20120  264038     7% /mnt

Which is one inode for every 4096 bytes of drive space, not every 2048
as the man page says.

>Fix:
	
Change 2048 to 4096 in the description for the default of the -i
option in the man page, assuming there are a minimal number of
situations where fsize could end up being something other than 1024.

>Audit-Trail:
>Unformatted:



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