aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-18 12:01:11 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit7f3c74fb831fa19bafe087e817c0a5ff3883f1ea (patch)
tree416e95db10e408240916d5061caf1e5d1182b330 /fs/btrfs/file.c
parent211f90e68b679d27fe23c5505f86d6ce62c98bae (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/file.c')
-rw-r--r--fs/btrfs/file.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 40ad1b2958cb..eccdb9562ba8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -358,9 +358,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end)
358 struct extent_map *split = NULL; 358 struct extent_map *split = NULL;
359 struct extent_map *split2 = NULL; 359 struct extent_map *split2 = NULL;
360 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 360 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
361 struct extent_map *tmp;
362 u64 len = end - start + 1; 361 u64 len = end - start + 1;
363 u64 next_start;
364 int ret; 362 int ret;
365 int testend = 1; 363 int testend = 1;
366 364
@@ -381,8 +379,16 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end)
381 spin_unlock(&em_tree->lock); 379 spin_unlock(&em_tree->lock);
382 break; 380 break;
383 } 381 }
384 tmp = rb_entry(&em->rb_node, struct extent_map, rb_node); 382 if (test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
385 next_start = tmp->start; 383 start = em->start + em->len;
384 free_extent_map(em);
385 spin_unlock(&em_tree->lock);
386 if (start < end) {
387 len = end - start + 1;
388 continue;
389 }
390 break;
391 }
386 remove_extent_mapping(em_tree, em); 392 remove_extent_mapping(em_tree, em);
387 393
388 if (em->block_start < EXTENT_MAP_LAST_BYTE && 394 if (em->block_start < EXTENT_MAP_LAST_BYTE &&