Skip to content

Commit 3093a47

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: inherit the zoned characteristics in blk_stack_limits
Lift the code from device mapper into blk_stack_limits to inherity the stacking limitations. This ensures we do the right thing for all stacked zoned block devices. Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Tested-by: Damien Le Moal <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 4f43d64 commit 3093a47

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

block/blk-settings.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
609609
t->chunk_sectors = min_not_zero(t->chunk_sectors,
610610
b->chunk_sectors);
611611

612+
t->zoned = max(t->zoned, b->zoned);
612613
return ret;
613614
}
614615
EXPORT_SYMBOL(blk_stack_limits);

drivers/md/dm-table.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
467467
q->limits.logical_block_size,
468468
q->limits.alignment_offset,
469469
(unsigned long long) start << SECTOR_SHIFT);
470-
471-
limits->zoned = blk_queue_zoned_model(q);
472-
473470
return 0;
474471
}
475472

@@ -1528,22 +1525,6 @@ int dm_calculate_queue_limits(struct dm_table *table,
15281525
dm_device_name(table->md),
15291526
(unsigned long long) ti->begin,
15301527
(unsigned long long) ti->len);
1531-
1532-
/*
1533-
* FIXME: this should likely be moved to blk_stack_limits(), would
1534-
* also eliminate limits->zoned stacking hack in dm_set_device_limits()
1535-
*/
1536-
if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) {
1537-
/*
1538-
* By default, the stacked limits zoned model is set to
1539-
* BLK_ZONED_NONE in blk_set_stacking_limits(). Update
1540-
* this model using the first target model reported
1541-
* that is not BLK_ZONED_NONE. This will be either the
1542-
* first target device zoned model or the model reported
1543-
* by the target .io_hints.
1544-
*/
1545-
limits->zoned = ti_limits.zoned;
1546-
}
15471528
}
15481529

15491530
/*

include/linux/blkdev.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,14 @@ enum blk_queue_state {
306306

307307
/*
308308
* Zoned block device models (zoned limit).
309+
*
310+
* Note: This needs to be ordered from the least to the most severe
311+
* restrictions for the inheritance in blk_stack_limits() to work.
309312
*/
310313
enum blk_zoned_model {
311-
BLK_ZONED_NONE, /* Regular block device */
312-
BLK_ZONED_HA, /* Host-aware zoned block device */
313-
BLK_ZONED_HM, /* Host-managed zoned block device */
314+
BLK_ZONED_NONE = 0, /* Regular block device */
315+
BLK_ZONED_HA, /* Host-aware zoned block device */
316+
BLK_ZONED_HM, /* Host-managed zoned block device */
314317
};
315318

316319
struct queue_limits {

0 commit comments

Comments
 (0)