diff options
author | Josef Bacik <josef@redhat.com> | 2010-02-02 15:51:14 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-03-15 11:00:13 -0400 |
commit | 5a1a3df1f6c86926cfe8657e6f9b4b4c2f467d60 (patch) | |
tree | bc73836bf0bde137da48eaff72dae75ee729aaba /fs/btrfs/ordered-data.c | |
parent | c2a128d28a2e78e159e17e8c9274d0a9d9492555 (diff) |
Btrfs: cache ordered extent when completing io
When finishing io we run btrfs_dec_test_ordered_pending, and then immediately
run btrfs_lookup_ordered_extent, but btrfs_dec_test_ordered_pending does that
already, so we're searching twice when we don't have to. This patch lets us
pass a btrfs_ordered_extent in to btrfs_dec_test_ordered_pending so if we do
complete io on that ordered extent we can just use the one we found then instead
of having to do another btrfs_lookup_ordered_extent. This made my fio job with
the other patch go from 24 mb/s to 29 mb/s.
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index d56f732ba95e..a8ffecd0b491 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -232,11 +232,12 @@ int btrfs_add_ordered_sum(struct inode *inode, | |||
232 | * to make sure this function only returns 1 once for a given ordered extent. | 232 | * to make sure this function only returns 1 once for a given ordered extent. |
233 | */ | 233 | */ |
234 | int btrfs_dec_test_ordered_pending(struct inode *inode, | 234 | int btrfs_dec_test_ordered_pending(struct inode *inode, |
235 | struct btrfs_ordered_extent **cached, | ||
235 | u64 file_offset, u64 io_size) | 236 | u64 file_offset, u64 io_size) |
236 | { | 237 | { |
237 | struct btrfs_ordered_inode_tree *tree; | 238 | struct btrfs_ordered_inode_tree *tree; |
238 | struct rb_node *node; | 239 | struct rb_node *node; |
239 | struct btrfs_ordered_extent *entry; | 240 | struct btrfs_ordered_extent *entry = NULL; |
240 | int ret; | 241 | int ret; |
241 | 242 | ||
242 | tree = &BTRFS_I(inode)->ordered_tree; | 243 | tree = &BTRFS_I(inode)->ordered_tree; |
@@ -264,6 +265,10 @@ int btrfs_dec_test_ordered_pending(struct inode *inode, | |||
264 | else | 265 | else |
265 | ret = 1; | 266 | ret = 1; |
266 | out: | 267 | out: |
268 | if (!ret && cached && entry) { | ||
269 | *cached = entry; | ||
270 | atomic_inc(&entry->refs); | ||
271 | } | ||
267 | spin_unlock(&tree->lock); | 272 | spin_unlock(&tree->lock); |
268 | return ret == 0; | 273 | return ret == 0; |
269 | } | 274 | } |