* If the target is mapped to zoned block device(s), check
* that the zones are not partially mapped.
*/
- if (bdev_zoned_model(bdev) != BLK_ZONED_NONE) {
+ if (bdev_is_zoned(bdev)) {
unsigned int zone_sectors = bdev_zone_sectors(bdev);
if (start & (zone_sectors - 1)) {
return args.err;
}
-static struct blk_ksm_ll_ops dm_ksm_ll_ops = {
+static const struct blk_ksm_ll_ops dm_ksm_ll_ops = {
.keyslot_evict = dm_keyslot_evict,
};
return blk_queue_stable_writes(q);
}
-void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
- struct queue_limits *limits)
+int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
+ struct queue_limits *limits)
{
bool wc = false, fua = false;
int page_size = PAGE_SIZE;
+ int r;
/*
* Copy table's limits to the DM device's request_queue
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
/*
- * For a zoned target, the number of zones should be updated for the
- * correct value to be exposed in sysfs queue/nr_zones. For a BIO based
- * target, this is all that is needed.
+ * For a zoned target, setup the zones related queue attributes
+ * and resources necessary for zone append emulation if necessary.
*/
-#ifdef CONFIG_BLK_DEV_ZONED
if (blk_queue_is_zoned(q)) {
- WARN_ON_ONCE(queue_is_mq(q));
- q->nr_zones = blkdev_nr_zones(t->md->disk);
+ r = dm_set_zones_restrictions(t, q);
+ if (r)
+ return r;
}
-#endif
dm_update_keyslot_manager(q, t);
blk_queue_update_readahead(q);
+
+ return 0;
}
unsigned int dm_table_get_num_targets(struct dm_table *t)