Commit d733ea01 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: simplify finding the inode in submit_one_bio

struct btrfs_bio now has an always valid inode pointer that can be used
to find the inode in submit_one_bio, so use that and initialize all
variables for which it is possible at declaration time.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b7d463a1
......@@ -123,23 +123,16 @@ struct btrfs_bio_ctrl {
static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
{
struct bio *bio;
struct bio_vec *bv;
struct inode *inode;
int mirror_num;
struct bio *bio = bio_ctrl->bio;
int mirror_num = bio_ctrl->mirror_num;
if (!bio_ctrl->bio)
if (!bio)
return;
bio = bio_ctrl->bio;
bv = bio_first_bvec_all(bio);
inode = bv->bv_page->mapping->host;
mirror_num = bio_ctrl->mirror_num;
/* Caller should ensure the bio has at least some range added */
ASSERT(bio->bi_iter.bi_size);
if (!is_data_inode(inode)) {
if (!is_data_inode(&btrfs_bio(bio)->inode->vfs_inode)) {
if (btrfs_op(bio) != BTRFS_MAP_WRITE) {
/*
* For metadata read, we should have the parent_check,
......
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