Commit fd5a6f63 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: remove duplicated parameters from submit_data_read_repair()

The function submit_data_read_repair() is only called for buffered data
read path, thus those members can be calculated using bvec directly:

- start
  start = page_offset(bvec->bv_page) + bvec->bv_offset;

- end
  end = start + bvec->bv_len - 1;

- page
  page = bvec->bv_page;

- pgoff
  pgoff = bvec->bv_offset;

Thus we can safely replace those 4 parameters with just one bio_vec.

Also remove the unused return value.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
[hch: also remove the return value]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ae643a74
...@@ -2727,18 +2727,17 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len) ...@@ -2727,18 +2727,17 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len)
btrfs_subpage_end_reader(fs_info, page, start, len); btrfs_subpage_end_reader(fs_info, page, start, len);
} }
static blk_status_t submit_data_read_repair(struct inode *inode, static void submit_data_read_repair(struct inode *inode, struct bio *failed_bio,
struct bio *failed_bio, u32 bio_offset, const struct bio_vec *bvec,
u32 bio_offset, struct page *page, int failed_mirror, unsigned int error_bitmap)
unsigned int pgoff,
u64 start, u64 end,
int failed_mirror,
unsigned int error_bitmap)
{ {
const unsigned int pgoff = bvec->bv_offset;
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct page *page = bvec->bv_page;
const u64 start = page_offset(bvec->bv_page) + bvec->bv_offset;
const u64 end = start + bvec->bv_len - 1;
const u32 sectorsize = fs_info->sectorsize; const u32 sectorsize = fs_info->sectorsize;
const int nr_bits = (end + 1 - start) >> fs_info->sectorsize_bits; const int nr_bits = (end + 1 - start) >> fs_info->sectorsize_bits;
int error = 0;
int i; int i;
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE); BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
...@@ -2785,11 +2784,9 @@ static blk_status_t submit_data_read_repair(struct inode *inode, ...@@ -2785,11 +2784,9 @@ static blk_status_t submit_data_read_repair(struct inode *inode,
continue; continue;
} }
/* /*
* Repair failed, just record the error but still continue. * Continue on failed repair, otherwise the remaining sectors
* Or the remaining sectors will not be properly unlocked. * will not be properly unlocked.
*/ */
if (!error)
error = ret;
next: next:
end_page_read(page, uptodate, start + offset, sectorsize); end_page_read(page, uptodate, start + offset, sectorsize);
if (uptodate) if (uptodate)
...@@ -2802,7 +2799,6 @@ static blk_status_t submit_data_read_repair(struct inode *inode, ...@@ -2802,7 +2799,6 @@ static blk_status_t submit_data_read_repair(struct inode *inode,
start + offset + sectorsize - 1, start + offset + sectorsize - 1,
&cached); &cached);
} }
return errno_to_blk_status(error);
} }
/* lots and lots of room for performance fixes in the end_bio funcs */ /* lots and lots of room for performance fixes in the end_bio funcs */
...@@ -3095,10 +3091,8 @@ static void end_bio_extent_readpage(struct bio *bio) ...@@ -3095,10 +3091,8 @@ static void end_bio_extent_readpage(struct bio *bio)
* submit_data_read_repair() will handle all the good * submit_data_read_repair() will handle all the good
* and bad sectors, we just continue to the next bvec. * and bad sectors, we just continue to the next bvec.
*/ */
submit_data_read_repair(inode, bio, bio_offset, page, submit_data_read_repair(inode, bio, bio_offset, bvec,
start - page_offset(page), mirror, error_bitmap);
start, end, mirror,
error_bitmap);
ASSERT(bio_offset + len > bio_offset); ASSERT(bio_offset + len > bio_offset);
bio_offset += len; bio_offset += len;
......
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