diff mbox series

[v3,1/2] block: add sync_blockdev_range()

Message ID HK2PR04MB3891FCECADD7AECEEF5DD63081E99@HK2PR04MB3891.apcprd04.prod.outlook.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/2] block: add sync_blockdev_range() | expand

Commit Message

Yuezhang.Mo@sony.com April 8, 2022, 3:07 a.m. UTC
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 <Yuezhang.Mo@sony.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
cc: Jens Axboe <axboe@kernel.dk>
---
 block/bdev.c           | 7 +++++++
 include/linux/blkdev.h | 1 +
 2 files changed, 8 insertions(+)

Comments

Christoph Hellwig April 8, 2022, 5:09 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Namjae Jeon April 11, 2022, 2:08 a.m. UTC | #2
2022-04-08 14:09 GMT+09:00, Christoph Hellwig <hch@infradead.org>:
> Looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thanks for your review!

Hi Jens,

Can I apply this patch with your Ack to exfat #dev ?

Thanks!

>
Jens Axboe April 12, 2022, 1:12 a.m. UTC | #3
On 4/10/22 8:08 PM, Namjae Jeon wrote:
> 2022-04-08 14:09 GMT+09:00, Christoph Hellwig <hch@infradead.org>:
>> Looks good:
>>
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Thanks for your review!
> 
> Hi Jens,
> 
> Can I apply this patch with your Ack to exfat #dev ?

Yes go ahead:

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Namjae Jeon April 12, 2022, 3:37 a.m. UTC | #4
2022-04-12 10:12 GMT+09:00, Jens Axboe <axboe@kernel.dk>:
> On 4/10/22 8:08 PM, Namjae Jeon wrote:
>> 2022-04-08 14:09 GMT+09:00, Christoph Hellwig <hch@infradead.org>:
>>> Looks good:
>>>
>>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>> Thanks for your review!
>>
>> Hi Jens,
>>
>> Can I apply this patch with your Ack to exfat #dev ?
>
> Yes go ahead:
>
> Reviewed-by: Jens Axboe <axboe@kernel.dk>
Applied, Thanks for your review!

>
> --
> Jens Axboe
>
>
diff mbox series

Patch

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
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 60d016138997..331cc6918ee9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1547,6 +1547,7 @@  int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
 #ifdef CONFIG_BLOCK
 void invalidate_bdev(struct block_device *bdev);
 int sync_blockdev(struct block_device *bdev);
+int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend);
 int sync_blockdev_nowait(struct block_device *bdev);
 void sync_bdevs(bool wait);
 void printk_all_partitions(void);