aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-09-02 16:24:52 -0400
committerChris Mason <chris.mason@oracle.com>2009-09-11 13:31:05 -0400
commit890871be854b5f5e43e7ba2475f706209906cc24 (patch)
tree9d087adf7a28bb910992d07d93ea2a992e394110 /fs/btrfs/relocation.c
parent57fd5a5ff8b48b99e90b22fc143082aba755c6c0 (diff)
Btrfs: switch extent_map to a rw lock
There are two main users of the extent_map tree. The first is regular file inodes, where it is evenly spread between readers and writers. The second is the chunk allocation tree, which maps blocks from logical addresses to phyiscal ones, and it is 99.99% reads. The mapping tree is a point of lock contention during heavy IO workloads, so this commit switches things to a rw lock. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index c04f7f212602..4adab903fc2b 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2646,9 +2646,9 @@ int relocate_data_extent(struct inode *inode, struct btrfs_key *extent_key)
2646 lock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); 2646 lock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS);
2647 while (1) { 2647 while (1) {
2648 int ret; 2648 int ret;
2649 spin_lock(&em_tree->lock); 2649 write_lock(&em_tree->lock);
2650 ret = add_extent_mapping(em_tree, em); 2650 ret = add_extent_mapping(em_tree, em);
2651 spin_unlock(&em_tree->lock); 2651 write_unlock(&em_tree->lock);
2652 if (ret != -EEXIST) { 2652 if (ret != -EEXIST) {
2653 free_extent_map(em); 2653 free_extent_map(em);
2654 break; 2654 break;