Skip to content

Commit 97d6fb1

Browse files
YuezhangMonamjaejeon
authored andcommitted
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 <[email protected]> Suggested-by: Christoph Hellwig <[email protected]> Reviewed-by: Andy Wu <[email protected]> Reviewed-by: Aoyama Wataru <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Acked-by: Sungjong Seo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 9b00289 commit 97d6fb1

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
@@ -200,6 +200,13 @@ int sync_blockdev(struct block_device *bdev)
200200
}
201201
EXPORT_SYMBOL(sync_blockdev);
202202

203+
int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend)
204+
{
205+
return filemap_write_and_wait_range(bdev->bd_inode->i_mapping,
206+
lstart, lend);
207+
}
208+
EXPORT_SYMBOL(sync_blockdev_range);
209+
203210
/*
204211
* Write out and wait upon all dirty data associated with this
205212
* 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
@@ -1547,6 +1547,7 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
15471547
#ifdef CONFIG_BLOCK
15481548
void invalidate_bdev(struct block_device *bdev);
15491549
int sync_blockdev(struct block_device *bdev);
1550+
int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend);
15501551
int sync_blockdev_nowait(struct block_device *bdev);
15511552
void sync_bdevs(bool wait);
15521553
void printk_all_partitions(void);

0 commit comments

Comments
 (0)