Commit 8ddc7d9c authored by Jan Schmidt's avatar Jan Schmidt

btrfs: add mirror_num to extent_read_full_page

Currently, extent_read_full_page always assumes we are trying to read mirror
0, which generally is the best we can do. To add flexibility, pass it as a
parameter. This will be needed by scrub fixup code.
Signed-off-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
parent 193ea74b
...@@ -908,7 +908,7 @@ static int btree_readpage(struct file *file, struct page *page) ...@@ -908,7 +908,7 @@ static int btree_readpage(struct file *file, struct page *page)
{ {
struct extent_io_tree *tree; struct extent_io_tree *tree;
tree = &BTRFS_I(page->mapping->host)->io_tree; tree = &BTRFS_I(page->mapping->host)->io_tree;
return extent_read_full_page(tree, page, btree_get_extent); return extent_read_full_page(tree, page, btree_get_extent, 0);
} }
static int btree_releasepage(struct page *page, gfp_t gfp_flags) static int btree_releasepage(struct page *page, gfp_t gfp_flags)
......
...@@ -2076,16 +2076,16 @@ static int __extent_read_full_page(struct extent_io_tree *tree, ...@@ -2076,16 +2076,16 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
} }
int extent_read_full_page(struct extent_io_tree *tree, struct page *page, int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
get_extent_t *get_extent) get_extent_t *get_extent, int mirror_num)
{ {
struct bio *bio = NULL; struct bio *bio = NULL;
unsigned long bio_flags = 0; unsigned long bio_flags = 0;
int ret; int ret;
ret = __extent_read_full_page(tree, page, get_extent, &bio, 0, ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num,
&bio_flags); &bio_flags);
if (bio) if (bio)
ret = submit_one_bio(READ, bio, 0, bio_flags); ret = submit_one_bio(READ, bio, mirror_num, bio_flags);
return ret; return ret;
} }
......
...@@ -185,7 +185,7 @@ int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -185,7 +185,7 @@ int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int extent_read_full_page(struct extent_io_tree *tree, struct page *page, int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
get_extent_t *get_extent); get_extent_t *get_extent, int mirror_num);
int __init extent_io_init(void); int __init extent_io_init(void);
void extent_io_exit(void); void extent_io_exit(void);
......
...@@ -6289,7 +6289,7 @@ int btrfs_readpage(struct file *file, struct page *page) ...@@ -6289,7 +6289,7 @@ int btrfs_readpage(struct file *file, struct page *page)
{ {
struct extent_io_tree *tree; struct extent_io_tree *tree;
tree = &BTRFS_I(page->mapping->host)->io_tree; tree = &BTRFS_I(page->mapping->host)->io_tree;
return extent_read_full_page(tree, page, btrfs_get_extent); return extent_read_full_page(tree, page, btrfs_get_extent, 0);
} }
static int btrfs_writepage(struct page *page, struct writeback_control *wbc) static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment