Merge tag 'perf-urgent-2021-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / md / dm-table.c
index ee47a33..0543cdf 100644 (file)
@@ -249,7 +249,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
         * 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)) {
@@ -1244,7 +1244,7 @@ static int dm_keyslot_evict(struct blk_keyslot_manager *ksm,
        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,
 };
 
@@ -1981,11 +1981,12 @@ static int device_requires_stable_pages(struct dm_target *ti,
        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
@@ -2065,19 +2066,19 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
                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)