Commit 5a80d1c6 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by David Sterba

btrfs: zoned: remove max_zone_append_size logic

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
1d68128c ("btrfs: zoned: fail mount if the device does not support
zone append") because the fix has been merged as f34ee1dc ("dm
crypt: Fix zoned block device support").
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e22ce8eb
...@@ -1012,8 +1012,6 @@ struct btrfs_fs_info { ...@@ -1012,8 +1012,6 @@ struct btrfs_fs_info {
u64 zoned; u64 zoned;
}; };
/* Max size to emit ZONE_APPEND write command */
u64 max_zone_append_size;
struct mutex zoned_meta_io_lock; struct mutex zoned_meta_io_lock;
spinlock_t treelog_bg_lock; spinlock_t treelog_bg_lock;
u64 treelog_bg; u64 treelog_bg;
......
...@@ -3266,7 +3266,6 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl, ...@@ -3266,7 +3266,6 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
return 0; return 0;
} }
ASSERT(fs_info->max_zone_append_size > 0);
/* Ordered extent not yet created, so we're good */ /* Ordered extent not yet created, so we're good */
ordered = btrfs_lookup_ordered_extent(inode, logical); ordered = btrfs_lookup_ordered_extent(inode, logical);
if (!ordered) { if (!ordered) {
......
...@@ -296,7 +296,6 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device) ...@@ -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_fs_info *fs_info = device->fs_info;
struct btrfs_zoned_device_info *zone_info = NULL; struct btrfs_zoned_device_info *zone_info = NULL;
struct block_device *bdev = device->bdev; struct block_device *bdev = device->bdev;
struct request_queue *queue = bdev_get_queue(bdev);
sector_t nr_sectors; sector_t nr_sectors;
sector_t sector = 0; sector_t sector = 0;
struct blk_zone *zones = NULL; struct blk_zone *zones = NULL;
...@@ -348,19 +347,10 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device) ...@@ -348,19 +347,10 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
nr_sectors = bdev_nr_sectors(bdev); nr_sectors = bdev_nr_sectors(bdev);
zone_info->zone_size_shift = ilog2(zone_info->zone_size); 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); zone_info->nr_zones = nr_sectors >> ilog2(zone_sectors);
if (!IS_ALIGNED(nr_sectors, zone_sectors)) if (!IS_ALIGNED(nr_sectors, zone_sectors))
zone_info->nr_zones++; 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); zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
if (!zone_info->seq_zones) { if (!zone_info->seq_zones) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -529,7 +519,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) ...@@ -529,7 +519,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
u64 zoned_devices = 0; u64 zoned_devices = 0;
u64 nr_devices = 0; u64 nr_devices = 0;
u64 zone_size = 0; u64 zone_size = 0;
u64 max_zone_append_size = 0;
const bool incompat_zoned = btrfs_fs_incompat(fs_info, ZONED); const bool incompat_zoned = btrfs_fs_incompat(fs_info, ZONED);
int ret = 0; int ret = 0;
...@@ -565,11 +554,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) ...@@ -565,11 +554,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
ret = -EINVAL; ret = -EINVAL;
goto out; 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++; nr_devices++;
} }
...@@ -619,7 +603,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) ...@@ -619,7 +603,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
} }
fs_info->zone_size = zone_size; 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; fs_info->fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_ZONED;
/* /*
...@@ -1318,9 +1301,6 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start) ...@@ -1318,9 +1301,6 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
if (!btrfs_is_zoned(fs_info)) if (!btrfs_is_zoned(fs_info))
return false; return false;
if (!fs_info->max_zone_append_size)
return false;
if (!is_data_inode(&inode->vfs_inode)) if (!is_data_inode(&inode->vfs_inode))
return false; return false;
......
...@@ -22,7 +22,6 @@ struct btrfs_zoned_device_info { ...@@ -22,7 +22,6 @@ struct btrfs_zoned_device_info {
*/ */
u64 zone_size; u64 zone_size;
u8 zone_size_shift; u8 zone_size_shift;
u64 max_zone_append_size;
u32 nr_zones; u32 nr_zones;
unsigned long *seq_zones; unsigned long *seq_zones;
unsigned long *empty_zones; unsigned long *empty_zones;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment