freebsd-skq/sys/ufs/ffs
bde d1eb245b0a Partially fixed negative and truncated "Avail" counts in df output.
This fixes PR943.

ffs/ffs_vfsops.c:
ffs_statfs() multiplied by (100 - minfree) as part of calculating the
minfree percentage (complemented in 100%), so with the standard minfree
of 8, it was broken for file systems of size >= 1TB/92 = 11GB.  Use the
standard freespace() macro instead.  This also fixes a rounding bug (the
"Avail" count was sometimes 1 too small).

ffs/* (not fixed):
The freespace() macro multiplies by minfree, so with the standard
minfree of 8, it is broken for file systems of size >= 1TB/8 = 128GB.
This bug is more serious since it affects block allocation.

ffs/ffs_alloc.c (not fixed):
Ordinary users are sometimes allowed to allocate 1 (partial) block
too many so that the "Avail" count goes negative.  E.g., if there is
1 fragment available and the file is fairly large, one more full
block is allocated.

df/df.c:
ufs_df() used/uses essentially the same code as ffs_statfs(), so it
had/has the same bugs.

ufs_df() gratuitously replaced "Avail" counts of < 0 by 0, so it
gave different results for non-mounted file systems in this case.
1996-01-14 18:55:09 +00:00
..
ffs_alloc.c Convert QUOTA to new-style option. 1996-01-05 18:31:58 +00:00
ffs_balloc.c Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
ffs_extern.h Staticize. 1995-12-17 21:14:36 +00:00
ffs_inode.c Convert QUOTA to new-style option. 1996-01-05 18:31:58 +00:00
ffs_subr.c Convert DDB to new-style option. 1996-01-04 21:13:23 +00:00
ffs_tables.c Staticize. 1995-12-17 21:14:36 +00:00
ffs_vfsops.c Partially fixed negative and truncated "Avail" counts in df output. 1996-01-14 18:55:09 +00:00
ffs_vnops.c Staticize. 1995-12-17 21:14:36 +00:00
fs.h Remove trailing whitespace. 1995-05-30 08:16:23 +00:00