aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim2020-12-03 11:52:45 -0600
committerJaegeuk Kim2020-12-21 15:33:17 -0600
commit160d75f489096f857e4b6302ea452e37556486d9 (patch)
treeb19f143036a76817d9a012654f784d2ddbcb8b2d
parentbe33871db7498910cc1df4ed52653aaf308bb671 (diff)
downloadkernel-160d75f489096f857e4b6302ea452e37556486d9.tar.gz
kernel-160d75f489096f857e4b6302ea452e37556486d9.tar.xz
kernel-160d75f489096f857e4b6302ea452e37556486d9.zip
f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size
This patch adds max_io_bytes to limit bio size when f2fs tries to merge consecutive IOs. This can give a testing point to split out bios and check end_io handles those bios correctly. This is used to capture a recent bug on the decompression and fsverity flow. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--Documentation/ABI/testing/sysfs-fs-f2fs7
-rw-r--r--fs/f2fs/data.c3
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--fs/f2fs/sysfs.c2
4 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 67b3ed8e8c2f..3dfee94e0618 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -370,3 +370,10 @@ Date: April 2020
370Contact: "Daeho Jeong" <daehojeong@google.com> 370Contact: "Daeho Jeong" <daehojeong@google.com>
371Description: Give a way to change iostat_period time. 3secs by default. 371Description: Give a way to change iostat_period time. 3secs by default.
372 The new iostat trace gives stats gap given the period. 372 The new iostat trace gives stats gap given the period.
373What: /sys/fs/f2fs/<disk>/max_io_bytes
374Date: December 2020
375Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
376Description: This gives a control to limit the bio size in f2fs.
377 Default is zero, which will follow underlying block layer limit,
378 whereas, if it has a certain bytes value, f2fs won't submit a
379 bio larger than that size.
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index e85fd8f77f3f..cb28089e1eff 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -736,6 +736,9 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
736static bool page_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio, 736static bool page_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio,
737 block_t last_blkaddr, block_t cur_blkaddr) 737 block_t last_blkaddr, block_t cur_blkaddr)
738{ 738{
739 if (unlikely(sbi->max_io_bytes &&
740 bio->bi_iter.bi_size >= sbi->max_io_bytes))
741 return false;
739 if (last_blkaddr + 1 != cur_blkaddr) 742 if (last_blkaddr + 1 != cur_blkaddr)
740 return false; 743 return false;
741 return __same_bdev(sbi, cur_blkaddr, bio); 744 return __same_bdev(sbi, cur_blkaddr, bio);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 36090cd09011..594df6391390 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1446,6 +1446,7 @@ struct f2fs_sb_info {
1446 loff_t max_file_blocks; /* max block index of file */ 1446 loff_t max_file_blocks; /* max block index of file */
1447 int dir_level; /* directory level */ 1447 int dir_level; /* directory level */
1448 int readdir_ra; /* readahead inode in readdir */ 1448 int readdir_ra; /* readahead inode in readdir */
1449 u64 max_io_bytes; /* max io bytes to merge IOs */
1449 1450
1450 block_t user_block_count; /* # of user blocks */ 1451 block_t user_block_count; /* # of user blocks */
1451 block_t total_valid_block_count; /* # of valid blocks */ 1452 block_t total_valid_block_count; /* # of valid blocks */
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index fce2997382af..989a649cfa8b 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -567,6 +567,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info,
567F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable); 567F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable);
568F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms); 568F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms);
569F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra); 569F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra);
570F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes);
570F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold); 571F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold);
571F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list); 572F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list);
572#ifdef CONFIG_F2FS_FAULT_INJECTION 573#ifdef CONFIG_F2FS_FAULT_INJECTION
@@ -651,6 +652,7 @@ static struct attribute *f2fs_attrs[] = {
651 ATTR_LIST(iostat_enable), 652 ATTR_LIST(iostat_enable),
652 ATTR_LIST(iostat_period_ms), 653 ATTR_LIST(iostat_period_ms),
653 ATTR_LIST(readdir_ra), 654 ATTR_LIST(readdir_ra),
655 ATTR_LIST(max_io_bytes),
654 ATTR_LIST(gc_pin_file_thresh), 656 ATTR_LIST(gc_pin_file_thresh),
655 ATTR_LIST(extension_list), 657 ATTR_LIST(extension_list),
656#ifdef CONFIG_F2FS_FAULT_INJECTION 658#ifdef CONFIG_F2FS_FAULT_INJECTION