Skip to content

Commit e380adf

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: pass start block to btrfs_use_zone_append
btrfs_use_zone_append only needs the passed in extent_map's block_start member, so there's no need to pass in the full extent map. This also enables the use of btrfs_use_zone_append in places where we only have a start byte but no extent_map. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 91df99a commit e380adf

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

fs/btrfs/extent_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3762,7 +3762,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
37623762
/* Note that em_end from extent_map_end() is exclusive */
37633763
iosize = min(em_end, end + 1) - cur;
37643764

3765-
if (btrfs_use_zone_append(inode, em))
3765+
if (btrfs_use_zone_append(inode, em->block_start))
37663766
opf = REQ_OP_ZONE_APPEND;
37673767

37683768
free_extent_map(em);

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7796,7 +7796,7 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
77967796
iomap->bdev = fs_info->fs_devices->latest_bdev;
77977797
iomap->length = len;
77987798

7799-
if (write && btrfs_use_zone_append(BTRFS_I(inode), em))
7799+
if (write && btrfs_use_zone_append(BTRFS_I(inode), em->block_start))
78007800
iomap->flags |= IOMAP_F_ZONE_APPEND;
78017801

78027802
free_extent_map(em);

fs/btrfs/zoned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ void btrfs_free_redirty_list(struct btrfs_transaction *trans)
12781278
spin_unlock(&trans->releasing_ebs_lock);
12791279
}
12801280

1281-
bool btrfs_use_zone_append(struct btrfs_inode *inode, struct extent_map *em)
1281+
bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
12821282
{
12831283
struct btrfs_fs_info *fs_info = inode->root->fs_info;
12841284
struct btrfs_block_group *cache;
@@ -1293,7 +1293,7 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, struct extent_map *em)
12931293
if (!is_data_inode(&inode->vfs_inode))
12941294
return false;
12951295

1296-
cache = btrfs_lookup_block_group(fs_info, em->block_start);
1296+
cache = btrfs_lookup_block_group(fs_info, start);
12971297
ASSERT(cache);
12981298
if (!cache)
12991299
return false;

fs/btrfs/zoned.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void btrfs_calc_zone_unusable(struct btrfs_block_group *cache);
5353
void btrfs_redirty_list_add(struct btrfs_transaction *trans,
5454
struct extent_buffer *eb);
5555
void btrfs_free_redirty_list(struct btrfs_transaction *trans);
56-
bool btrfs_use_zone_append(struct btrfs_inode *inode, struct extent_map *em);
56+
bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start);
5757
void btrfs_record_physical_zoned(struct inode *inode, u64 file_offset,
5858
struct bio *bio);
5959
void btrfs_rewrite_logical_zoned(struct btrfs_ordered_extent *ordered);
@@ -152,8 +152,7 @@ static inline void btrfs_redirty_list_add(struct btrfs_transaction *trans,
152152
struct extent_buffer *eb) { }
153153
static inline void btrfs_free_redirty_list(struct btrfs_transaction *trans) { }
154154

155-
static inline bool btrfs_use_zone_append(struct btrfs_inode *inode,
156-
struct extent_map *em)
155+
static inline bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
157156
{
158157
return false;
159158
}

0 commit comments

Comments
 (0)