]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
dm: add zone open, close and finish support
authorAjay Joshi <ajay.joshi@wdc.com>
Sun, 27 Oct 2019 14:05:48 +0000 (23:05 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 7 Nov 2019 13:36:08 +0000 (06:36 -0700)
Implement REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH
support to allow explicit control of zone states.

Contains contributions from Matias Bjorling, Hans Holmberg and
Damien Le Moal.

Acked-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ajay Joshi <ajay.joshi@wdc.com>
Signed-off-by: Matias Bjorling <matias.bjorling@wdc.com>
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/dm-flakey.c
drivers/md/dm-linear.c
drivers/md/dm.c

index 2900fbde89b3508d01e1900972952469fef6fa2b..76587e9af0ef7ee3d9313d5d4873946d721be189 100644 (file)
@@ -280,7 +280,7 @@ static void flakey_map_bio(struct dm_target *ti, struct bio *bio)
        struct flakey_c *fc = ti->private;
 
        bio_set_dev(bio, fc->dev->bdev);
-       if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET)
+       if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio)))
                bio->bi_iter.bi_sector =
                        flakey_map_sector(ti, bio->bi_iter.bi_sector);
 }
@@ -322,8 +322,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
        struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
        pb->bio_submitted = false;
 
-       /* Do not fail reset zone */
-       if (bio_op(bio) == REQ_OP_ZONE_RESET)
+       if (op_is_zone_mgmt(bio_op(bio)))
                goto map_bio;
 
        /* Are we alive ? */
@@ -384,7 +383,7 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio,
        struct flakey_c *fc = ti->private;
        struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
 
-       if (bio_op(bio) == REQ_OP_ZONE_RESET)
+       if (op_is_zone_mgmt(bio_op(bio)))
                return DM_ENDIO_DONE;
 
        if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
index ecefe67037365a89f2cf08bcd15b7a5cfbdf26a7..97acafd48c8505eed19b15f69a6301eb1cbf04a5 100644 (file)
@@ -90,7 +90,7 @@ static void linear_map_bio(struct dm_target *ti, struct bio *bio)
        struct linear_c *lc = ti->private;
 
        bio_set_dev(bio, lc->dev->bdev);
-       if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET)
+       if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio)))
                bio->bi_iter.bi_sector =
                        linear_map_sector(ti, bio->bi_iter.bi_sector);
 }
index 1a5e328c443a997a48e36a0397afbe27ee8c8e4b..bc143c1b23339bd430cf72d39a8ed17449389e83 100644 (file)
@@ -1174,7 +1174,8 @@ static size_t dm_dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff,
 
 /*
  * A target may call dm_accept_partial_bio only from the map routine.  It is
- * allowed for all bio types except REQ_PREFLUSH and REQ_OP_ZONE_RESET.
+ * allowed for all bio types except REQ_PREFLUSH, REQ_OP_ZONE_RESET,
+ * REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH.
  *
  * dm_accept_partial_bio informs the dm that the target only wants to process
  * additional n_sectors sectors of the bio and the rest of the data should be
@@ -1627,7 +1628,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,
                ci.sector_count = 0;
                error = __send_empty_flush(&ci);
                /* dec_pending submits any data associated with flush */
-       } else if (bio_op(bio) == REQ_OP_ZONE_RESET) {
+       } else if (op_is_zone_mgmt(bio_op(bio))) {
                ci.bio = bio;
                ci.sector_count = 0;
                error = __split_and_process_non_flush(&ci);