lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 2 Apr 2022 03:28:00 +0000
From:   "Yuezhang.Mo@...y.com" <Yuezhang.Mo@...y.com>
To:     Namjae Jeon <linkinjeon@...nel.org>,
        "sj1557.seo@...sung.com" <sj1557.seo@...sung.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "Andy.Wu@...y.com" <Andy.Wu@...y.com>,
        "Wataru.Aoyama@...y.com" <Wataru.Aoyama@...y.com>,
        "axboe@...nel.dk" <axboe@...nel.dk>,
        Christoph Hellwig <hch@...radead.org>
Subject: [PATCH v2 1/2] 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 <Yuezhang.Mo@...y.com>
Suggested-by: Christoph Hellwig <hch@...radead.org>
Reviewed-by: Andy Wu <Andy.Wu@...y.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@...y.com>
cc: Jens Axboe <axboe@...nel.dk>
---
 block/bdev.c           | 10 ++++++++++
 include/linux/blkdev.h |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/block/bdev.c b/block/bdev.c
index 102837a37051..57043e4f3322 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -200,6 +200,16 @@ 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)
+{
+	if (!bdev)
+		return 0;
+
+	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 16b47035e4b0..1e85d0688d9c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1310,6 +1310,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);
 #else
@@ -1320,6 +1321,11 @@ static inline int sync_blockdev(struct block_device *bdev)
 {
 	return 0;
 }
+static inline int sync_blockdev_range(struct block_device *bdev, loff_t lstart,
+		loff_t lend)
+{
+	return 0;
+}
 static inline int sync_blockdev_nowait(struct block_device *bdev)
 {
 	return 0;
-- 
2.25.1


Download attachment "v2-0001-block-add-sync_blockdev_range.patch" of type "application/octet-stream" (1976 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ