diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-04-18 10:29:50 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:02 -0400 |
commit | 7b13b7b119c932a5eca486db4113f4c1fe3b97a8 (patch) | |
tree | cf4432c69f660f0c22c1b6415c0d907ba6d44c8a /fs/btrfs/disk-io.c | |
parent | 7ae9c09d8f001eb19ee2ba219dc5c3d4f6d60614 (diff) |
Btrfs: Don't drop extent_map cache during releasepage on the btree inode
The btree inode should only have a single extent_map in the cache,
it doesn't make sense to ever drop it.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 76ee7a4ae00c..2de2b00afebc 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -76,13 +76,12 @@ struct extent_map *btree_get_extent(struct inode *inode, struct page *page, | |||
76 | struct extent_map *em; | 76 | struct extent_map *em; |
77 | int ret; | 77 | int ret; |
78 | 78 | ||
79 | again: | ||
80 | spin_lock(&em_tree->lock); | 79 | spin_lock(&em_tree->lock); |
81 | em = lookup_extent_mapping(em_tree, start, len); | 80 | em = lookup_extent_mapping(em_tree, start, len); |
82 | spin_unlock(&em_tree->lock); | 81 | spin_unlock(&em_tree->lock); |
83 | if (em) { | 82 | if (em) |
84 | goto out; | 83 | goto out; |
85 | } | 84 | |
86 | em = alloc_extent_map(GFP_NOFS); | 85 | em = alloc_extent_map(GFP_NOFS); |
87 | if (!em) { | 86 | if (!em) { |
88 | em = ERR_PTR(-ENOMEM); | 87 | em = ERR_PTR(-ENOMEM); |
@@ -95,15 +94,21 @@ again: | |||
95 | 94 | ||
96 | spin_lock(&em_tree->lock); | 95 | spin_lock(&em_tree->lock); |
97 | ret = add_extent_mapping(em_tree, em); | 96 | ret = add_extent_mapping(em_tree, em); |
98 | spin_unlock(&em_tree->lock); | ||
99 | |||
100 | if (ret == -EEXIST) { | 97 | if (ret == -EEXIST) { |
101 | free_extent_map(em); | 98 | free_extent_map(em); |
102 | em = NULL; | 99 | em = lookup_extent_mapping(em_tree, start, len); |
103 | goto again; | 100 | if (em) |
101 | ret = 0; | ||
102 | else | ||
103 | ret = -EIO; | ||
104 | } else if (ret) { | 104 | } else if (ret) { |
105 | em = ERR_PTR(ret); | 105 | free_extent_map(em); |
106 | em = NULL; | ||
106 | } | 107 | } |
108 | spin_unlock(&em_tree->lock); | ||
109 | |||
110 | if (ret) | ||
111 | em = ERR_PTR(ret); | ||
107 | out: | 112 | out: |
108 | return em; | 113 | return em; |
109 | } | 114 | } |
@@ -496,7 +501,7 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags) | |||
496 | } | 501 | } |
497 | tree = &BTRFS_I(page->mapping->host)->io_tree; | 502 | tree = &BTRFS_I(page->mapping->host)->io_tree; |
498 | map = &BTRFS_I(page->mapping->host)->extent_tree; | 503 | map = &BTRFS_I(page->mapping->host)->extent_tree; |
499 | ret = try_release_extent_mapping(map, tree, page, gfp_flags); | 504 | ret = try_release_extent_state(map, tree, page, gfp_flags); |
500 | if (ret == 1) { | 505 | if (ret == 1) { |
501 | invalidate_extent_lru(tree, page_offset(page), PAGE_CACHE_SIZE); | 506 | invalidate_extent_lru(tree, page_offset(page), PAGE_CACHE_SIZE); |
502 | ClearPagePrivate(page); | 507 | ClearPagePrivate(page); |