freebsd-skq/sys/ufs
Ian Dowse 23bd68a426 Fix a bug in ufsdirhash_adjfree() that caused it to incorrectly
update the free-space statistics in some cases. The problem affected
directory blocks when the free space dropped below the size of the
maximum allowed entry size. When this happened, the free-space
summary information could claim that there are no further blocks
that can fit a maximum-size entry, even if there are.

The effect of this bug is that the directory may be enlarged even
though there is space within the directory for the new entry. This
wastes disk space and has a negative impact on performance.

Fix it by correctly computing the dh_firstfree array index, adding
a helper macro for clarity. Put an extra sanity check into
ufsdirhash_checkblock() to detect the situation in future.

Found by:	dwmalone
Reviewed by:	dwmalone
MFC after:	1 week
2002-03-11 19:13:22 +00:00
..
ffs I missed one VOP_CLOSE in the previous commit. 2002-03-11 16:27:04 +00:00
ifs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
ufs Fix a bug in ufsdirhash_adjfree() that caused it to incorrectly 2002-03-11 19:13:22 +00:00