From: Gioh Kim <gi-oh.kim@profitbricks.com>
To: jes.sorensen@gmail.com
Cc: neilb@suse.com, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org,
Gioh Kim <gi-oh.kim@profitbricks.com>
Subject: [PATCH 1/2] super1: replace hard-coded values with bit definitions
Date: Wed, 29 Mar 2017 11:40:33 +0200 [thread overview]
Message-ID: <1490780434-8720-1-git-send-email-gi-oh.kim@profitbricks.com> (raw)
Some hard-coded values for disk status are replaced
with bit definitions.
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
---
super1.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/super1.c b/super1.c
index f3520ac..e8b9f61 100644
--- a/super1.c
+++ b/super1.c
@@ -1010,7 +1010,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->disk.state = 0; /* spare: not active, not sync, not faulty */
break;
case MD_DISK_ROLE_FAULTY:
- info->disk.state = 1; /* faulty */
+ info->disk.state = (1 << MD_DISK_FAULTY); /* faulty */
break;
case MD_DISK_ROLE_JOURNAL:
info->disk.state = (1 << MD_DISK_JOURNAL);
@@ -1503,11 +1503,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
}
dk_state = dk->state & ~(1<<MD_DISK_FAILFAST);
- if ((dk_state & 6) == 6) /* active, sync */
+ if ((dk_state & (1<<MD_DISK_ACTIVE)) &&
+ (dk_state & (1<<MD_DISK_SYNC)))/* active, sync */
*rp = __cpu_to_le16(dk->raid_disk);
else if (dk_state & (1<<MD_DISK_JOURNAL))
*rp = MD_DISK_ROLE_JOURNAL;
- else if ((dk_state & ~2) == 0) /* active or idle -> spare */
+ else if ((dk_state & ~(1<<MD_DISK_ACTIVE)) == 0) /* active or idle -> spare */
*rp = MD_DISK_ROLE_SPARE;
else
*rp = MD_DISK_ROLE_FAULTY;
--
2.5.0
next reply other threads:[~2017-03-29 9:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 9:40 Gioh Kim [this message]
2017-03-29 9:40 ` [PATCH 2/2] mdadm.c: fix compile error "switch condition has boolean value" Gioh Kim
2017-03-29 15:47 ` jes.sorensen
2017-03-29 15:50 ` Gioh Kim
2017-03-29 21:38 ` NeilBrown
2017-03-30 7:52 ` Gioh Kim
2017-03-30 15:53 ` Jes Sorensen
2017-03-29 15:41 ` [PATCH 1/2] super1: replace hard-coded values with bit definitions jes.sorensen
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=1490780434-8720-1-git-send-email-gi-oh.kim@profitbricks.com \
--to=gi-oh.kim@profitbricks.com \
--cc=jes.sorensen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
/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
Powered by JetHome