|
|
2c1b57 |
From aa3131183661955de112fa7d9824207de63d9fa5 Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Gioh Kim <gi-oh.kim@profitbricks.com>
|
|
|
2c1b57 |
Date: Wed, 29 Mar 2017 11:40:33 +0200
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 032/169] super1: replace hard-coded values with
|
|
|
2c1b57 |
bit definitions
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Some hard-coded values for disk status are replaced
|
|
|
2c1b57 |
with bit definitions.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
super1.c | 7 ++++---
|
|
|
2c1b57 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/super1.c b/super1.c
|
|
|
2c1b57 |
index e76f777..6f91611 100644
|
|
|
2c1b57 |
--- a/super1.c
|
|
|
2c1b57 |
+++ b/super1.c
|
|
|
2c1b57 |
@@ -1040,7 +1040,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
|
2c1b57 |
info->disk.state = 0; /* spare: not active, not sync, not faulty */
|
|
|
2c1b57 |
break;
|
|
|
2c1b57 |
case MD_DISK_ROLE_FAULTY:
|
|
|
2c1b57 |
- info->disk.state = 1; /* faulty */
|
|
|
2c1b57 |
+ info->disk.state = (1 << MD_DISK_FAULTY); /* faulty */
|
|
|
2c1b57 |
break;
|
|
|
2c1b57 |
case MD_DISK_ROLE_JOURNAL:
|
|
|
2c1b57 |
info->disk.state = (1 << MD_DISK_JOURNAL);
|
|
|
2c1b57 |
@@ -1600,11 +1600,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
dk_state = dk->state & ~(1<
|
|
|
2c1b57 |
- if ((dk_state & 6) == 6) /* active, sync */
|
|
|
2c1b57 |
+ if ((dk_state & (1<
|
|
|
2c1b57 |
+ (dk_state & (1<
|
|
|
2c1b57 |
*rp = __cpu_to_le16(dk->raid_disk);
|
|
|
2c1b57 |
else if (dk_state & (1<
|
|
|
2c1b57 |
*rp = MD_DISK_ROLE_JOURNAL;
|
|
|
2c1b57 |
- else if ((dk_state & ~2) == 0) /* active or idle -> spare */
|
|
|
2c1b57 |
+ else if ((dk_state & ~(1<<MD_DISK_ACTIVE)) == 0) /* active or idle -> spare */
|
|
|
2c1b57 |
*rp = MD_DISK_ROLE_SPARE;
|
|
|
2c1b57 |
else
|
|
|
2c1b57 |
*rp = MD_DISK_ROLE_FAULTY;
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|