hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/md/dm-flakey.c
....@@ -280,7 +280,7 @@
280280 struct flakey_c *fc = ti->private;
281281
282282 bio_set_dev(bio, fc->dev->bdev);
283
- if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET)
283
+ if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio)))
284284 bio->bi_iter.bi_sector =
285285 flakey_map_sector(ti, bio->bi_iter.bi_sector);
286286 }
....@@ -322,12 +322,7 @@
322322 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
323323 pb->bio_submitted = false;
324324
325
- /* Do not fail reset zone */
326
- if (bio_op(bio) == REQ_OP_ZONE_RESET)
327
- goto map_bio;
328
-
329
- /* We need to remap reported zones, so remember the BIO iter */
330
- if (bio_op(bio) == REQ_OP_ZONE_REPORT)
325
+ if (op_is_zone_mgmt(bio_op(bio)))
331326 goto map_bio;
332327
333328 /* Are we alive ? */
....@@ -388,13 +383,8 @@
388383 struct flakey_c *fc = ti->private;
389384 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
390385
391
- if (bio_op(bio) == REQ_OP_ZONE_RESET)
386
+ if (op_is_zone_mgmt(bio_op(bio)))
392387 return DM_ENDIO_DONE;
393
-
394
- if (bio_op(bio) == REQ_OP_ZONE_REPORT) {
395
- dm_remap_zone_report(ti, bio, fc->start);
396
- return DM_ENDIO_DONE;
397
- }
398388
399389 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
400390 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
....@@ -468,6 +458,19 @@
468458 return 0;
469459 }
470460
461
+#ifdef CONFIG_BLK_DEV_ZONED
462
+static int flakey_report_zones(struct dm_target *ti,
463
+ struct dm_report_zones_args *args, unsigned int nr_zones)
464
+{
465
+ struct flakey_c *fc = ti->private;
466
+ sector_t sector = flakey_map_sector(ti, args->next_sector);
467
+
468
+ args->start = fc->start;
469
+ return blkdev_report_zones(fc->dev->bdev, sector, nr_zones,
470
+ dm_report_zones_cb, args);
471
+}
472
+#endif
473
+
471474 static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data)
472475 {
473476 struct flakey_c *fc = ti->private;
....@@ -479,7 +482,10 @@
479482 .name = "flakey",
480483 .version = {1, 5, 0},
481484 #ifdef CONFIG_BLK_DEV_ZONED
482
- .features = DM_TARGET_ZONED_HM,
485
+ .features = DM_TARGET_ZONED_HM | DM_TARGET_PASSES_CRYPTO,
486
+ .report_zones = flakey_report_zones,
487
+#else
488
+ .features = DM_TARGET_PASSES_CRYPTO,
483489 #endif
484490 .module = THIS_MODULE,
485491 .ctr = flakey_ctr,