aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-16 11:15:20 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commite015640f9c4fa2417dcc3bbbb3b2b61ad4059ab0 (patch)
tree2ba41617e428f60ff970abc8a862ab77980b4a20 /fs/btrfs/inode.c
parent44b8bd7edda4f63de180d0f7325c9fb704b3806b (diff)
Btrfs: Write bio checksumming outside the FS mutex
This significantly improves streaming write performance by allowing concurrency in the data checksumming. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 457daf725d29..3e1f21c632c1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -330,14 +330,23 @@ int __btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
330 struct btrfs_root *root = BTRFS_I(inode)->root; 330 struct btrfs_root *root = BTRFS_I(inode)->root;
331 struct btrfs_trans_handle *trans; 331 struct btrfs_trans_handle *trans;
332 int ret = 0; 332 int ret = 0;
333 char *sums = NULL;
334
335 ret = btrfs_csum_one_bio(root, bio, &sums);
336 BUG_ON(ret);
333 337
334 mutex_lock(&root->fs_info->fs_mutex); 338 mutex_lock(&root->fs_info->fs_mutex);
335 trans = btrfs_start_transaction(root, 1); 339 trans = btrfs_start_transaction(root, 1);
340
336 btrfs_set_trans_block_group(trans, inode); 341 btrfs_set_trans_block_group(trans, inode);
337 btrfs_csum_file_blocks(trans, root, inode, bio); 342 btrfs_csum_file_blocks(trans, root, inode, bio, sums);
343
338 ret = btrfs_end_transaction(trans, root); 344 ret = btrfs_end_transaction(trans, root);
339 BUG_ON(ret); 345 BUG_ON(ret);
340 mutex_unlock(&root->fs_info->fs_mutex); 346 mutex_unlock(&root->fs_info->fs_mutex);
347
348 kfree(sums);
349
341 return btrfs_map_bio(root, rw, bio, mirror_num); 350 return btrfs_map_bio(root, rw, bio, mirror_num);
342} 351}
343 352