diff options
author | Nikolay Borisov <nborisov@suse.com> | 2020-09-14 12:37:06 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-10-07 12:13:20 +0200 |
commit | 1a5ee1e6260368da8347e66321e157a7de288ef3 (patch) | |
tree | 103d6652f40e1023c80b13a9378767301563b1d1 /fs/btrfs | |
parent | 208d6341e85b4f2628a90438fce5d8a2dd97d6ba (diff) | |
download | linux-1a5ee1e6260368da8347e66321e157a7de288ef3.tar.gz linux-1a5ee1e6260368da8347e66321e157a7de288ef3.tar.bz2 linux-1a5ee1e6260368da8347e66321e157a7de288ef3.zip |
btrfs: remove btrfs_get_extent indirection from __do_readpage
Now that this function is only responsible for reading data pages it's
no longer necessary to pass get_extent_t parameter across several
layers of functions. This patch removes this parameter from multiple
functions: __get_extent_map/__do_readpage/__extent_read_full_page/
extent_read_full_page and simply calls btrfs_get_extent directly in
__get_extent_map.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent_io.c | 31 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 |
3 files changed, 14 insertions, 22 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 0a6cda4c30ed..4a0675ec90fa 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3110,8 +3110,7 @@ void set_page_extent_mapped(struct page *page) static struct extent_map * __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, - u64 start, u64 len, get_extent_t *get_extent, - struct extent_map **em_cached) + u64 start, u64 len, struct extent_map **em_cached) { struct extent_map *em; @@ -3127,7 +3126,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, *em_cached = NULL; } - em = get_extent(BTRFS_I(inode), page, pg_offset, start, len); + em = btrfs_get_extent(BTRFS_I(inode), page, pg_offset, start, len); if (em_cached && !IS_ERR_OR_NULL(em)) { BUG_ON(*em_cached); refcount_inc(&em->refs); @@ -3142,9 +3141,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, * XXX JDM: This needs looking at to ensure proper page locking * return 0 on success, otherwise return error */ -static int __do_readpage(struct page *page, - get_extent_t *get_extent, - struct extent_map **em_cached, +static int __do_readpage(struct page *page, struct extent_map **em_cached, struct bio **bio, int mirror_num, unsigned long *bio_flags, unsigned int read_flags, u64 *prev_em_start) @@ -3209,7 +3206,7 @@ static int __do_readpage(struct page *page, break; } em = __get_extent_map(inode, page, pg_offset, cur, - end - cur + 1, get_extent, em_cached); + end - cur + 1, em_cached); if (IS_ERR_OR_NULL(em)) { SetPageError(page); unlock_extent(tree, cur, end); @@ -3362,16 +3359,14 @@ static inline void contiguous_readpages(struct page *pages[], int nr_pages, btrfs_lock_and_flush_ordered_range(inode, start, end, NULL); for (index = 0; index < nr_pages; index++) { - __do_readpage(pages[index], btrfs_get_extent, em_cached, - bio, 0, bio_flags, REQ_RAHEAD, prev_em_start); + __do_readpage(pages[index], em_cached, bio, 0, bio_flags, + REQ_RAHEAD, prev_em_start); put_page(pages[index]); } } -static int __extent_read_full_page(struct page *page, - get_extent_t *get_extent, - struct bio **bio, int mirror_num, - unsigned long *bio_flags, +static int __extent_read_full_page(struct page *page, struct bio **bio, + int mirror_num, unsigned long *bio_flags, unsigned int read_flags) { struct btrfs_inode *inode = BTRFS_I(page->mapping->host); @@ -3381,20 +3376,18 @@ static int __extent_read_full_page(struct page *page, btrfs_lock_and_flush_ordered_range(inode, start, end, NULL); - ret = __do_readpage(page, get_extent, NULL, bio, mirror_num, - bio_flags, read_flags, NULL); + ret = __do_readpage(page, NULL, bio, mirror_num, bio_flags, read_flags, + NULL); return ret; } -int extent_read_full_page(struct page *page, get_extent_t *get_extent, - int mirror_num) +int extent_read_full_page(struct page *page, int mirror_num) { struct bio *bio = NULL; unsigned long bio_flags = 0; int ret; - ret = __extent_read_full_page(page, get_extent, &bio, mirror_num, - &bio_flags, 0); + ret = __extent_read_full_page(page, &bio, mirror_num, &bio_flags, 0); if (bio) ret = submit_one_bio(bio, mirror_num, bio_flags); return ret; diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 06611947a9f7..272d5281bd4d 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -193,8 +193,7 @@ 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_buffer(struct page *page); -int extent_read_full_page(struct page *page, get_extent_t *get_extent, - int mirror_num); +int extent_read_full_page(struct page *page, int mirror_num); 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 mode); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ff9b22b71171..7db2cbb469e1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8040,7 +8040,7 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int btrfs_readpage(struct file *file, struct page *page) { - return extent_read_full_page(page, btrfs_get_extent, 0); + return extent_read_full_page(page, 0); } static int btrfs_writepage(struct page *page, struct writeback_control *wbc) |