diff options
author | Josef Bacik <josef@redhat.com> | 2009-10-08 13:34:05 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-10-08 15:21:10 -0400 |
commit | 32c00aff718bb54a214b39146bdd9ac01511cd25 (patch) | |
tree | c094ee494723a9ebc9d83cb95607f06351665639 /fs/btrfs/btrfs_inode.h | |
parent | a3429ab70b04363c6190964e82f04f44f3e34cf0 (diff) |
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>
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index a54d354cefcb..c71abec0ab90 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -128,12 +128,14 @@ struct btrfs_inode { | |||
128 | u64 last_unlink_trans; | 128 | u64 last_unlink_trans; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * These two counters are for delalloc metadata reservations. We keep | 131 | * Counters to keep track of the number of extent item's we may use due |
132 | * track of how many extents we've accounted for vs how many extents we | 132 | * to delalloc and such. outstanding_extents is the number of extent |
133 | * have. | 133 | * items we think we'll end up using, and reserved_extents is the number |
134 | * of extent items we've reserved metadata for. | ||
134 | */ | 135 | */ |
135 | int delalloc_reserved_extents; | 136 | spinlock_t accounting_lock; |
136 | int delalloc_extents; | 137 | int reserved_extents; |
138 | int outstanding_extents; | ||
137 | 139 | ||
138 | /* | 140 | /* |
139 | * ordered_data_close is set by truncate when a file that used | 141 | * ordered_data_close is set by truncate when a file that used |