]> bbs.cooldavid.org Git - net-next-2.6.git/commit
Btrfs: release delalloc reservations on extent item insertion
authorJosef Bacik <josef@redhat.com>
Thu, 8 Oct 2009 17:34:05 +0000 (13:34 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 8 Oct 2009 19:21:10 +0000 (15:21 -0400)
commit32c00aff718bb54a214b39146bdd9ac01511cd25
treec094ee494723a9ebc9d83cb95607f06351665639
parenta3429ab70b04363c6190964e82f04f44f3e34cf0
Btrfs: release delalloc reservations on extent item insertion

This patch fixes an issue with the delalloc metadata space reservation
code.  The problem is we used to free the reservation as soon as we
allocated the delalloc region.  The problem with this is if we are not
inserting an inline extent, we don't actually insert the extent item until
after the ordered extent is written out.  This patch does 3 things,

1) It moves the reservation clearing stuff into the ordered code, so when
we remove the ordered extent we remove the reservation.
2) It adds a EXTENT_DO_ACCOUNTING flag that gets passed when we clear
delalloc bits in the cases where we want to clear the metadata reservation
when we clear the delalloc extent, in the case that we do an inline extent
or we invalidate the page.
3) It adds another waitqueue to the space info so that when we start a fs
wide delalloc flush, anybody else who also hits that area will simply wait
for the flush to finish and then try to make their allocation.

This has been tested thoroughly to make sure we did not regress on
performance.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/btrfs_inode.h
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c