Commit c1be9c1a authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: promote extent_read_full_page to btrfs_readpage

Now that btrfs_readpage is the only caller of extent_read_full_page the
latter can be open coded in the former. Use the occassion to rename
__extent_read_full_page to extent_read_full_page. To facillitate this
change submit_one_bio has to be exported as well.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 72cffee4
...@@ -160,8 +160,8 @@ static int add_extent_changeset(struct extent_state *state, unsigned bits, ...@@ -160,8 +160,8 @@ static int add_extent_changeset(struct extent_state *state, unsigned bits,
return ret; return ret;
} }
static int __must_check submit_one_bio(struct bio *bio, int mirror_num, int __must_check submit_one_bio(struct bio *bio, int mirror_num,
unsigned long bio_flags) unsigned long bio_flags)
{ {
blk_status_t ret = 0; blk_status_t ret = 0;
struct extent_io_tree *tree = bio->bi_private; struct extent_io_tree *tree = bio->bi_private;
...@@ -3365,9 +3365,8 @@ static inline void contiguous_readpages(struct page *pages[], int nr_pages, ...@@ -3365,9 +3365,8 @@ static inline void contiguous_readpages(struct page *pages[], int nr_pages,
} }
} }
static int __extent_read_full_page(struct page *page, struct bio **bio, int extent_read_full_page(struct page *page, struct bio **bio, int mirror_num,
int mirror_num, unsigned long *bio_flags, unsigned long *bio_flags, unsigned int read_flags)
unsigned int read_flags)
{ {
struct btrfs_inode *inode = BTRFS_I(page->mapping->host); struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
u64 start = page_offset(page); u64 start = page_offset(page);
...@@ -3381,18 +3380,6 @@ static int __extent_read_full_page(struct page *page, struct bio **bio, ...@@ -3381,18 +3380,6 @@ static int __extent_read_full_page(struct page *page, struct bio **bio,
return ret; return ret;
} }
int extent_read_full_page(struct page *page)
{
struct bio *bio = NULL;
unsigned long bio_flags = 0;
int ret;
ret = __extent_read_full_page(page, &bio, 0, &bio_flags, 0);
if (bio)
ret = submit_one_bio(bio, 0, bio_flags);
return ret;
}
static void update_nr_written(struct writeback_control *wbc, static void update_nr_written(struct writeback_control *wbc,
unsigned long nr_written) unsigned long nr_written)
{ {
......
...@@ -193,7 +193,10 @@ typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode, ...@@ -193,7 +193,10 @@ typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
int try_release_extent_mapping(struct page *page, gfp_t mask); int try_release_extent_mapping(struct page *page, gfp_t mask);
int try_release_extent_buffer(struct page *page); int try_release_extent_buffer(struct page *page);
int extent_read_full_page(struct page *page); int __must_check submit_one_bio(struct bio *bio, int mirror_num,
unsigned long bio_flags);
int extent_read_full_page(struct page *page, struct bio **bio, int mirror_num,
unsigned long *bio_flags, unsigned int read_flags);
int extent_write_full_page(struct page *page, struct writeback_control *wbc); int extent_write_full_page(struct page *page, struct writeback_control *wbc);
int extent_write_locked_range(struct inode *inode, u64 start, u64 end, int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
int mode); int mode);
......
...@@ -8040,7 +8040,14 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -8040,7 +8040,14 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
int btrfs_readpage(struct file *file, struct page *page) int btrfs_readpage(struct file *file, struct page *page)
{ {
return extent_read_full_page(page); struct bio *bio = NULL;
unsigned long bio_flags = 0;
int ret;
ret = extent_read_full_page(page, &bio, 0, &bio_flags, 0);
if (bio)
ret = submit_one_bio(bio, 0, bio_flags);
return ret;
} }
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