[PATCH] block: export symbol blk_flush_plug

From: Chunhai Guo
Date: Mon Sep 04 2023 - 00:17:44 EST


blk_flush_plug() can be used in a filesystem module, without it may cause
a link failure, as shown in the reported test.

ERROR: modpost: "__blk_flush_plug" [fs/f2fs/f2fs.ko] undefined!

Export the symbol so it can be used by filesystem module.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202309021523.UcS7T7mp-lkp@xxxxxxxxx/
Closes: https://lore.kernel.org/oe-kbuild-all/202309021427.K1P8kWbl-lkp@xxxxxxxxx/
Fixes: e1e9b8062c74 ("f2fs: replace blk_finish_plug() with blk_flush_plug()")
Signed-off-by: Chunhai Guo <guochunhai@xxxxxxxx>
---
block/blk-core.c | 7 +++++++
include/linux/blkdev.h | 8 +-------
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 99d8b9812b18..1c5e5d3406fe 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1156,6 +1156,13 @@ void __blk_flush_plug(struct blk_plug *plug, bool from_schedule)
blk_mq_free_plug_rqs(plug);
}

+void blk_flush_plug(struct blk_plug *plug, bool async)
+{
+ if (plug)
+ __blk_flush_plug(plug, async);
+}
+EXPORT_SYMBOL(blk_flush_plug);
+
/**
* blk_finish_plug - mark the end of a batch of submitted I/O
* @plug: The &struct blk_plug passed to blk_start_plug()
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ed44a997f629..26ff9d417e6e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -986,13 +986,7 @@ extern struct blk_plug_cb *blk_check_plugged(blk_plug_cb_fn unplug,
extern void blk_start_plug(struct blk_plug *);
extern void blk_start_plug_nr_ios(struct blk_plug *, unsigned short);
extern void blk_finish_plug(struct blk_plug *);
-
-void __blk_flush_plug(struct blk_plug *plug, bool from_schedule);
-static inline void blk_flush_plug(struct blk_plug *plug, bool async)
-{
- if (plug)
- __blk_flush_plug(plug, async);
-}
+extern void blk_flush_plug(struct blk_plug *plug, bool async);

int blkdev_issue_flush(struct block_device *bdev);
long nr_blockdev_pages(void);
--
2.25.1