diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-06-25 16:01:30 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | a213501153fd66e2359e091b1612841305ba6551 (patch) | |
tree | 1f4c316c9d3cad0eb6d9be14cb0e67e46e815dce /fs/btrfs/file.c | |
parent | 925baeddc5b0764a53f2214a1253251bab0e0324 (diff) |
Btrfs: Replace the big fs_mutex with a collection of other locks
Extent alloctions are still protected by a large alloc_mutex.
Objectid allocations are covered by a objectid mutex
Other btree operations are protected by a lock on individual btree nodes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 73c6d085bd90..18bbe108a0e6 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -252,7 +252,6 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
252 | end_of_last_block = start_pos + num_bytes - 1; | 252 | end_of_last_block = start_pos + num_bytes - 1; |
253 | 253 | ||
254 | lock_extent(io_tree, start_pos, end_of_last_block, GFP_NOFS); | 254 | lock_extent(io_tree, start_pos, end_of_last_block, GFP_NOFS); |
255 | mutex_lock(&root->fs_info->fs_mutex); | ||
256 | trans = btrfs_start_transaction(root, 1); | 255 | trans = btrfs_start_transaction(root, 1); |
257 | if (!trans) { | 256 | if (!trans) { |
258 | err = -ENOMEM; | 257 | err = -ENOMEM; |
@@ -341,7 +340,6 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
341 | failed: | 340 | failed: |
342 | err = btrfs_end_transaction(trans, root); | 341 | err = btrfs_end_transaction(trans, root); |
343 | out_unlock: | 342 | out_unlock: |
344 | mutex_unlock(&root->fs_info->fs_mutex); | ||
345 | unlock_extent(io_tree, start_pos, end_of_last_block, GFP_NOFS); | 343 | unlock_extent(io_tree, start_pos, end_of_last_block, GFP_NOFS); |
346 | return err; | 344 | return err; |
347 | } | 345 | } |
@@ -905,9 +903,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, | |||
905 | WARN_ON(num_pages > nrptrs); | 903 | WARN_ON(num_pages > nrptrs); |
906 | memset(pages, 0, sizeof(pages)); | 904 | memset(pages, 0, sizeof(pages)); |
907 | 905 | ||
908 | mutex_lock(&root->fs_info->fs_mutex); | ||
909 | ret = btrfs_check_free_space(root, write_bytes, 0); | 906 | ret = btrfs_check_free_space(root, write_bytes, 0); |
910 | mutex_unlock(&root->fs_info->fs_mutex); | ||
911 | if (ret) | 907 | if (ret) |
912 | goto out; | 908 | goto out; |
913 | 909 | ||
@@ -998,9 +994,9 @@ static int btrfs_sync_file(struct file *file, | |||
998 | * check the transaction that last modified this inode | 994 | * check the transaction that last modified this inode |
999 | * and see if its already been committed | 995 | * and see if its already been committed |
1000 | */ | 996 | */ |
1001 | mutex_lock(&root->fs_info->fs_mutex); | ||
1002 | if (!BTRFS_I(inode)->last_trans) | 997 | if (!BTRFS_I(inode)->last_trans) |
1003 | goto out; | 998 | goto out; |
999 | |||
1004 | mutex_lock(&root->fs_info->trans_mutex); | 1000 | mutex_lock(&root->fs_info->trans_mutex); |
1005 | if (BTRFS_I(inode)->last_trans <= | 1001 | if (BTRFS_I(inode)->last_trans <= |
1006 | root->fs_info->last_trans_committed) { | 1002 | root->fs_info->last_trans_committed) { |
@@ -1023,7 +1019,6 @@ static int btrfs_sync_file(struct file *file, | |||
1023 | } | 1019 | } |
1024 | ret = btrfs_commit_transaction(trans, root); | 1020 | ret = btrfs_commit_transaction(trans, root); |
1025 | out: | 1021 | out: |
1026 | mutex_unlock(&root->fs_info->fs_mutex); | ||
1027 | return ret > 0 ? EIO : ret; | 1022 | return ret > 0 ? EIO : ret; |
1028 | } | 1023 | } |
1029 | 1024 | ||