From 97d6fb1b48f5e6f6d58028593defe8a23641b0b4 Mon Sep 17 00:00:00 2001 From: Yuezhang Mo Date: Tue, 12 Apr 2022 12:23:10 +0900 Subject: block: add sync_blockdev_range() sync_blockdev_range() is to support syncing multiple sectors with as few block device requests as possible, it is helpful to make the block device to give full play to its performance. Signed-off-by: Yuezhang Mo Suggested-by: Christoph Hellwig Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Reviewed-by: Christoph Hellwig Reviewed-by: Jens Axboe Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon --- block/bdev.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'block/bdev.c') diff --git a/block/bdev.c b/block/bdev.c index 13de871fa816..8b549b071bd6 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -200,6 +200,13 @@ int sync_blockdev(struct block_device *bdev) } EXPORT_SYMBOL(sync_blockdev); +int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend) +{ + return filemap_write_and_wait_range(bdev->bd_inode->i_mapping, + lstart, lend); +} +EXPORT_SYMBOL(sync_blockdev_range); + /* * Write out and wait upon all dirty data associated with this * device. Filesystem data as well as the underlying block -- cgit v1.2.3