Commit b1fc937a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: move the zoned flag into the features field



Move the zoned flags into the features field to reclaim a little
bit of space.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20240617060532.127975-23-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8023e144
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ static void blk_apply_bdi_limits(struct backing_dev_info *bdi,

static int blk_validate_zoned_limits(struct queue_limits *lim)
{
	if (!lim->zoned) {
	if (!(lim->features & BLK_FEAT_ZONED)) {
		if (WARN_ON_ONCE(lim->max_open_zones) ||
		    WARN_ON_ONCE(lim->max_active_zones) ||
		    WARN_ON_ONCE(lim->zone_write_granularity) ||
@@ -602,8 +602,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
						   b->max_secure_erase_sectors);
	t->zone_write_granularity = max(t->zone_write_granularity,
					b->zone_write_granularity);
	t->zoned = max(t->zoned, b->zoned);
	if (!t->zoned) {
	if (!(t->features & BLK_FEAT_ZONED)) {
		t->zone_write_granularity = 0;
		t->max_zone_append_sectors = 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ int null_init_zoned_dev(struct nullb_device *dev,
		sector += dev->zone_size_sects;
	}

	lim->zoned = true;
	lim->features |= BLK_FEAT_ZONED;
	lim->chunk_sectors = dev->zone_size_sects;
	lim->max_zone_append_sectors = dev->zone_append_max_sectors;
	lim->max_open_zones = dev->zone_max_open;
+1 −1
Original line number Diff line number Diff line
@@ -2196,7 +2196,7 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
		if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED))
			return -EOPNOTSUPP;

		lim.zoned = true;
		lim.features |= BLK_FEAT_ZONED;
		lim.max_active_zones = p->max_active_zones;
		lim.max_open_zones =  p->max_open_zones;
		lim.max_zone_append_sectors = p->max_zone_append_sectors;
+3 −2
Original line number Diff line number Diff line
@@ -728,7 +728,7 @@ static int virtblk_read_zoned_limits(struct virtio_blk *vblk,

	dev_dbg(&vdev->dev, "probing host-managed zoned device\n");

	lim->zoned = true;
	lim->features |= BLK_FEAT_ZONED;

	virtio_cread(vdev, struct virtio_blk_config,
		     zoned.max_open_zones, &v);
@@ -1546,7 +1546,8 @@ static int virtblk_probe(struct virtio_device *vdev)
	 * All steps that follow use the VQs therefore they need to be
	 * placed after the virtio_device_ready() call above.
	 */
	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && lim.zoned) {
	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
	    (lim.features & BLK_FEAT_ZONED)) {
		blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, vblk->disk->queue);
		err = blk_revalidate_disk_zones(vblk->disk);
		if (err)
+6 −5
Original line number Diff line number Diff line
@@ -1605,12 +1605,12 @@ int dm_calculate_queue_limits(struct dm_table *t,
		ti->type->iterate_devices(ti, dm_set_device_limits,
					  &ti_limits);

		if (!zoned && ti_limits.zoned) {
		if (!zoned && (ti_limits.features & BLK_FEAT_ZONED)) {
			/*
			 * After stacking all limits, validate all devices
			 * in table support this zoned model and zone sectors.
			 */
			zoned = ti_limits.zoned;
			zoned = (ti_limits.features & BLK_FEAT_ZONED);
			zone_sectors = ti_limits.chunk_sectors;
		}

@@ -1658,12 +1658,12 @@ int dm_calculate_queue_limits(struct dm_table *t,
	 *   zoned model on host-managed zoned block devices.
	 * BUT...
	 */
	if (limits->zoned) {
	if (limits->features & BLK_FEAT_ZONED) {
		/*
		 * ...IF the above limits stacking determined a zoned model
		 * validate that all of the table's devices conform to it.
		 */
		zoned = limits->zoned;
		zoned = limits->features & BLK_FEAT_ZONED;
		zone_sectors = limits->chunk_sectors;
	}
	if (validate_hardware_zoned(t, zoned, zone_sectors))
@@ -1834,7 +1834,8 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
	 * For a zoned target, setup the zones related queue attributes
	 * and resources necessary for zone append emulation if necessary.
	 */
	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && limits->zoned) {
	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
	    (limits->features & limits->features & BLK_FEAT_ZONED)) {
		r = dm_set_zones_restrictions(t, q, limits);
		if (r)
			return r;
Loading