Skip to content

Commit

Permalink
block: inherit the zoned characteristics in blk_stack_limits
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jul 20, 2020
1 parent 4f43d64 commit 3093a47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
1 change: 1 addition & 0 deletions block/blk-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
t->chunk_sectors = min_not_zero(t->chunk_sectors,
b->chunk_sectors);

t->zoned = max(t->zoned, b->zoned);
return ret;
}
EXPORT_SYMBOL(blk_stack_limits);
Expand Down
19 changes: 0 additions & 19 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
q->limits.logical_block_size,
q->limits.alignment_offset,
(unsigned long long) start << SECTOR_SHIFT);

limits->zoned = blk_queue_zoned_model(q);

return 0;
}

Expand Down Expand Up @@ -1528,22 +1525,6 @@ int dm_calculate_queue_limits(struct dm_table *table,
dm_device_name(table->md),
(unsigned long long) ti->begin,
(unsigned long long) ti->len);

/*
* FIXME: this should likely be moved to blk_stack_limits(), would
* also eliminate limits->zoned stacking hack in dm_set_device_limits()
*/
if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) {
/*
* By default, the stacked limits zoned model is set to
* BLK_ZONED_NONE in blk_set_stacking_limits(). Update
* this model using the first target model reported
* that is not BLK_ZONED_NONE. This will be either the
* first target device zoned model or the model reported
* by the target .io_hints.
*/
limits->zoned = ti_limits.zoned;
}
}

/*
Expand Down
9 changes: 6 additions & 3 deletions include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,14 @@ enum blk_queue_state {

/*
* Zoned block device models (zoned limit).
*
* Note: This needs to be ordered from the least to the most severe
* restrictions for the inheritance in blk_stack_limits() to work.
*/
enum blk_zoned_model {
BLK_ZONED_NONE, /* Regular block device */
BLK_ZONED_HA, /* Host-aware zoned block device */
BLK_ZONED_HM, /* Host-managed zoned block device */
BLK_ZONED_NONE = 0, /* Regular block device */
BLK_ZONED_HA, /* Host-aware zoned block device */
BLK_ZONED_HM, /* Host-managed zoned block device */
};

struct queue_limits {
Expand Down

0 comments on commit 3093a47

Please sign in to comment.