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_io.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_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8d7a152a90c6..41cf1b451b41 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2786,15 +2786,15 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2786 | u64 len; | 2786 | u64 len; |
2787 | while (start <= end) { | 2787 | while (start <= end) { |
2788 | len = end - start + 1; | 2788 | len = end - start + 1; |
2789 | spin_lock(&map->lock); | 2789 | write_lock(&map->lock); |
2790 | em = lookup_extent_mapping(map, start, len); | 2790 | em = lookup_extent_mapping(map, start, len); |
2791 | if (!em || IS_ERR(em)) { | 2791 | if (!em || IS_ERR(em)) { |
2792 | spin_unlock(&map->lock); | 2792 | write_unlock(&map->lock); |
2793 | break; | 2793 | break; |
2794 | } | 2794 | } |
2795 | if (test_bit(EXTENT_FLAG_PINNED, &em->flags) || | 2795 | if (test_bit(EXTENT_FLAG_PINNED, &em->flags) || |
2796 | em->start != start) { | 2796 | em->start != start) { |
2797 | spin_unlock(&map->lock); | 2797 | write_unlock(&map->lock); |
2798 | free_extent_map(em); | 2798 | free_extent_map(em); |
2799 | break; | 2799 | break; |
2800 | } | 2800 | } |
@@ -2808,7 +2808,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2808 | free_extent_map(em); | 2808 | free_extent_map(em); |
2809 | } | 2809 | } |
2810 | start = extent_map_end(em); | 2810 | start = extent_map_end(em); |
2811 | spin_unlock(&map->lock); | 2811 | write_unlock(&map->lock); |
2812 | 2812 | ||
2813 | /* once for us */ | 2813 | /* once for us */ |
2814 | free_extent_map(em); | 2814 | free_extent_map(em); |