diff mbox series

[3/4] block: optimise blk_flush_plug_list

Message ID 20211020144119.142582-4-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/4] blk-mq: only flush requests from the plug in blk_mq_submit_bio | expand

Commit Message

Christoph Hellwig Oct. 20, 2021, 2:41 p.m. UTC
From: Pavel Begunkov <asml.silence@gmail.com>

Don't call flush_plug_callbacks if there are no plug callbacks.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
[hch: split from a larger patch]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index e6ad5b51d0c3d..63fee1f82bd7d 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1639,8 +1639,8 @@  EXPORT_SYMBOL(blk_check_plugged);
 
 void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 {
-	flush_plug_callbacks(plug, from_schedule);
-
+	if (!list_empty(&plug->cb_list))
+		flush_plug_callbacks(plug, from_schedule);
 	if (!rq_list_empty(plug->mq_list))
 		blk_mq_flush_plug_list(plug, from_schedule);
 	if (unlikely(!from_schedule && plug->cached_rq))