aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorZheng Liu <wenqing.lz@taobao.com>2012-08-17 09:54:17 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-08-17 09:54:17 -0400
commit67a5da564f97f31c4054d358e00b34d7ee570da5 (patch)
tree525f256d46cfac4be0b0acd90cc2bad5fcdb1b77 /fs/ext4/super.c
parent81370291722ac1e0ec95234a0ea91a5bc76b6185 (diff)
ext4: make the zero-out chunk size tunable
Currently in ext4 the length of zero-out chunk is set to 7 file system blocks. But if an inode has uninitailized extents from using fallocate to preallocate space, and the workload issues many random writes, this can cause a fragmented extent tree that will unnecessarily grow the extent tree. So create a new sysfs tunable, extent_max_zeroout_kb, which controls the maximum size where blocks will be zeroed out instead of creating a new uninitialized extent. The default of this has been sent to 32kb. CC: Zach Brown <zab@zabbo.net> CC: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5a97e590692d..0423e2e7f615 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2541,6 +2541,7 @@ EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
2541EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request); 2541EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
2542EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc); 2542EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
2543EXT4_RW_ATTR_SBI_UI(max_writeback_mb_bump, s_max_writeback_mb_bump); 2543EXT4_RW_ATTR_SBI_UI(max_writeback_mb_bump, s_max_writeback_mb_bump);
2544EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
2544EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error); 2545EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error);
2545 2546
2546static struct attribute *ext4_attrs[] = { 2547static struct attribute *ext4_attrs[] = {
@@ -2556,6 +2557,7 @@ static struct attribute *ext4_attrs[] = {
2556 ATTR_LIST(mb_stream_req), 2557 ATTR_LIST(mb_stream_req),
2557 ATTR_LIST(mb_group_prealloc), 2558 ATTR_LIST(mb_group_prealloc),
2558 ATTR_LIST(max_writeback_mb_bump), 2559 ATTR_LIST(max_writeback_mb_bump),
2560 ATTR_LIST(extent_max_zeroout_kb),
2559 ATTR_LIST(trigger_fs_error), 2561 ATTR_LIST(trigger_fs_error),
2560 NULL, 2562 NULL,
2561}; 2563};
@@ -3756,6 +3758,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3756 3758
3757 sbi->s_stripe = ext4_get_stripe_size(sbi); 3759 sbi->s_stripe = ext4_get_stripe_size(sbi);
3758 sbi->s_max_writeback_mb_bump = 128; 3760 sbi->s_max_writeback_mb_bump = 128;
3761 sbi->s_extent_max_zeroout_kb = 32;
3759 3762
3760 /* 3763 /*
3761 * set up enough so that it can read an inode 3764 * set up enough so that it can read an inode