From a8702deb39a0b396cba1313cc49ab8a1a2ce8a27 Mon Sep 17 00:00:00 2001 From: Hoegeun Kwon Date: Mon, 17 Oct 2022 17:27:32 +0900 Subject: [PATCH] block: make function 'kill_bdev' export Revert "block: make function 'kill_bdev' static" with Kernel v5.15. :This reverts commit 3373a3461aa15b7f9a871fa4cb2c9ef21ac20b47. To free ramdisk memory, BLKFLSBUF support is required. Change-Id: I55831bc50d8a7344a873172f2f7498d2a0e37786 Signed-off-by: Hoegeun Kwon --- block/bdev.c | 3 ++- include/linux/blkdev.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/bdev.c b/block/bdev.c index 18abafb..d0d5a42 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -66,7 +66,7 @@ static void bdev_write_inode(struct block_device *bdev) } /* Kill _all_ buffers and pagecache , dirty or not.. */ -static void kill_bdev(struct block_device *bdev) +void kill_bdev(struct block_device *bdev) { struct address_space *mapping = bdev->bd_inode->i_mapping; @@ -76,6 +76,7 @@ static void kill_bdev(struct block_device *bdev) invalidate_bh_lrus(); truncate_inode_pages(mapping, 0); } +EXPORT_SYMBOL(kill_bdev); /* Invalidate clean unused buffers and pagecache. */ void invalidate_bdev(struct block_device *bdev) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 67344df..cf64df9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -2010,6 +2010,7 @@ void invalidate_bdev(struct block_device *bdev); int sync_blockdev(struct block_device *bdev); int sync_blockdev_nowait(struct block_device *bdev); void sync_bdevs(bool wait); +void kill_bdev(struct block_device *bdev); #else static inline void invalidate_bdev(struct block_device *bdev) { @@ -2025,6 +2026,9 @@ static inline int sync_blockdev_nowait(struct block_device *bdev) static inline void sync_bdevs(bool wait) { } +static inline void kill_bdev(struct block_device *bdev) +{ +} #endif int fsync_bdev(struct block_device *bdev); -- 2.7.4