btrfs: use bio fields for op and flags
The bio REQ_OP and bi_rw rq_flag_bits are now always setup, so there is no need to pass around the rq_flag_bits bits too. btrfs users should should access the bio insead. Signed-off-by: Mike Christie <mchristi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:

committed by
Jens Axboe

parent
b3d3fa5199
commit
81a75f6781
@@ -124,7 +124,6 @@ struct async_submit_bio {
|
||||
struct list_head list;
|
||||
extent_submit_bio_hook_t *submit_bio_start;
|
||||
extent_submit_bio_hook_t *submit_bio_done;
|
||||
int rw;
|
||||
int mirror_num;
|
||||
unsigned long bio_flags;
|
||||
/*
|
||||
@@ -797,7 +796,7 @@ static void run_one_async_start(struct btrfs_work *work)
|
||||
int ret;
|
||||
|
||||
async = container_of(work, struct async_submit_bio, work);
|
||||
ret = async->submit_bio_start(async->inode, async->rw, async->bio,
|
||||
ret = async->submit_bio_start(async->inode, async->bio,
|
||||
async->mirror_num, async->bio_flags,
|
||||
async->bio_offset);
|
||||
if (ret)
|
||||
@@ -830,9 +829,8 @@ static void run_one_async_done(struct btrfs_work *work)
|
||||
return;
|
||||
}
|
||||
|
||||
async->submit_bio_done(async->inode, async->rw, async->bio,
|
||||
async->mirror_num, async->bio_flags,
|
||||
async->bio_offset);
|
||||
async->submit_bio_done(async->inode, async->bio, async->mirror_num,
|
||||
async->bio_flags, async->bio_offset);
|
||||
}
|
||||
|
||||
static void run_one_async_free(struct btrfs_work *work)
|
||||
@@ -844,7 +842,7 @@ static void run_one_async_free(struct btrfs_work *work)
|
||||
}
|
||||
|
||||
int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
int rw, struct bio *bio, int mirror_num,
|
||||
struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags,
|
||||
u64 bio_offset,
|
||||
extent_submit_bio_hook_t *submit_bio_start,
|
||||
@@ -857,7 +855,6 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
return -ENOMEM;
|
||||
|
||||
async->inode = inode;
|
||||
async->rw = rw;
|
||||
async->bio = bio;
|
||||
async->mirror_num = mirror_num;
|
||||
async->submit_bio_start = submit_bio_start;
|
||||
@@ -903,9 +900,8 @@ static int btree_csum_one_bio(struct bio *bio)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __btree_submit_bio_start(struct inode *inode, int rw,
|
||||
struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags,
|
||||
static int __btree_submit_bio_start(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
/*
|
||||
@@ -915,7 +911,7 @@ static int __btree_submit_bio_start(struct inode *inode, int rw,
|
||||
return btree_csum_one_bio(bio);
|
||||
}
|
||||
|
||||
static int __btree_submit_bio_done(struct inode *inode, int rw, struct bio *bio,
|
||||
static int __btree_submit_bio_done(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
@@ -925,7 +921,7 @@ static int __btree_submit_bio_done(struct inode *inode, int rw, struct bio *bio,
|
||||
* when we're called for a write, we're already in the async
|
||||
* submission context. Just jump into btrfs_map_bio
|
||||
*/
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, mirror_num, 1);
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, bio, mirror_num, 1);
|
||||
if (ret) {
|
||||
bio->bi_error = ret;
|
||||
bio_endio(bio);
|
||||
@@ -944,7 +940,7 @@ static int check_async_write(struct inode *inode, unsigned long bio_flags)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
|
||||
static int btree_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
@@ -960,21 +956,19 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
|
||||
bio, BTRFS_WQ_ENDIO_METADATA);
|
||||
if (ret)
|
||||
goto out_w_error;
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, rw, bio,
|
||||
mirror_num, 0);
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, bio, mirror_num, 0);
|
||||
} else if (!async) {
|
||||
ret = btree_csum_one_bio(bio);
|
||||
if (ret)
|
||||
goto out_w_error;
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, rw, bio,
|
||||
mirror_num, 0);
|
||||
ret = btrfs_map_bio(BTRFS_I(inode)->root, bio, mirror_num, 0);
|
||||
} else {
|
||||
/*
|
||||
* kthread helpers are used to submit writes so that
|
||||
* checksumming can happen in parallel across all CPUs
|
||||
*/
|
||||
ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info,
|
||||
inode, rw, bio, mirror_num, 0,
|
||||
inode, bio, mirror_num, 0,
|
||||
bio_offset,
|
||||
__btree_submit_bio_start,
|
||||
__btree_submit_bio_done);
|
||||
|
Reference in New Issue
Block a user