Skip to content

Commit

Permalink
btrfs: zoned: remove max_zone_append_size logic
Browse files Browse the repository at this point in the history
There used to be a patch in the original series for zoned support which
limited the extent size to max_zone_append_size, but this patch has been
dropped somewhere around v9.

We've decided to go the opposite direction, instead of limiting extents
in the first place we split them before submission to comply with the
device's limits.

Remove the related code, btrfs_fs_info::max_zone_append_size and
btrfs_zoned_device_info::max_zone_append_size.

This also removes the workaround for dm-crypt introduced in
1d68128 ("btrfs: zoned: fail mount if the device does not support
zone append") because the fix has been merged as f34ee1d ("dm
crypt: Fix zoned block device support").

Reviewed-by: Anand Jain <[email protected]>
Signed-off-by: Johannes Thumshirn <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
morbidrsa authored and kdave committed Aug 23, 2021
1 parent e22ce8e commit 5a80d1c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 24 deletions.
2 changes: 0 additions & 2 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,6 @@ struct btrfs_fs_info {
u64 zoned;
};

/* Max size to emit ZONE_APPEND write command */
u64 max_zone_append_size;
struct mutex zoned_meta_io_lock;
spinlock_t treelog_bg_lock;
u64 treelog_bg;
Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3266,7 +3266,6 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
return 0;
}

ASSERT(fs_info->max_zone_append_size > 0);
/* Ordered extent not yet created, so we're good */
ordered = btrfs_lookup_ordered_extent(inode, logical);
if (!ordered) {
Expand Down
20 changes: 0 additions & 20 deletions fs/btrfs/zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
struct btrfs_fs_info *fs_info = device->fs_info;
struct btrfs_zoned_device_info *zone_info = NULL;
struct block_device *bdev = device->bdev;
struct request_queue *queue = bdev_get_queue(bdev);
sector_t nr_sectors;
sector_t sector = 0;
struct blk_zone *zones = NULL;
Expand Down Expand Up @@ -348,19 +347,10 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)

nr_sectors = bdev_nr_sectors(bdev);
zone_info->zone_size_shift = ilog2(zone_info->zone_size);
zone_info->max_zone_append_size =
(u64)queue_max_zone_append_sectors(queue) << SECTOR_SHIFT;
zone_info->nr_zones = nr_sectors >> ilog2(zone_sectors);
if (!IS_ALIGNED(nr_sectors, zone_sectors))
zone_info->nr_zones++;

if (bdev_is_zoned(bdev) && zone_info->max_zone_append_size == 0) {
btrfs_err(fs_info, "zoned: device %pg does not support zone append",
bdev);
ret = -EINVAL;
goto out;
}

zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
if (!zone_info->seq_zones) {
ret = -ENOMEM;
Expand Down Expand Up @@ -529,7 +519,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
u64 zoned_devices = 0;
u64 nr_devices = 0;
u64 zone_size = 0;
u64 max_zone_append_size = 0;
const bool incompat_zoned = btrfs_fs_incompat(fs_info, ZONED);
int ret = 0;

Expand Down Expand Up @@ -565,11 +554,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
ret = -EINVAL;
goto out;
}
if (!max_zone_append_size ||
(zone_info->max_zone_append_size &&
zone_info->max_zone_append_size < max_zone_append_size))
max_zone_append_size =
zone_info->max_zone_append_size;
}
nr_devices++;
}
Expand Down Expand Up @@ -619,7 +603,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
}

fs_info->zone_size = zone_size;
fs_info->max_zone_append_size = max_zone_append_size;
fs_info->fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_ZONED;

/*
Expand Down Expand Up @@ -1318,9 +1301,6 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
if (!btrfs_is_zoned(fs_info))
return false;

if (!fs_info->max_zone_append_size)
return false;

if (!is_data_inode(&inode->vfs_inode))
return false;

Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/zoned.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct btrfs_zoned_device_info {
*/
u64 zone_size;
u8 zone_size_shift;
u64 max_zone_append_size;
u32 nr_zones;
unsigned long *seq_zones;
unsigned long *empty_zones;
Expand Down

0 comments on commit 5a80d1c

Please sign in to comment.