[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: freeing, allocating and free blocks in Ext3



On Wed, 2 May 2001, Andrew Morton wrote:

> I believe Peter's main concern is that statfs() isn't
> telling the truth.  It's telling us that N blocks are
> available, when they really aren't available yet because
> they're being held up in non-allocatable state until the
> transaction which released them has committed.

> statfs() is always going to be approximate (ie: racy) in
> the presence of other tasks which are using the fs.  But
> I suggest that if it's going to be in error, it should
> under-report free space, not over-report.

<nod>

Notice that ext2 is also somewhat fishy. Right now I'm merging
a bunch of ext2 patches and fixing dquot problems required
reorganization of ext2_new_block(). I'm doing the following:
	* _always_ decrement free blocks counters before allocation.
	  Goes both for fs-wide one and for per-group (once we've
	  chosen the group).
	* if allocation fails for any reason - increment them.
	* ditto for quota allocation - we grab quota for our block and
	  for prealloc ones in the very beginning and release the
	  leftovers in the end.
As the matter of fact, with the current code I can get rid of
lock_super() on the block/inode allocation/freeing. Invariant:
free {block,inode} counters are always less or equal the actual
number of free objects. Moreover, with a little work we can
get rid of BKL in the whole block allocation path, but that's
another story...





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]