The patch titled Subject: fs: don't flush pagecache when expanding block device has been added to the -mm tree. Its filename is fs-dont-flush-pagecache-when-expanding-block-device.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-dont-flush-pagecache-when-expanding-block-device.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-dont-flush-pagecache-when-expanding-block-device.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: shunki-fujita <shunki-fujita@xxxxxxxxxxxx> Subject: fs: don't flush pagecache when expanding block device When changing the size of a block device, its all caches are freed. It's necessary on shrinking to prevent spurious I/Os to the disappeared region. However, on expanding, such kind of I/Os doesn't happen. Similar things can be considered for btrfs filesystem resize and resize2fs, but they are designed not to drop caches when expanding. Therefore this patch removes unnecessary cache drop. Link: http://lkml.kernel.org/r/1521457240-153390-1-git-send-email-shunki-fujita@xxxxxxxxxxxx Signed-off-by: Shunki Fujita <shunki-fujita@xxxxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/block_dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN fs/block_dev.c~fs-dont-flush-pagecache-when-expanding-block-device fs/block_dev.c --- a/fs/block_dev.c~fs-dont-flush-pagecache-when-expanding-block-device +++ a/fs/block_dev.c @@ -1324,7 +1324,8 @@ static void flush_disk(struct block_devi * @bdev: struct bdev to adjust. * * This routine checks to see if the bdev size does not match the disk size - * and adjusts it if it differs. + * and adjusts it if it differs. When shrinking the bdev size, its all caches + * are freed. */ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) { @@ -1337,7 +1338,8 @@ void check_disk_size_change(struct gendi "%s: detected capacity change from %lld to %lld\n", disk->disk_name, bdev_size, disk_size); i_size_write(bdev->bd_inode, disk_size); - flush_disk(bdev, false); + if (bdev_size > disk_size) + flush_disk(bdev, false); } } EXPORT_SYMBOL(check_disk_size_change); _ Patches currently in -mm which might be from shunki-fujita@xxxxxxxxxxxx are fs-dont-flush-pagecache-when-expanding-block-device.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html