diff options
author | Christoph Hellwig <hch@lst.de> | 2023-12-17 17:53:57 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-12-20 04:17:43 +0100 |
commit | 7437bb73f087e5f216f9c6603f5149d354e315af (patch) | |
tree | d3fbe5cb3e4e91e1062e9c25f7fd8a39ed761309 /drivers/md | |
parent | virtio_blk: remove the broken zone revalidation support (diff) | |
download | linux-7437bb73f087e5f216f9c6603f5149d354e315af.tar.xz linux-7437bb73f087e5f216f9c6603f5149d354e315af.zip |
block: remove support for the host aware zone model
When zones were first added the SCSI and ATA specs, two different
models were supported (in addition to the drive managed one that
is invisible to the host):
- host managed where non-conventional zones there is strict requirement
to write at the write pointer, or else an error is returned
- host aware where a write point is maintained if writes always happen
at it, otherwise it is left in an under-defined state and the
sequential write preferred zones behave like conventional zones
(probably very badly performing ones, though)
Not surprisingly this lukewarm model didn't prove to be very useful and
was finally removed from the ZBC and SBC specs (NVMe never implemented
it). Due to to the easily disappearing write pointer host software
could never rely on the write pointer to actually be useful for say
recovery.
Fortunately only a few HDD prototypes shipped using this model which
never made it to mass production. Drop the support before it is too
late. Note that any such host aware prototype HDD can still be used
with Linux as we'll now treat it as a conventional HDD.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20231217165359.604246-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-kcopyd.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-table.c | 45 | ||||
-rw-r--r-- | drivers/md/dm-zoned-metadata.c | 7 | ||||
-rw-r--r-- | drivers/md/dm-zoned-target.c | 4 |
4 files changed, 26 insertions, 32 deletions
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index d01807c50f20..36bcfdccae04 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -807,7 +807,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, */ if (!(job->flags & BIT(DM_KCOPYD_WRITE_SEQ))) { for (i = 0; i < job->num_dests; i++) { - if (bdev_zoned_model(dests[i].bdev) == BLK_ZONED_HM) { + if (bdev_is_zoned(dests[i].bdev)) { job->flags |= BIT(DM_KCOPYD_WRITE_SEQ); break; } diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 198d38b53322..260b5b8f2b0d 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1579,21 +1579,18 @@ bool dm_table_has_no_data_devices(struct dm_table *t) return true; } -static int device_not_zoned_model(struct dm_target *ti, struct dm_dev *dev, - sector_t start, sector_t len, void *data) +static int device_not_zoned(struct dm_target *ti, struct dm_dev *dev, + sector_t start, sector_t len, void *data) { - struct request_queue *q = bdev_get_queue(dev->bdev); - enum blk_zoned_model *zoned_model = data; + bool *zoned = data; - return blk_queue_zoned_model(q) != *zoned_model; + return bdev_is_zoned(dev->bdev) != *zoned; } static int device_is_zoned_model(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data) { - struct request_queue *q = bdev_get_queue(dev->bdev); - - return blk_queue_zoned_model(q) != BLK_ZONED_NONE; + return bdev_is_zoned(dev->bdev); } /* @@ -1603,8 +1600,7 @@ static int device_is_zoned_model(struct dm_target *ti, struct dm_dev *dev, * has the DM_TARGET_MIXED_ZONED_MODEL feature set, the devices can have any * zoned model with all zoned devices having the same zone size. */ -static bool dm_table_supports_zoned_model(struct dm_table *t, - enum blk_zoned_model zoned_model) +static bool dm_table_supports_zoned(struct dm_table *t, bool zoned) { for (unsigned int i = 0; i < t->num_targets; i++) { struct dm_target *ti = dm_table_get_target(t, i); @@ -1623,11 +1619,11 @@ static bool dm_table_supports_zoned_model(struct dm_table *t, if (dm_target_supports_zoned_hm(ti->type)) { if (!ti->type->iterate_devices || - ti->type->iterate_devices(ti, device_not_zoned_model, - &zoned_model)) + ti->type->iterate_devices(ti, device_not_zoned, + &zoned)) return false; } else if (!dm_target_supports_mixed_zoned_model(ti->type)) { - if (zoned_model == BLK_ZONED_HM) + if (zoned) return false; } } @@ -1650,14 +1646,13 @@ static int device_not_matches_zone_sectors(struct dm_target *ti, struct dm_dev * * zone sectors, if the destination device is a zoned block device, it shall * have the specified zone_sectors. */ -static int validate_hardware_zoned_model(struct dm_table *t, - enum blk_zoned_model zoned_model, - unsigned int zone_sectors) +static int validate_hardware_zoned(struct dm_table *t, bool zoned, + unsigned int zone_sectors) { - if (zoned_model == BLK_ZONED_NONE) + if (!zoned) return 0; - if (!dm_table_supports_zoned_model(t, zoned_model)) { + if (!dm_table_supports_zoned(t, zoned)) { DMERR("%s: zoned model is not consistent across all devices", dm_device_name(t->md)); return -EINVAL; @@ -1683,8 +1678,8 @@ int dm_calculate_queue_limits(struct dm_table *t, struct queue_limits *limits) { struct queue_limits ti_limits; - enum blk_zoned_model zoned_model = BLK_ZONED_NONE; unsigned int zone_sectors = 0; + bool zoned = false; blk_set_stacking_limits(limits); @@ -1706,12 +1701,12 @@ int dm_calculate_queue_limits(struct dm_table *t, ti->type->iterate_devices(ti, dm_set_device_limits, &ti_limits); - if (zoned_model == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) { + if (!zoned && ti_limits.zoned) { /* * After stacking all limits, validate all devices * in table support this zoned model and zone sectors. */ - zoned_model = ti_limits.zoned; + zoned = ti_limits.zoned; zone_sectors = ti_limits.chunk_sectors; } @@ -1744,18 +1739,18 @@ combine_limits: * Verify that the zoned model and zone sectors, as determined before * any .io_hints override, are the same across all devices in the table. * - this is especially relevant if .io_hints is emulating a disk-managed - * zoned model (aka BLK_ZONED_NONE) on host-managed zoned block devices. + * zoned model on host-managed zoned block devices. * BUT... */ - if (limits->zoned != BLK_ZONED_NONE) { + if (limits->zoned) { /* * ...IF the above limits stacking determined a zoned model * validate that all of the table's devices conform to it. */ - zoned_model = limits->zoned; + zoned = limits->zoned; zone_sectors = limits->chunk_sectors; } - if (validate_hardware_zoned_model(t, zoned_model, zone_sectors)) + if (validate_hardware_zoned(t, zoned, zone_sectors)) return -EINVAL; return validate_hardware_logical_block_alignment(t, limits); diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index 60a4dc01ea18..fdfe30f7b697 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -2836,12 +2836,11 @@ static void dmz_print_dev(struct dmz_metadata *zmd, int num) { struct dmz_dev *dev = &zmd->dev[num]; - if (bdev_zoned_model(dev->bdev) == BLK_ZONED_NONE) + if (!bdev_is_zoned(dev->bdev)) dmz_dev_info(dev, "Regular block device"); else - dmz_dev_info(dev, "Host-%s zoned block device", - bdev_zoned_model(dev->bdev) == BLK_ZONED_HA ? - "aware" : "managed"); + dmz_dev_info(dev, "Host-managed zoned block device"); + if (zmd->sb_version > 1) { sector_t sector_offset = dev->zone_offset << zmd->zone_nr_sectors_shift; diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c index b487f7acc860..621794a9edd6 100644 --- a/drivers/md/dm-zoned-target.c +++ b/drivers/md/dm-zoned-target.c @@ -702,7 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path, } bdev = ddev->bdev; - if (bdev_zoned_model(bdev) == BLK_ZONED_NONE) { + if (!bdev_is_zoned(bdev)) { if (nr_devs == 1) { ti->error = "Invalid regular device"; goto err; @@ -1010,7 +1010,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits) limits->max_sectors = chunk_sectors; /* We are exposing a drive-managed zoned block device */ - limits->zoned = BLK_ZONED_NONE; + limits->zoned = false; } /* |