diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-07-18 12:01:11 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | 7f3c74fb831fa19bafe087e817c0a5ff3883f1ea (patch) | |
tree | 416e95db10e408240916d5061caf1e5d1182b330 /fs/btrfs/extent_map.c | |
parent | 211f90e68b679d27fe23c5505f86d6ce62c98bae (diff) |
Btrfs: Keep extent mappings in ram until pending ordered extents are done
It was possible for stale mappings from disk to be used instead of the
new pending ordered extent. This adds a flag to the extent map struct
to keep it pinned until the pending ordered extent is actually on disk.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 81123277c2b8..71b1ac155355 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -173,6 +173,9 @@ static inline struct rb_node *tree_search(struct rb_root *root, u64 offset) | |||
173 | 173 | ||
174 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) | 174 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) |
175 | { | 175 | { |
176 | if (test_bit(EXTENT_FLAG_PINNED, &prev->flags)) | ||
177 | return 0; | ||
178 | |||
176 | if (extent_map_end(prev) == next->start && | 179 | if (extent_map_end(prev) == next->start && |
177 | prev->flags == next->flags && | 180 | prev->flags == next->flags && |
178 | prev->bdev == next->bdev && | 181 | prev->bdev == next->bdev && |
@@ -320,6 +323,7 @@ int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em) | |||
320 | { | 323 | { |
321 | int ret = 0; | 324 | int ret = 0; |
322 | 325 | ||
326 | WARN_ON(test_bit(EXTENT_FLAG_PINNED, &em->flags)); | ||
323 | BUG_ON(spin_trylock(&tree->lock)); | 327 | BUG_ON(spin_trylock(&tree->lock)); |
324 | rb_erase(&em->rb_node, &tree->map); | 328 | rb_erase(&em->rb_node, &tree->map); |
325 | em->in_tree = 0; | 329 | em->in_tree = 0; |