diff options
author | Lukas Czerner <lczerner@redhat.com> | 2011-05-20 13:55:16 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-05-20 13:55:16 -0400 |
commit | 51ce65115642b77040f5582b8d2fc8815ac450f9 (patch) | |
tree | 53e42bb73ccbca4251d46ec5705a40a6b61bc5ab /fs/ext4/super.c | |
parent | e1290b3e62c496ade19939ce036f35bb69306820 (diff) |
ext4: fix the mount option "init_itable=n" to work as expected for n=0
For some reason, when we set the mount option "init_itable=0" it
behaves as we would set init_itable=20 which is not right at all.
Basically when we set it to zero we are saying to lazyinit thread not
to wait between zeroing the inode table (except of cond_resched()) so
this commit fixes that and removes the unnecessary condition. The 'n'
should be also properly used on remount.
When the n is not set at all, it means that the default miltiplier
EXT4_DEF_LI_WAIT_MULT is set instead.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d7756bd2dc12..fd51a4a266b6 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1112,7 +1112,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
1112 | 1112 | ||
1113 | if (!test_opt(sb, INIT_INODE_TABLE)) | 1113 | if (!test_opt(sb, INIT_INODE_TABLE)) |
1114 | seq_puts(seq, ",noinit_inode_table"); | 1114 | seq_puts(seq, ",noinit_inode_table"); |
1115 | else if (sbi->s_li_wait_mult) | 1115 | else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) |
1116 | seq_printf(seq, ",init_inode_table=%u", | 1116 | seq_printf(seq, ",init_inode_table=%u", |
1117 | (unsigned) sbi->s_li_wait_mult); | 1117 | (unsigned) sbi->s_li_wait_mult); |
1118 | 1118 | ||
@@ -2704,11 +2704,8 @@ static int ext4_run_li_request(struct ext4_li_request *elr) | |||
2704 | ret = ext4_init_inode_table(sb, group, | 2704 | ret = ext4_init_inode_table(sb, group, |
2705 | elr->lr_timeout ? 0 : 1); | 2705 | elr->lr_timeout ? 0 : 1); |
2706 | if (elr->lr_timeout == 0) { | 2706 | if (elr->lr_timeout == 0) { |
2707 | timeout = jiffies - timeout; | 2707 | timeout = (jiffies - timeout) * |
2708 | if (elr->lr_sbi->s_li_wait_mult) | 2708 | elr->lr_sbi->s_li_wait_mult; |
2709 | timeout *= elr->lr_sbi->s_li_wait_mult; | ||
2710 | else | ||
2711 | timeout *= 20; | ||
2712 | elr->lr_timeout = timeout; | 2709 | elr->lr_timeout = timeout; |
2713 | } | 2710 | } |
2714 | elr->lr_next_sched = jiffies + elr->lr_timeout; | 2711 | elr->lr_next_sched = jiffies + elr->lr_timeout; |
@@ -2945,8 +2942,14 @@ static int ext4_register_li_request(struct super_block *sb, | |||
2945 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; | 2942 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
2946 | int ret = 0; | 2943 | int ret = 0; |
2947 | 2944 | ||
2948 | if (sbi->s_li_request != NULL) | 2945 | if (sbi->s_li_request != NULL) { |
2946 | /* | ||
2947 | * Reset timeout so it can be computed again, because | ||
2948 | * s_li_wait_mult might have changed. | ||
2949 | */ | ||
2950 | sbi->s_li_request->lr_timeout = 0; | ||
2949 | return 0; | 2951 | return 0; |
2952 | } | ||
2950 | 2953 | ||
2951 | if (first_not_zeroed == ngroups || | 2954 | if (first_not_zeroed == ngroups || |
2952 | (sb->s_flags & MS_RDONLY) || | 2955 | (sb->s_flags & MS_RDONLY) || |
@@ -3144,6 +3147,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3144 | ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0)) | 3147 | ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0)) |
3145 | set_opt(sb, DELALLOC); | 3148 | set_opt(sb, DELALLOC); |
3146 | 3149 | ||
3150 | /* | ||
3151 | * set default s_li_wait_mult for lazyinit, for the case there is | ||
3152 | * no mount option specified. | ||
3153 | */ | ||
3154 | sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT; | ||
3155 | |||
3147 | if (!parse_options((char *) sbi->s_es->s_mount_opts, sb, | 3156 | if (!parse_options((char *) sbi->s_es->s_mount_opts, sb, |
3148 | &journal_devnum, &journal_ioprio, NULL, 0)) { | 3157 | &journal_devnum, &journal_ioprio, NULL, 0)) { |
3149 | ext4_msg(sb, KERN_WARNING, | 3158 | ext4_msg(sb, KERN_WARNING, |