From: "Jianpeng Ma" <majianpeng@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: raid5: When add stripe_head to inactive_list, it should remove hash.
Date: Sat, 18 Aug 2012 10:53:36 +0800 [thread overview]
Message-ID: <201208181053324376710@gmail.com> (raw)
If it released stripe_head to inactive_list and soon get it from hash
list. So the stripe_head didn't call init_stripe, the dev.flags isn't
clear. So the debug info is error which printed the before info.
Although, i can't find logic error because this.I think it should be
correct.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
drivers/md/raid5.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index adda94d..03d2f64 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -196,6 +196,24 @@ static int stripe_operations_active(struct stripe_head *sh)
test_bit(STRIPE_COMPUTE_RUN, &sh->state);
}
+static inline void remove_hash(struct stripe_head *sh)
+{
+ pr_debug("remove_hash(), stripe %llu\n",
+ (unsigned long long)sh->sector);
+
+ hlist_del_init(&sh->hash);
+}
+
+static inline void insert_hash(struct r5conf *conf, struct stripe_head *sh)
+{
+ struct hlist_head *hp = stripe_hash(conf, sh->sector);
+
+ pr_debug("insert_hash(), stripe %llu\n",
+ (unsigned long long)sh->sector);
+
+ hlist_add_head(&sh->hash, hp);
+}
+
static void do_release_stripe(struct r5conf *conf, struct stripe_head *sh)
{
BUG_ON(!list_empty(&sh->lru));
@@ -222,6 +240,7 @@ static void do_release_stripe(struct r5conf *conf, struct stripe_head *sh)
atomic_dec(&conf->active_stripes);
if (!test_bit(STRIPE_EXPANDING, &sh->state)) {
list_add_tail(&sh->lru, &conf->inactive_list);
+ remove_hash(sh);
wake_up(&conf->wait_for_stripe);
if (conf->retry_read_aligned)
md_wakeup_thread(conf->mddev->thread);
@@ -248,23 +267,7 @@ static void release_stripe(struct stripe_head *sh)
local_irq_restore(flags);
}
-static inline void remove_hash(struct stripe_head *sh)
-{
- pr_debug("remove_hash(), stripe %llu\n",
- (unsigned long long)sh->sector);
- hlist_del_init(&sh->hash);
-}
-
-static inline void insert_hash(struct r5conf *conf, struct stripe_head *sh)
-{
- struct hlist_head *hp = stripe_hash(conf, sh->sector);
-
- pr_debug("insert_hash(), stripe %llu\n",
- (unsigned long long)sh->sector);
-
- hlist_add_head(&sh->hash, hp);
-}
/* find an idle stripe, make sure it is unhashed, and return it. */
--
1.7.9.5
\x02
next reply other threads:[~2012-08-18 2:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-18 2:53 Jianpeng Ma [this message]
2012-08-20 8:17 ` raid5: When add stripe_head to inactive_list, it should remove hash Jianpeng Ma
2012-08-20 17:51 ` Dan Williams
2012-08-21 3:14 ` Jianpeng Ma
2012-08-21 16:43 ` Dan Williams
2012-08-22 1:25 ` kedacomkernel
2012-08-22 5:30 ` Jiang, Dave
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=201208181053324376710@gmail.com \
--to=majianpeng@gmail.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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).