diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-08-14 20:02:47 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 14:05:05 +0200 |
commit | 00361589d2eebd90fca022148c763e40d3e90871 (patch) | |
tree | 161dfa7f29d5aa907de0fee6bdc487f9a2bcb342 /fs/btrfs/file.c | |
parent | Btrfs: fix heavy delalloc related deadlock (diff) | |
download | linux-00361589d2eebd90fca022148c763e40d3e90871.tar.xz linux-00361589d2eebd90fca022148c763e40d3e90871.zip |
Btrfs: avoid starting a transaction in the write path
I noticed while looking at a deadlock that we are always starting a transaction
in cow_file_range(). This isn't really needed since we only need a transaction
if we are doing an inline extent, or if the allocator needs to allocate a chunk.
So push down all the transaction start stuff to be closer to where we actually
need a transaction in all of these cases. This will hopefully reduce our write
latency when we are committing often. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 8cc941e5b3e1..5e7ea996f105 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1339,7 +1339,6 @@ fail: static noinline int check_can_nocow(struct inode *inode, loff_t pos, size_t *write_bytes) { - struct btrfs_trans_handle *trans; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_ordered_extent *ordered; u64 lockstart, lockend; @@ -1361,16 +1360,8 @@ static noinline int check_can_nocow(struct inode *inode, loff_t pos, btrfs_put_ordered_extent(ordered); } - trans = btrfs_join_transaction(root); - if (IS_ERR(trans)) { - unlock_extent(&BTRFS_I(inode)->io_tree, lockstart, lockend); - return PTR_ERR(trans); - } - num_bytes = lockend - lockstart + 1; - ret = can_nocow_extent(trans, inode, lockstart, &num_bytes, NULL, NULL, - NULL); - btrfs_end_transaction(trans, root); + ret = can_nocow_extent(inode, lockstart, &num_bytes, NULL, NULL, NULL); if (ret <= 0) { ret = 0; } else { |