diff options
| author | shunki-fujita <shunki-fujita@cybozu.co.jp> | 2018-04-05 19:20:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-06 00:36:23 -0400 |
| commit | 849cf55963dfd877ad92996195e0fe7218eaf0e9 (patch) | |
| tree | 3c1dab29c873beb615163ff832024b3c9e09752e /fs/block_dev.c | |
| parent | 9421c3e64137ec69e5cf4ed024dc777a09b7779f (diff) | |
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@cybozu.co.jp
Signed-off-by: Shunki Fujita <shunki-fujita@cybozu.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
| -rw-r--r-- | fs/block_dev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index fe09ef9c21f3..7a506c55a993 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -1324,7 +1324,8 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty) | |||
| 1324 | * @bdev: struct bdev to adjust. | 1324 | * @bdev: struct bdev to adjust. |
| 1325 | * | 1325 | * |
| 1326 | * This routine checks to see if the bdev size does not match the disk size | 1326 | * This routine checks to see if the bdev size does not match the disk size |
| 1327 | * and adjusts it if it differs. | 1327 | * and adjusts it if it differs. When shrinking the bdev size, its all caches |
| 1328 | * are freed. | ||
| 1328 | */ | 1329 | */ |
| 1329 | void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) | 1330 | void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) |
| 1330 | { | 1331 | { |
| @@ -1337,7 +1338,8 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) | |||
| 1337 | "%s: detected capacity change from %lld to %lld\n", | 1338 | "%s: detected capacity change from %lld to %lld\n", |
| 1338 | disk->disk_name, bdev_size, disk_size); | 1339 | disk->disk_name, bdev_size, disk_size); |
| 1339 | i_size_write(bdev->bd_inode, disk_size); | 1340 | i_size_write(bdev->bd_inode, disk_size); |
| 1340 | flush_disk(bdev, false); | 1341 | if (bdev_size > disk_size) |
| 1342 | flush_disk(bdev, false); | ||
| 1341 | } | 1343 | } |
| 1342 | } | 1344 | } |
| 1343 | EXPORT_SYMBOL(check_disk_size_change); | 1345 | EXPORT_SYMBOL(check_disk_size_change); |
