]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm-clone: use blkdev_issue_flush in commit_metadata
authorChristoph Hellwig <hch@lst.de>
Tue, 26 Jan 2021 14:52:36 +0000 (15:52 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 27 Jan 2021 16:51:48 +0000 (09:51 -0700)
Use blkdev_issue_flush instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Acked-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/dm-clone-target.c

index bdb255edc20043950e96a0ae2a4c4f09a29bb385..a90bdf9b2ca6bdbdb8a7b6b7ffa07e9e53d850a2 100644 (file)
@@ -85,12 +85,6 @@ struct clone {
 
        struct dm_clone_metadata *cmd;
 
-       /*
-        * bio used to flush the destination device, before committing the
-        * metadata.
-        */
-       struct bio flush_bio;
-
        /* Region hydration hash table */
        struct hash_table_bucket *ht;
 
@@ -1155,11 +1149,7 @@ static int commit_metadata(struct clone *clone, bool *dest_dev_flushed)
                goto out;
        }
 
-       bio_reset(&clone->flush_bio);
-       bio_set_dev(&clone->flush_bio, clone->dest_dev->bdev);
-       clone->flush_bio.bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
-
-       r = submit_bio_wait(&clone->flush_bio);
+       r = blkdev_issue_flush(clone->dest_dev->bdev);
        if (unlikely(r)) {
                __metadata_operation_failed(clone, "flush destination device", r);
                goto out;
@@ -1886,7 +1876,6 @@ static int clone_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        bio_list_init(&clone->deferred_flush_completions);
        clone->hydration_offset = 0;
        atomic_set(&clone->hydrations_in_flight, 0);
-       bio_init(&clone->flush_bio, NULL, 0);
 
        clone->wq = alloc_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM, 0);
        if (!clone->wq) {
@@ -1958,7 +1947,6 @@ static void clone_dtr(struct dm_target *ti)
        struct clone *clone = ti->private;
 
        mutex_destroy(&clone->commit_lock);
-       bio_uninit(&clone->flush_bio);
 
        for (i = 0; i < clone->nr_ctr_args; i++)
                kfree(clone->ctr_args[i]);