Skip to content

Commit cb3a12d

Browse files
committed
btrfs: rename bio_flags in parameters and switch type
Several functions take parameter bio_flags that was simplified to just compress type, unify it and change the type accordingly. Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0ff4001 commit cb3a12d

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

fs/btrfs/ctree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ u64 btrfs_file_extent_end(const struct btrfs_path *path);
32533253

32543254
/* inode.c */
32553255
void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
3256-
int mirror_num, unsigned long bio_flags);
3256+
int mirror_num, enum btrfs_compression_type compress_type);
32573257
unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
32583258
u32 bio_offset, struct page *page,
32593259
u64 start, u64 end);

fs/btrfs/extent_io.c

+15-14
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
178178
return ret;
179179
}
180180

181-
static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_flags)
181+
static void submit_one_bio(struct bio *bio, int mirror_num,
182+
enum btrfs_compression_type compress_type)
182183
{
183184
struct extent_io_tree *tree = bio->bi_private;
184185

@@ -189,7 +190,7 @@ static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_fl
189190

190191
if (is_data_inode(tree->private_data))
191192
btrfs_submit_data_bio(tree->private_data, bio, mirror_num,
192-
bio_flags);
193+
compress_type);
193194
else
194195
btrfs_submit_metadata_bio(tree->private_data, bio, mirror_num);
195196
/*
@@ -3246,7 +3247,7 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size)
32463247
* a contiguous page to the previous one
32473248
* @size: portion of page that we want to write
32483249
* @pg_offset: starting offset in the page
3249-
* @bio_flags: flags of the current bio to see if we can merge them
3250+
* @compress_type: compression type of the current bio to see if we can merge them
32503251
*
32513252
* Attempt to add a page to bio considering stripe alignment etc.
32523253
*
@@ -3258,7 +3259,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
32583259
struct page *page,
32593260
u64 disk_bytenr, unsigned int size,
32603261
unsigned int pg_offset,
3261-
unsigned long bio_flags)
3262+
enum btrfs_compression_type compress_type)
32623263
{
32633264
struct bio *bio = bio_ctrl->bio;
32643265
u32 bio_size = bio->bi_iter.bi_size;
@@ -3270,7 +3271,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
32703271
ASSERT(bio);
32713272
/* The limit should be calculated when bio_ctrl->bio is allocated */
32723273
ASSERT(bio_ctrl->len_to_oe_boundary && bio_ctrl->len_to_stripe_boundary);
3273-
if (bio_ctrl->bio_flags != bio_flags)
3274+
if (bio_ctrl->bio_flags != compress_type)
32743275
return 0;
32753276

32763277
if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE)
@@ -3359,7 +3360,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
33593360
unsigned int opf,
33603361
bio_end_io_t end_io_func,
33613362
u64 disk_bytenr, u32 offset, u64 file_offset,
3362-
unsigned long bio_flags)
3363+
enum btrfs_compression_type compress_type)
33633364
{
33643365
struct btrfs_fs_info *fs_info = inode->root->fs_info;
33653366
struct bio *bio;
@@ -3370,12 +3371,12 @@ static int alloc_new_bio(struct btrfs_inode *inode,
33703371
* For compressed page range, its disk_bytenr is always @disk_bytenr
33713372
* passed in, no matter if we have added any range into previous bio.
33723373
*/
3373-
if (bio_flags != BTRFS_COMPRESS_NONE)
3374+
if (compress_type != BTRFS_COMPRESS_NONE)
33743375
bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
33753376
else
33763377
bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
33773378
bio_ctrl->bio = bio;
3378-
bio_ctrl->bio_flags = bio_flags;
3379+
bio_ctrl->bio_flags = compress_type;
33793380
bio->bi_end_io = end_io_func;
33803381
bio->bi_private = &inode->io_tree;
33813382
bio->bi_opf = opf;
@@ -3434,7 +3435,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
34343435
* @end_io_func: end_io callback for new bio
34353436
* @mirror_num: desired mirror to read/write
34363437
* @prev_bio_flags: flags of previous bio to see if we can merge the current one
3437-
* @bio_flags: flags of the current bio to see if we can merge them
3438+
* @compress_type: compress type for current bio
34383439
*/
34393440
static int submit_extent_page(unsigned int opf,
34403441
struct writeback_control *wbc,
@@ -3443,7 +3444,7 @@ static int submit_extent_page(unsigned int opf,
34433444
size_t size, unsigned long pg_offset,
34443445
bio_end_io_t end_io_func,
34453446
int mirror_num,
3446-
unsigned long bio_flags,
3447+
enum btrfs_compression_type compress_type,
34473448
bool force_bio_submit)
34483449
{
34493450
int ret = 0;
@@ -3468,22 +3469,22 @@ static int submit_extent_page(unsigned int opf,
34683469
ret = alloc_new_bio(inode, bio_ctrl, wbc, opf,
34693470
end_io_func, disk_bytenr, offset,
34703471
page_offset(page) + cur,
3471-
bio_flags);
3472+
compress_type);
34723473
if (ret < 0)
34733474
return ret;
34743475
}
34753476
/*
34763477
* We must go through btrfs_bio_add_page() to ensure each
34773478
* page range won't cross various boundaries.
34783479
*/
3479-
if (bio_flags != BTRFS_COMPRESS_NONE)
3480+
if (compress_type != BTRFS_COMPRESS_NONE)
34803481
added = btrfs_bio_add_page(bio_ctrl, page, disk_bytenr,
34813482
size - offset, pg_offset + offset,
3482-
bio_flags);
3483+
compress_type);
34833484
else
34843485
added = btrfs_bio_add_page(bio_ctrl, page,
34853486
disk_bytenr + offset, size - offset,
3486-
pg_offset + offset, bio_flags);
3487+
pg_offset + offset, compress_type);
34873488

34883489
/* Metadata page range should never be split */
34893490
if (!is_data_inode(&inode->vfs_inode))

fs/btrfs/extent_io.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct extent_io_tree;
6767

6868
typedef void (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
6969
int mirror_num,
70-
unsigned long bio_flags);
70+
enum btrfs_compression_type compress_type);
7171

7272
typedef blk_status_t (extent_submit_bio_start_t)(struct inode *inode,
7373
struct bio *bio, u64 dio_file_offset);

fs/btrfs/inode.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,7 @@ static blk_status_t extract_ordered_extent(struct btrfs_inode *inode,
25732573
* c-3) otherwise: async submit
25742574
*/
25752575
void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
2576-
int mirror_num, unsigned long bio_flags)
2576+
int mirror_num, enum btrfs_compression_type compress_type)
25772577
{
25782578
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
25792579
struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -2602,7 +2602,7 @@ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
26022602
if (ret)
26032603
goto out;
26042604

2605-
if (bio_flags != BTRFS_COMPRESS_NONE) {
2605+
if (compress_type != BTRFS_COMPRESS_NONE) {
26062606
/*
26072607
* btrfs_submit_compressed_read will handle completing
26082608
* the bio if there were any errors, so just return
@@ -7834,7 +7834,8 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)
78347834
}
78357835

78367836
static void submit_dio_repair_bio(struct inode *inode, struct bio *bio,
7837-
int mirror_num, unsigned long bio_flags)
7837+
int mirror_num,
7838+
enum btrfs_compression_type compress_type)
78387839
{
78397840
struct btrfs_dio_private *dip = bio->bi_private;
78407841
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);

0 commit comments

Comments
 (0)