btrfs: hooks for readahead

This adds the hooks needed for readahead. In the readpage_end_io_hook,
the extent state is checked for the EXTENT_READAHEAD flag. Only in this
case the readahead hook is called, to keep the impact on non-ra as low
as possible.
Additionally, a hook for a failed IO is added, otherwise readahead would
wait indefinitely for the extent to finish.

Changes for v2:
 - eliminate race condition

Signed-off-by: Arne Jansen <sensille@gmx.net>
This commit is contained in:
Arne Jansen
2011-06-10 13:55:54 +02:00
parent 7414a03fbf
commit 4bb31e928d
2 changed files with 38 additions and 1 deletions

View File

@@ -1731,7 +1731,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
if (!uptodate && tree->ops &&
tree->ops->readpage_io_failed_hook) {
ret = tree->ops->readpage_io_failed_hook(bio, page,
start, end, NULL);
start, end, state);
if (ret == 0) {
uptodate =
test_bit(BIO_UPTODATE, &bio->bi_flags);