Skip to content

Commit 96b7058

Browse files
committed
block: add sync_blockdev_range()
JIRA: https://issues.redhat.com/browse/RHEL-9653 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> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jens Axboe <axboe@kernel.dk> Acked-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> (cherry picked from commit 97d6fb1) Signed-off-by: Pavel Reichl <preichl@redhat.com>
1 parent db8d3a5 commit 96b7058

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

block/bdev.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ int sync_blockdev(struct block_device *bdev)
199199
}
200200
EXPORT_SYMBOL(sync_blockdev);
201201

202+
int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend)
203+
{
204+
return filemap_write_and_wait_range(bdev->bd_inode->i_mapping,
205+
lstart, lend);
206+
}
207+
EXPORT_SYMBOL(sync_blockdev_range);
208+
202209
/*
203210
* Write out and wait upon all dirty data associated with this
204211
* device. Filesystem data as well as the underlying block

include/linux/blkdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,7 @@ struct block_device *I_BDEV(struct inode *inode);
15031503
#ifdef CONFIG_BLOCK
15041504
void invalidate_bdev(struct block_device *bdev);
15051505
int sync_blockdev(struct block_device *bdev);
1506+
int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend);
15061507
int sync_blockdev_nowait(struct block_device *bdev);
15071508
void sync_bdevs(bool wait);
15081509
void bdev_statx_dioalign(struct inode *inode, struct kstat *stat);

0 commit comments

Comments
 (0)