From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, sandeen@redhat.com, Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 3/4] ext4: fix init_itable=n to work as expected for n=0
Date: Mon, 9 May 2011 17:57:09 +0200 [thread overview]
Message-ID: <1304956630-20384-3-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1304956630-20384-1-git-send-email-lczerner@redhat.com>
For some reason, when we set 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>
Reported-by: Eric Sandeen <sandeen@redhat.com>
---
fs/ext4/super.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6ccf0e2..c379af6 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2690,11 +2690,8 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
ret = ext4_init_inode_table(sb, group,
elr->lr_timeout ? 0 : 1);
if (elr->lr_timeout == 0) {
- timeout = jiffies - timeout;
- if (elr->lr_sbi->s_li_wait_mult)
- timeout *= elr->lr_sbi->s_li_wait_mult;
- else
- timeout *= 20;
+ timeout = (jiffies - timeout) *
+ elr->lr_sbi->s_li_wait_mult;
elr->lr_timeout = timeout;
}
elr->lr_next_sched = jiffies + elr->lr_timeout;
@@ -2931,8 +2928,14 @@ static int ext4_register_li_request(struct super_block *sb,
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
int ret = 0;
- if (sbi->s_li_request != NULL)
+ if (sbi->s_li_request != NULL) {
+ /*
+ * Reset timeout so it can be computed again, because
+ * s_li_wait_mult might have changed.
+ */
+ sbi->s_li_request->lr_timeout = 0;
return 0;
+ }
if (first_not_zeroed == ngroups ||
(sb->s_flags & MS_RDONLY) ||
@@ -3137,6 +3140,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))
set_opt(sb, DELALLOC);
+ /*
+ * set default s_li_wait_mult for lazyinit, for the case there is
+ * no mount option specified.
+ */
+ sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;
+
if (!parse_options((char *) sbi->s_es->s_mount_opts, sb,
&journal_devnum, &journal_ioprio, NULL, 0)) {
ext4_msg(sb, KERN_WARNING,
--
1.7.4.4
next prev parent reply other threads:[~2011-05-09 15:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-09 15:57 [PATCH 1/4 v2] ext4: Use schedule_timeout_interruptible() for waiting in lazyinit thread Lukas Czerner
2011-05-09 15:57 ` [PATCH 2/4 v2] ext4: Remove unnecessary wait_event ext4_run_lazyinit_thread() Lukas Czerner
2011-05-19 19:37 ` Eric Sandeen
2011-05-20 9:09 ` Lukas Czerner
2011-05-09 15:57 ` Lukas Czerner [this message]
2011-05-19 19:59 ` [PATCH 3/4] ext4: fix init_itable=n to work as expected for n=0 Eric Sandeen
2011-05-20 9:21 ` Lukas Czerner
2011-05-09 15:57 ` [PATCH 4/4] ext4: fix possible use-after-free ext4_remove_li_request() Lukas Czerner
2011-05-19 20:05 ` Eric Sandeen
2011-05-20 9:27 ` Lukas Czerner
2011-05-20 16:03 ` Ted Ts'o
2011-05-20 16:12 ` Eric Sandeen
2011-05-20 17:47 ` Ted Ts'o
2011-05-20 17:49 ` Eric Sandeen
2011-05-20 16:16 ` Lukas Czerner
2011-05-20 17:39 ` Ted Ts'o
2011-05-20 17:42 ` Ted Ts'o
2011-05-19 19:30 ` [PATCH 1/4 v2] ext4: Use schedule_timeout_interruptible() for waiting in lazyinit thread Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304956630-20384-3-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).