aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-17 11:29:12 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commit3b951516ed703af0f6d82053937655ad69b60864 (patch)
tree616e648b8683e6bb2996c7ce6bafb8f592244698 /fs/btrfs/extent_io.c
parent7b859fe7cd383fa5e7e379884a748680d0af7bcc (diff)
Btrfs: Use the extent map cache to find the logical disk block during data retries
The data read retry code needs to find the logical disk block before it can resubmit new bios. But, finding this block isn't allowed to take the fs_mutex because that will deadlock with a number of different callers. This changes the retry code to use the extent map cache instead, but that requires the extent map cache to have the extent we're looking for. This is a problem because btrfs_drop_extent_cache just drops the entire extent instead of the little tiny part it is invalidating. The bulk of the code in this patch changes btrfs_drop_extent_cache to invalidate only a portion of the extent cache, and changes btrfs_get_extent to deal with the results. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 88322684be6a..21597bea21fd 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1025,7 +1025,8 @@ u64 find_lock_delalloc_range(struct extent_io_tree *tree,
1025search_again: 1025search_again:
1026 node = tree_search(tree, cur_start); 1026 node = tree_search(tree, cur_start);
1027 if (!node) { 1027 if (!node) {
1028 *end = (u64)-1; 1028 if (!found)
1029 *end = (u64)-1;
1029 goto out; 1030 goto out;
1030 } 1031 }
1031 1032
@@ -1540,6 +1541,8 @@ static int end_bio_extent_readpage(struct bio *bio,
1540 start, end, state); 1541 start, end, state);
1541 if (ret == 0) { 1542 if (ret == 0) {
1542 state = NULL; 1543 state = NULL;
1544 uptodate =
1545 test_bit(BIO_UPTODATE, &bio->bi_flags);
1543 continue; 1546 continue;
1544 } 1547 }
1545 } 1548 }
@@ -1555,10 +1558,11 @@ static int end_bio_extent_readpage(struct bio *bio,
1555 !(state->state & EXTENT_LOCKED)) 1558 !(state->state & EXTENT_LOCKED))
1556 state = NULL; 1559 state = NULL;
1557 } 1560 }
1558 if (!state && uptodate) { 1561 if (!state) {
1559 spin_unlock_irqrestore(&tree->lock, flags); 1562 spin_unlock_irqrestore(&tree->lock, flags);
1560 set_extent_uptodate(tree, start, end, 1563 if (uptodate)
1561 GFP_ATOMIC); 1564 set_extent_uptodate(tree, start, end,
1565 GFP_ATOMIC);
1562 unlock_extent(tree, start, end, GFP_ATOMIC); 1566 unlock_extent(tree, start, end, GFP_ATOMIC);
1563 goto next_io; 1567 goto next_io;
1564 } 1568 }