Skip to content

Commit 8896a08

Browse files
adam900710kdave
authored andcommitted
btrfs: replace fs_info and private_data with inode in btrfs_wq_submit_bio
All callers of btrfs_wq_submit_bio() pass struct inode as @private_data, so there is no need for it to be (void *), replace it with "struct inode *inode". While we can extract fs_info from struct inode, also remove the @fs_info parameter. Since we're here, also replace all the (void *private_data) into (struct inode *inode). Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 3f6bb4a commit 8896a08

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

fs/btrfs/disk-io.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void btrfs_free_csum_hash(struct btrfs_fs_info *fs_info)
109109
* just before they are sent down the IO stack.
110110
*/
111111
struct async_submit_bio {
112-
void *private_data;
112+
struct inode *inode;
113113
struct bio *bio;
114114
extent_submit_bio_start_t *submit_bio_start;
115115
int mirror_num;
@@ -696,8 +696,7 @@ static void run_one_async_start(struct btrfs_work *work)
696696
blk_status_t ret;
697697

698698
async = container_of(work, struct async_submit_bio, work);
699-
ret = async->submit_bio_start(async->private_data, async->bio,
700-
async->bio_offset);
699+
ret = async->submit_bio_start(async->inode, async->bio, async->bio_offset);
701700
if (ret)
702701
async->status = ret;
703702
}
@@ -717,7 +716,7 @@ static void run_one_async_done(struct btrfs_work *work)
717716
blk_status_t ret;
718717

719718
async = container_of(work, struct async_submit_bio, work);
720-
inode = async->private_data;
719+
inode = async->inode;
721720

722721
/* If an error occurred we just want to clean up the bio and move on */
723722
if (async->status) {
@@ -747,18 +746,19 @@ static void run_one_async_free(struct btrfs_work *work)
747746
kfree(async);
748747
}
749748

750-
blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
749+
blk_status_t btrfs_wq_submit_bio(struct inode *inode, struct bio *bio,
751750
int mirror_num, unsigned long bio_flags,
752-
u64 bio_offset, void *private_data,
751+
u64 bio_offset,
753752
extent_submit_bio_start_t *submit_bio_start)
754753
{
754+
struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
755755
struct async_submit_bio *async;
756756

757757
async = kmalloc(sizeof(*async), GFP_NOFS);
758758
if (!async)
759759
return BLK_STS_RESOURCE;
760760

761-
async->private_data = private_data;
761+
async->inode = inode;
762762
async->bio = bio;
763763
async->mirror_num = mirror_num;
764764
async->submit_bio_start = submit_bio_start;
@@ -795,8 +795,8 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
795795
return errno_to_blk_status(ret);
796796
}
797797

798-
static blk_status_t btree_submit_bio_start(void *private_data, struct bio *bio,
799-
u64 bio_offset)
798+
static blk_status_t btree_submit_bio_start(struct inode *inode, struct bio *bio,
799+
u64 bio_offset)
800800
{
801801
/*
802802
* when we're called for a write, we're already in the async
@@ -842,8 +842,8 @@ blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
842842
* kthread helpers are used to submit writes so that
843843
* checksumming can happen in parallel across all CPUs
844844
*/
845-
ret = btrfs_wq_submit_bio(fs_info, bio, mirror_num, 0,
846-
0, inode, btree_submit_bio_start);
845+
ret = btrfs_wq_submit_bio(inode, bio, mirror_num, 0,
846+
0, btree_submit_bio_start);
847847
}
848848

849849
if (ret)

fs/btrfs/disk-io.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid, int level,
112112
struct btrfs_key *first_key);
113113
blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
114114
enum btrfs_wq_endio_type metadata);
115-
blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
116-
int mirror_num, unsigned long bio_flags,
117-
u64 bio_offset, void *private_data,
118-
extent_submit_bio_start_t *submit_bio_start);
115+
blk_status_t btrfs_wq_submit_bio(struct inode *inode, struct bio *bio,
116+
int mirror_num, unsigned long bio_flags,
117+
u64 bio_offset,
118+
extent_submit_bio_start_t *submit_bio_start);
119119
blk_status_t btrfs_submit_bio_done(void *private_data, struct bio *bio,
120120
int mirror_num);
121121
int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ typedef blk_status_t (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
7171
int mirror_num,
7272
unsigned long bio_flags);
7373

74-
typedef blk_status_t (extent_submit_bio_start_t)(void *private_data,
74+
typedef blk_status_t (extent_submit_bio_start_t)(struct inode *inode,
7575
struct bio *bio, u64 bio_offset);
7676

7777
#define INLINE_EXTENT_BUFFER_PAGES 16

fs/btrfs/inode.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,11 +2194,9 @@ int btrfs_bio_fits_in_stripe(struct page *page, size_t size, struct bio *bio,
21942194
* At IO completion time the cums attached on the ordered extent record
21952195
* are inserted into the btree
21962196
*/
2197-
static blk_status_t btrfs_submit_bio_start(void *private_data, struct bio *bio,
2198-
u64 bio_offset)
2197+
static blk_status_t btrfs_submit_bio_start(struct inode *inode, struct bio *bio,
2198+
u64 bio_offset)
21992199
{
2200-
struct inode *inode = private_data;
2201-
22022200
return btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
22032201
}
22042202

@@ -2263,8 +2261,8 @@ blk_status_t btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
22632261
if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID)
22642262
goto mapit;
22652263
/* we're doing a write, do the async checksumming */
2266-
ret = btrfs_wq_submit_bio(fs_info, bio, mirror_num, bio_flags,
2267-
0, inode, btrfs_submit_bio_start);
2264+
ret = btrfs_wq_submit_bio(inode, bio, mirror_num, bio_flags,
2265+
0, btrfs_submit_bio_start);
22682266
goto out;
22692267
} else if (!skip_sum) {
22702268
ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
@@ -7747,11 +7745,9 @@ static void __endio_write_update_ordered(struct btrfs_inode *inode,
77477745
}
77487746
}
77497747

7750-
static blk_status_t btrfs_submit_bio_start_direct_io(void *private_data,
7751-
struct bio *bio, u64 offset)
7748+
static blk_status_t btrfs_submit_bio_start_direct_io(struct inode *inode,
7749+
struct bio *bio, u64 offset)
77527750
{
7753-
struct inode *inode = private_data;
7754-
77557751
return btrfs_csum_one_bio(BTRFS_I(inode), bio, offset, 1);
77567752
}
77577753

@@ -7802,8 +7798,8 @@ static inline blk_status_t btrfs_submit_dio_bio(struct bio *bio,
78027798
goto map;
78037799

78047800
if (write && async_submit) {
7805-
ret = btrfs_wq_submit_bio(fs_info, bio, 0, 0,
7806-
file_offset, inode,
7801+
ret = btrfs_wq_submit_bio(inode, bio, 0, 0,
7802+
file_offset,
78077803
btrfs_submit_bio_start_direct_io);
78087804
goto err;
78097805
} else if (write) {

0 commit comments

Comments
 (0)