From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Pavel Begunkov" <asml.silence@gmail.com>,
"Mike Snitzer" <snitzer@redhat.com>,
"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Md . Haris Iqbal " <haris.iqbal@ionos.com>,
"Jack Wang" <jinpu.wang@ionos.com>,
"Roger Pau Monné" <roger.pau@citrix.co>,
"Philipp Reisner" <philipp.reisner@linbit.com>,
"Lars Ellenberg" <lars.ellenberg@linbit.com>,
linux-block@vger.kernel.org, dm-devel@redhat.com,
linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
xen-devel@lists.xenproject.org, drbd-dev@lists.linbit.com
Subject: [PATCH 07/19] dm-snap: use blkdev_issue_flush instead of open coding it
Date: Tue, 18 Jan 2022 08:19:40 +0100 [thread overview]
Message-ID: <20220118071952.1243143-8-hch@lst.de> (raw)
In-Reply-To: <20220118071952.1243143-1-hch@lst.de>
Use blkdev_issue_flush, which uses an on-stack bio instead of an
opencoded version with a bio embedded into struct dm_snapshot.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/dm-snap.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index dcf34c6b05ad3..0d336b5ec5714 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -141,11 +141,6 @@ struct dm_snapshot {
* for them to be committed.
*/
struct bio_list bios_queued_during_merge;
-
- /*
- * Flush data after merge.
- */
- struct bio flush_bio;
};
/*
@@ -1127,17 +1122,6 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s)
static void error_bios(struct bio *bio);
-static int flush_data(struct dm_snapshot *s)
-{
- struct bio *flush_bio = &s->flush_bio;
-
- bio_reset(flush_bio);
- bio_set_dev(flush_bio, s->origin->bdev);
- flush_bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
-
- return submit_bio_wait(flush_bio);
-}
-
static void merge_callback(int read_err, unsigned long write_err, void *context)
{
struct dm_snapshot *s = context;
@@ -1151,7 +1135,7 @@ static void merge_callback(int read_err, unsigned long write_err, void *context)
goto shut;
}
- if (flush_data(s) < 0) {
+ if (blkdev_issue_flush(s->origin->bdev) < 0) {
DMERR("Flush after merge failed: shutting down merge");
goto shut;
}
@@ -1340,7 +1324,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
s->first_merging_chunk = 0;
s->num_merging_chunks = 0;
bio_list_init(&s->bios_queued_during_merge);
- bio_init(&s->flush_bio, NULL, 0);
/* Allocate hash table for COW data */
if (init_hash_tables(s)) {
@@ -1528,8 +1511,6 @@ static void snapshot_dtr(struct dm_target *ti)
dm_exception_store_destroy(s->store);
- bio_uninit(&s->flush_bio);
-
dm_put_device(ti, s->cow);
dm_put_device(ti, s->origin);
--
2.30.2
next prev parent reply other threads:[~2022-01-18 7:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 7:19 improve the bio allocation interface Christoph Hellwig
2022-01-18 7:19 ` [PATCH 01/19] fs: remove mpage_alloc Christoph Hellwig
2022-01-18 7:19 ` [PATCH 02/19] nilfs2: remove nilfs_alloc_seg_bio Christoph Hellwig
2022-01-18 7:19 ` [PATCH 03/19] nfs/blocklayout: remove bl_alloc_init_bio Christoph Hellwig
2022-01-18 7:19 ` [PATCH 04/19] ntfs3: remove ntfs_alloc_bio Christoph Hellwig
2022-01-18 7:19 ` [PATCH 05/19] dm: bio_alloc can't fail if it is allowed to sleep Christoph Hellwig
2022-01-18 7:19 ` [PATCH 06/19] dm-crypt: remove clone_init Christoph Hellwig
2022-01-18 7:19 ` Christoph Hellwig [this message]
2022-01-18 7:19 ` [PATCH 08/19] dm-thin: use blkdev_issue_flush instead of open coding it Christoph Hellwig
2022-01-18 7:19 ` [PATCH 09/19] drbd: bio_alloc can't fail if it is allow to sleep Christoph Hellwig
2022-01-18 7:19 ` [PATCH 10/19] rnbd-srv: simplify bio mapping in process_rdma Christoph Hellwig
2022-01-19 0:20 ` Jinpu Wang
2022-01-19 0:48 ` Jinpu Wang
2022-01-20 8:37 ` Christoph Hellwig
2022-01-20 8:46 ` Jinpu Wang
2022-01-18 7:19 ` [PATCH 11/19] rnbd-src: remove struct rnbd_dev_blk_io Christoph Hellwig
2022-01-19 15:32 ` Jinpu Wang
2022-01-18 7:19 ` [PATCH 12/19] xen-blkback: bio_alloc can't fail if it is allow to sleep Christoph Hellwig
2022-01-18 7:19 ` [PATCH 13/19] block: move blk_next_bio to bio.c Christoph Hellwig
2022-01-18 22:10 ` Chaitanya Kulkarni
2022-01-18 7:19 ` [PATCH 14/19] block: pass a block_device and opf to blk_next_bio Christoph Hellwig
2022-01-18 22:11 ` Chaitanya Kulkarni
2022-01-20 8:34 ` Christoph Hellwig
2022-01-18 7:19 ` [PATCH 15/19] block: pass a block_device and opf to bio_alloc_bioset Christoph Hellwig
2022-01-18 22:12 ` Chaitanya Kulkarni
2022-01-18 7:19 ` [PATCH 16/19] block: pass a block_device and opf to bio_alloc_kiocb Christoph Hellwig
2022-01-18 22:12 ` Chaitanya Kulkarni
2022-01-18 7:19 ` [PATCH 17/19] block: pass a block_device and opf to bio_alloc Christoph Hellwig
2022-01-18 22:14 ` Chaitanya Kulkarni
2022-01-18 7:19 ` [PATCH 18/19] block: pass a block_device and opf to bio_init Christoph Hellwig
2022-01-18 22:15 ` Chaitanya Kulkarni
2022-01-18 7:19 ` [PATCH 19/19] block: pass a block_device and opf to bio_reset Christoph Hellwig
2022-01-18 22:16 ` Chaitanya Kulkarni
2022-01-19 13:27 ` improve the bio allocation interface Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2022-01-24 9:10 improve the bio allocation interface v2 Christoph Hellwig
2022-01-24 9:10 ` [PATCH 07/19] dm-snap: use blkdev_issue_flush instead of open coding it Christoph Hellwig
2022-01-27 17:11 ` Mike Snitzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220118071952.1243143-8-hch@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=drbd-dev@lists.linbit.com \
--cc=haris.iqbal@ionos.com \
--cc=jinpu.wang@ionos.com \
--cc=konishi.ryusuke@gmail.com \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=philipp.reisner@linbit.com \
--cc=roger.pau@citrix.co \
--cc=snitzer@redhat.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox