diff options
author | Arne Jansen <sensille@gmx.net> | 2011-06-10 08:06:53 -0400 |
---|---|---|
committer | Arne Jansen <sensille@gmx.net> | 2011-10-02 02:47:55 -0400 |
commit | bb82ab88dfdb12948af58989c75bfe904bc1b09d (patch) | |
tree | 1311f5b5ec398cad99aa0da120aed0ee8a224a36 /fs/btrfs/disk-io.c | |
parent | 286d6e70aa6cf0f0235653eb1049bfc04610b4fb (diff) |
btrfs: add an extra wait mode to read_extent_buffer_pages
read_extent_buffer_pages currently has two modes, either trigger a read
without waiting for anything, or wait for the I/O to finish. The former
also bails when it's unable to lock the page. This patch now adds an
additional parameter to allow it to block on page lock, but don't wait
for completion.
Changes v5:
- merge the 2 wait parameters into one and define WAIT_NONE, WAIT_COMPLETE and
WAIT_PAGE_LOCK
Change v6:
- fix bug introduced in v5
Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 07b3ac662e19..e6170e142cad 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -367,7 +367,8 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, | |||
367 | clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); | 367 | clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); |
368 | io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; | 368 | io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; |
369 | while (1) { | 369 | while (1) { |
370 | ret = read_extent_buffer_pages(io_tree, eb, start, 1, | 370 | ret = read_extent_buffer_pages(io_tree, eb, start, |
371 | WAIT_COMPLETE, | ||
371 | btree_get_extent, mirror_num); | 372 | btree_get_extent, mirror_num); |
372 | if (!ret && | 373 | if (!ret && |
373 | !verify_parent_transid(io_tree, eb, parent_transid)) | 374 | !verify_parent_transid(io_tree, eb, parent_transid)) |
@@ -974,7 +975,7 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, | |||
974 | if (!buf) | 975 | if (!buf) |
975 | return 0; | 976 | return 0; |
976 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, | 977 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, |
977 | buf, 0, 0, btree_get_extent, 0); | 978 | buf, 0, WAIT_NONE, btree_get_extent, 0); |
978 | free_extent_buffer(buf); | 979 | free_extent_buffer(buf); |
979 | return ret; | 980 | return ret; |
980 | } | 981 | } |