[dm-devel] [PATCH] dm thin: Avoid flushing the data device twice
Nikos Tsironis
ntsironis at arrikto.com
Wed Dec 4 17:06:38 UTC 2019
Since we flush the data device as part of a metadata commit, it's
redundant to then submit any deferred REQ_PREFLUSH bios.
Add a check in process_deferred_bios() for deferred REQ_PREFLUSH bios
and complete them immediately.
Signed-off-by: Nikos Tsironis <ntsironis at arrikto.com>
---
drivers/md/dm-thin.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index e0be545080d0..40d8a255dbc3 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2383,8 +2383,18 @@ static void process_deferred_bios(struct pool *pool)
while ((bio = bio_list_pop(&bio_completions)))
bio_endio(bio);
- while ((bio = bio_list_pop(&bios)))
- generic_make_request(bio);
+ while ((bio = bio_list_pop(&bios))) {
+ if (bio->bi_opf & REQ_PREFLUSH) {
+ /*
+ * We just flushed the data device as part of the
+ * metadata commit, so there is no reason to send
+ * another flush.
+ */
+ bio_endio(bio);
+ } else {
+ generic_make_request(bio);
+ }
+ }
}
static void do_worker(struct work_struct *ws)
--
2.11.0
More information about the dm-devel
mailing list