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

btrfs: remove btrfs_bio::logical member

The member btrfs_bio::logical is only initialized by two call sites:

- btrfs_repair_one_sector()
  No corresponding site to utilize it.

- btrfs_submit_direct()
  The corresponding site to utilize it is btrfs_check_read_dio_bio().

However for btrfs_check_read_dio_bio(), we can grab the file_offset from
btrfs_dio_private::file_offset directly.

Thus it turns out we don't really need that btrfs_bio::logical member at
all.

For btrfs_bio, the logical bytenr can be fetched from its
bio->bi_iter.bi_sector directly.

So let's just remove the member to save 8 bytes for structure btrfs_bio.
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 47926ab5
...@@ -2673,7 +2673,6 @@ int btrfs_repair_one_sector(struct inode *inode, ...@@ -2673,7 +2673,6 @@ int btrfs_repair_one_sector(struct inode *inode,
} }
bio_add_page(repair_bio, page, failrec->len, pgoff); bio_add_page(repair_bio, page, failrec->len, pgoff);
repair_bbio->logical = failrec->start;
repair_bbio->iter = repair_bio->bi_iter; repair_bbio->iter = repair_bio->bi_iter;
btrfs_debug(btrfs_sb(inode->i_sb), btrfs_debug(btrfs_sb(inode->i_sb),
......
...@@ -8089,10 +8089,11 @@ static blk_status_t submit_dio_repair_bio(struct inode *inode, struct bio *bio, ...@@ -8089,10 +8089,11 @@ static blk_status_t submit_dio_repair_bio(struct inode *inode, struct bio *bio,
return ret; return ret;
} }
static blk_status_t btrfs_check_read_dio_bio(struct inode *inode, static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
struct btrfs_bio *bbio, struct btrfs_bio *bbio,
const bool uptodate) const bool uptodate)
{ {
struct inode *inode = dip->inode;
struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
const u32 sectorsize = fs_info->sectorsize; const u32 sectorsize = fs_info->sectorsize;
struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree;
...@@ -8100,7 +8101,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode, ...@@ -8100,7 +8101,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode,
const bool csum = !(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM); const bool csum = !(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM);
struct bio_vec bvec; struct bio_vec bvec;
struct bvec_iter iter; struct bvec_iter iter;
u64 start = bbio->logical; const u64 orig_file_offset = dip->file_offset;
u64 start = orig_file_offset;
u32 bio_offset = 0; u32 bio_offset = 0;
blk_status_t err = BLK_STS_OK; blk_status_t err = BLK_STS_OK;
...@@ -8122,10 +8124,10 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode, ...@@ -8122,10 +8124,10 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode,
} else { } else {
int ret; int ret;
ASSERT((start - bbio->logical) < UINT_MAX); ASSERT((start - orig_file_offset) < UINT_MAX);
ret = btrfs_repair_one_sector(inode, ret = btrfs_repair_one_sector(inode,
&bbio->bio, &bbio->bio,
start - bbio->logical, start - orig_file_offset,
bvec.bv_page, pgoff, bvec.bv_page, pgoff,
start, bbio->mirror_num, start, bbio->mirror_num,
submit_dio_repair_bio); submit_dio_repair_bio);
...@@ -8168,10 +8170,8 @@ static void btrfs_end_dio_bio(struct bio *bio) ...@@ -8168,10 +8170,8 @@ static void btrfs_end_dio_bio(struct bio *bio)
bio->bi_opf, bio->bi_iter.bi_sector, bio->bi_opf, bio->bi_iter.bi_sector,
bio->bi_iter.bi_size, err); bio->bi_iter.bi_size, err);
if (bio_op(bio) == REQ_OP_READ) { if (bio_op(bio) == REQ_OP_READ)
err = btrfs_check_read_dio_bio(dip->inode, err = btrfs_check_read_dio_bio(dip, btrfs_bio(bio), !err);
btrfs_bio(bio), !err);
}
if (err) if (err)
dip->dio_bio->bi_status = err; dip->dio_bio->bi_status = err;
...@@ -8337,7 +8337,6 @@ static blk_qc_t btrfs_submit_direct(const struct iomap_iter *iter, ...@@ -8337,7 +8337,6 @@ static blk_qc_t btrfs_submit_direct(const struct iomap_iter *iter,
bio = btrfs_bio_clone_partial(dio_bio, clone_offset, clone_len); bio = btrfs_bio_clone_partial(dio_bio, clone_offset, clone_len);
bio->bi_private = dip; bio->bi_private = dip;
bio->bi_end_io = btrfs_end_dio_bio; bio->bi_end_io = btrfs_end_dio_bio;
btrfs_bio(bio)->logical = file_offset;
if (bio_op(bio) == REQ_OP_ZONE_APPEND) { if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
status = extract_ordered_extent(BTRFS_I(inode), bio, status = extract_ordered_extent(BTRFS_I(inode), bio,
......
...@@ -313,7 +313,6 @@ struct btrfs_bio { ...@@ -313,7 +313,6 @@ struct btrfs_bio {
/* @device is for stripe IO submission. */ /* @device is for stripe IO submission. */
struct btrfs_device *device; struct btrfs_device *device;
u64 logical;
u8 *csum; u8 *csum;
u8 csum_inline[BTRFS_BIO_INLINE_CSUM_SIZE]; u8 csum_inline[BTRFS_BIO_INLINE_CSUM_SIZE];
struct bvec_iter iter; struct bvec_iter iter;
......
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