]> Gentwo Git Trees - linux/.git/commitdiff
dm-mirror: Support atomic writes
authorJohn Garry <john.g.garry@oracle.com>
Thu, 16 Jan 2025 17:03:01 +0000 (17:03 +0000)
committerMikulas Patocka <mpatocka@redhat.com>
Fri, 17 Jan 2025 21:24:11 +0000 (22:24 +0100)
Support atomic writes by setting DM_TARGET_ATOMIC_WRITES for the target
type, and also unmasking REQ_ATOMIC from the submitted bio op flags.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-raid1.c

index 9511dae5b556a9994501392cac3766aa129f15a7..8c6f1f7e64568ab17223dd5d0a53957742620ae9 100644 (file)
@@ -656,7 +656,7 @@ static void do_write(struct mirror_set *ms, struct bio *bio)
        unsigned int i;
        struct dm_io_region io[MAX_NR_MIRRORS], *dest = io;
        struct mirror *m;
-       blk_opf_t op_flags = bio->bi_opf & (REQ_FUA | REQ_PREFLUSH);
+       blk_opf_t op_flags = bio->bi_opf & (REQ_FUA | REQ_PREFLUSH | REQ_ATOMIC);
        struct dm_io_request io_req = {
                .bi_opf = REQ_OP_WRITE | op_flags,
                .mem.type = DM_IO_BIO,
@@ -1483,8 +1483,9 @@ static int mirror_iterate_devices(struct dm_target *ti,
 
 static struct target_type mirror_target = {
        .name    = "mirror",
-       .version = {1, 14, 0},
+       .version = {1, 15, 0},
        .module  = THIS_MODULE,
+       .features = DM_TARGET_ATOMIC_WRITES,
        .ctr     = mirror_ctr,
        .dtr     = mirror_dtr,
        .map     = mirror_map,