Skip to content

Commit 921603c

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: pass a btrfs_bio to btrfs_use_append
struct btrfs_bio has all the information needed for btrfs_use_append, so pass that instead of a btrfs_inode and file_offset. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0d49543 commit 921603c

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

fs/btrfs/bio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ static bool btrfs_submit_chunk(struct bio *bio, int mirror_num)
612612
u64 logical = bio->bi_iter.bi_sector << 9;
613613
u64 length = bio->bi_iter.bi_size;
614614
u64 map_length = length;
615-
bool use_append = btrfs_use_zone_append(inode, logical);
615+
bool use_append = btrfs_use_zone_append(bbio);
616616
struct btrfs_io_context *bioc = NULL;
617617
struct btrfs_io_stripe smap;
618618
blk_status_t ret;

fs/btrfs/extent_io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,14 @@ static void calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
950950
struct btrfs_inode *inode, u64 file_offset)
951951
{
952952
struct btrfs_ordered_extent *ordered;
953-
u64 logical = (bio_ctrl->bio->bi_iter.bi_sector << SECTOR_SHIFT);
954953

955954
/*
956955
* Limit the extent to the ordered boundary for Zone Append.
957956
* Compressed bios aren't submitted directly, so it doesn't apply to
958957
* them.
959958
*/
960959
if (bio_ctrl->compress_type == BTRFS_COMPRESS_NONE &&
961-
btrfs_use_zone_append(inode, logical)) {
960+
btrfs_use_zone_append(btrfs_bio(bio_ctrl->bio))) {
962961
ordered = btrfs_lookup_ordered_extent(inode, file_offset);
963962
if (ordered) {
964963
bio_ctrl->len_to_oe_boundary = min_t(u32, U32_MAX,

fs/btrfs/zoned.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,8 +1627,10 @@ void btrfs_free_redirty_list(struct btrfs_transaction *trans)
16271627
spin_unlock(&trans->releasing_ebs_lock);
16281628
}
16291629

1630-
bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
1630+
bool btrfs_use_zone_append(struct btrfs_bio *bbio)
16311631
{
1632+
u64 start = (bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT);
1633+
struct btrfs_inode *inode = bbio->inode;
16321634
struct btrfs_fs_info *fs_info = inode->root->fs_info;
16331635
struct btrfs_block_group *cache;
16341636
bool ret = false;

fs/btrfs/zoned.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void btrfs_calc_zone_unusable(struct btrfs_block_group *cache);
5555
void btrfs_redirty_list_add(struct btrfs_transaction *trans,
5656
struct extent_buffer *eb);
5757
void btrfs_free_redirty_list(struct btrfs_transaction *trans);
58-
bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start);
58+
bool btrfs_use_zone_append(struct btrfs_bio *bbio);
5959
void btrfs_record_physical_zoned(struct btrfs_bio *bbio);
6060
void btrfs_rewrite_logical_zoned(struct btrfs_ordered_extent *ordered);
6161
bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
@@ -181,7 +181,7 @@ static inline void btrfs_redirty_list_add(struct btrfs_transaction *trans,
181181
struct extent_buffer *eb) { }
182182
static inline void btrfs_free_redirty_list(struct btrfs_transaction *trans) { }
183183

184-
static inline bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
184+
static inline bool btrfs_use_zone_append(struct btrfs_bio *bbio)
185185
{
186186
return false;
187187
}

0 commit comments

Comments
 (0)