summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason2008-04-17 17:29:12 +0200
committerChris Mason2008-09-25 17:04:01 +0200
commit3b951516ed703af0f6d82053937655ad69b60864 (patch)
tree616e648b8683e6bb2996c7ce6bafb8f592244698 /fs/btrfs/extent_io.c
parentBtrfs: Only do async bio submission for pdflush (diff)
downloadkernel-qcow2-linux-3b951516ed703af0f6d82053937655ad69b60864.tar.gz
kernel-qcow2-linux-3b951516ed703af0f6d82053937655ad69b60864.tar.xz
kernel-qcow2-linux-3b951516ed703af0f6d82053937655ad69b60864.zip
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,
search_again:
node = tree_search(tree, cur_start);
if (!node) {
- *end = (u64)-1;
+ if (!found)
+ *end = (u64)-1;
goto out;
}
@@ -1540,6 +1541,8 @@ static int end_bio_extent_readpage(struct bio *bio,
start, end, state);
if (ret == 0) {
state = NULL;
+ uptodate =
+ test_bit(BIO_UPTODATE, &bio->bi_flags);
continue;
}
}
@@ -1555,10 +1558,11 @@ static int end_bio_extent_readpage(struct bio *bio,
!(state->state & EXTENT_LOCKED))
state = NULL;
}
- if (!state && uptodate) {
+ if (!state) {
spin_unlock_irqrestore(&tree->lock, flags);
- set_extent_uptodate(tree, start, end,
- GFP_ATOMIC);
+ if (uptodate)
+ set_extent_uptodate(tree, start, end,
+ GFP_ATOMIC);
unlock_extent(tree, start, end, GFP_ATOMIC);
goto next_io;
}