Skip to content

Commit

Permalink
Btrfs: get better concurrency for snapshot-aware defrag work
Browse files Browse the repository at this point in the history
Using spinning case instead of blocking will result in better concurrency
overall.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
Liu Bo authored and Chris Mason committed Mar 14, 2013
1 parent de3cb94 commit a09a0a7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = start;

path->leave_spinning = 1;
if (merge) {
struct btrfs_file_extent_item *fi;
u64 extent_len;
Expand Down Expand Up @@ -2368,6 +2369,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,

btrfs_mark_buffer_dirty(leaf);
inode_add_bytes(inode, len);
btrfs_release_path(path);

ret = btrfs_inc_extent_ref(trans, root, new->bytenr,
new->disk_len, 0,
Expand All @@ -2381,6 +2383,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
ret = 1;
out_free_path:
btrfs_release_path(path);
path->leave_spinning = 0;
btrfs_end_transaction(trans, root);
out_unlock:
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
Expand Down

0 comments on commit a09a0a7

Please sign in to comment.