linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] block: add sync_blockdev_range()
@ 2022-04-08  3:07 Yuezhang.Mo
  2022-04-08  5:09 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Yuezhang.Mo @ 2022-04-08  3:07 UTC (permalink / raw)
  To: Namjae Jeon, sj1557.seo
  Cc: linux-kernel, linux-fsdevel, Andy.Wu, Wataru.Aoyama,
	Christoph Hellwig, axboe

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

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(+)

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);
-- 
2.25.1

[-- Attachment #2: v3-0001-block-add-sync_blockdev_range.patch --]
[-- Type: application/octet-stream, Size: 1668 bytes --]

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(+)

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] block: add sync_blockdev_range()
  2022-04-08  3:07 [PATCH v3 1/2] block: add sync_blockdev_range() Yuezhang.Mo
@ 2022-04-08  5:09 ` Christoph Hellwig
  2022-04-11  2:08   ` Namjae Jeon
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2022-04-08  5:09 UTC (permalink / raw)
  To: Yuezhang.Mo
  Cc: Namjae Jeon, sj1557.seo, linux-kernel, linux-fsdevel, Andy.Wu,
	Wataru.Aoyama, Christoph Hellwig, axboe

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] block: add sync_blockdev_range()
  2022-04-08  5:09 ` Christoph Hellwig
@ 2022-04-11  2:08   ` Namjae Jeon
  2022-04-12  1:12     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2022-04-11  2:08 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Yuezhang.Mo, sj1557.seo, linux-kernel, linux-fsdevel, Andy.Wu,
	Wataru.Aoyama

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!

>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] block: add sync_blockdev_range()
  2022-04-11  2:08   ` Namjae Jeon
@ 2022-04-12  1:12     ` Jens Axboe
  2022-04-12  3:37       ` Namjae Jeon
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-04-12  1:12 UTC (permalink / raw)
  To: Namjae Jeon, Christoph Hellwig
  Cc: Yuezhang.Mo, sj1557.seo, linux-kernel, linux-fsdevel, Andy.Wu,
	Wataru.Aoyama

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>

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] block: add sync_blockdev_range()
  2022-04-12  1:12     ` Jens Axboe
@ 2022-04-12  3:37       ` Namjae Jeon
  0 siblings, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2022-04-12  3:37 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Yuezhang.Mo, sj1557.seo, linux-kernel,
	linux-fsdevel, Andy.Wu, Wataru.Aoyama

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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-12  3:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08  3:07 [PATCH v3 1/2] block: add sync_blockdev_range() Yuezhang.Mo
2022-04-08  5:09 ` Christoph Hellwig
2022-04-11  2:08   ` Namjae Jeon
2022-04-12  1:12     ` Jens Axboe
2022-04-12  3:37       ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).