diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-09-02 16:24:52 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-09-11 13:31:05 -0400 |
commit | 890871be854b5f5e43e7ba2475f706209906cc24 (patch) | |
tree | 9d087adf7a28bb910992d07d93ea2a992e394110 /fs/btrfs/extent-tree.c | |
parent | 57fd5a5ff8b48b99e90b22fc143082aba755c6c0 (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/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 72a2b9c28e9f..edd86ae9e149 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5396,9 +5396,9 @@ static noinline int relocate_data_extent(struct inode *reloc_inode, | |||
5396 | lock_extent(&BTRFS_I(reloc_inode)->io_tree, start, end, GFP_NOFS); | 5396 | lock_extent(&BTRFS_I(reloc_inode)->io_tree, start, end, GFP_NOFS); |
5397 | while (1) { | 5397 | while (1) { |
5398 | int ret; | 5398 | int ret; |
5399 | spin_lock(&em_tree->lock); | 5399 | write_lock(&em_tree->lock); |
5400 | ret = add_extent_mapping(em_tree, em); | 5400 | ret = add_extent_mapping(em_tree, em); |
5401 | spin_unlock(&em_tree->lock); | 5401 | write_unlock(&em_tree->lock); |
5402 | if (ret != -EEXIST) { | 5402 | if (ret != -EEXIST) { |
5403 | free_extent_map(em); | 5403 | free_extent_map(em); |
5404 | break; | 5404 | break; |