|
|
2c1b57 |
From b75805662e7208799207a8e5f8a61f69a44888f0 Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
|
2c1b57 |
Date: Mon, 24 Apr 2017 16:03:26 +0200
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 094/169] Don't use UnSet with consistency_policy
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Use CONSISTENCY_POLICY_UNKNOWN instead. Simplify some checks because
|
|
|
2c1b57 |
since 5e8e35fb7e17 ("maps: Use keyvalue for null terminator to indicate
|
|
|
2c1b57 |
'unset' value") map_name() can return this default directly.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Suggested-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
|
2c1b57 |
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
maps.c | 2 +-
|
|
|
2c1b57 |
mdadm.c | 12 ++++++------
|
|
|
2c1b57 |
super-intel.c | 4 +---
|
|
|
2c1b57 |
sysfs.c | 10 ++++------
|
|
|
2c1b57 |
4 files changed, 12 insertions(+), 16 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/maps.c b/maps.c
|
|
|
2c1b57 |
index bb28ba6..02a0474 100644
|
|
|
2c1b57 |
--- a/maps.c
|
|
|
2c1b57 |
+++ b/maps.c
|
|
|
2c1b57 |
@@ -137,7 +137,7 @@ mapping_t consistency_policies[] = {
|
|
|
2c1b57 |
{ "bitmap", CONSISTENCY_POLICY_BITMAP},
|
|
|
2c1b57 |
{ "journal", CONSISTENCY_POLICY_JOURNAL},
|
|
|
2c1b57 |
{ "ppl", CONSISTENCY_POLICY_PPL},
|
|
|
2c1b57 |
- { NULL, UnSet }
|
|
|
2c1b57 |
+ { NULL, CONSISTENCY_POLICY_UNKNOWN }
|
|
|
2c1b57 |
};
|
|
|
2c1b57 |
|
|
|
2c1b57 |
mapping_t sysfs_array_states[] = {
|
|
|
2c1b57 |
diff --git a/mdadm.c b/mdadm.c
|
|
|
2c1b57 |
index 41dae1d..b689e32 100644
|
|
|
2c1b57 |
--- a/mdadm.c
|
|
|
2c1b57 |
+++ b/mdadm.c
|
|
|
2c1b57 |
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
|
|
2c1b57 |
.level = UnSet,
|
|
|
2c1b57 |
.layout = UnSet,
|
|
|
2c1b57 |
.bitmap_chunk = UnSet,
|
|
|
2c1b57 |
- .consistency_policy = UnSet,
|
|
|
2c1b57 |
+ .consistency_policy = CONSISTENCY_POLICY_UNKNOWN,
|
|
|
2c1b57 |
};
|
|
|
2c1b57 |
|
|
|
2c1b57 |
char sys_hostname[256];
|
|
|
2c1b57 |
@@ -1228,8 +1228,7 @@ int main(int argc, char *argv[])
|
|
|
2c1b57 |
case O(GROW, 'k'):
|
|
|
2c1b57 |
s.consistency_policy = map_name(consistency_policies,
|
|
|
2c1b57 |
optarg);
|
|
|
2c1b57 |
- if (s.consistency_policy == UnSet ||
|
|
|
2c1b57 |
- s.consistency_policy < CONSISTENCY_POLICY_RESYNC) {
|
|
|
2c1b57 |
+ if (s.consistency_policy < CONSISTENCY_POLICY_RESYNC) {
|
|
|
2c1b57 |
pr_err("Invalid consistency policy: %s\n",
|
|
|
2c1b57 |
optarg);
|
|
|
2c1b57 |
exit(2);
|
|
|
2c1b57 |
@@ -1267,7 +1266,7 @@ int main(int argc, char *argv[])
|
|
|
2c1b57 |
pr_err("--write-journal is only supported for RAID level 4/5/6.\n");
|
|
|
2c1b57 |
exit(2);
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
- if (s.consistency_policy != UnSet &&
|
|
|
2c1b57 |
+ if (s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN &&
|
|
|
2c1b57 |
s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) {
|
|
|
2c1b57 |
pr_err("--write-journal is not supported with consistency policy: %s\n",
|
|
|
2c1b57 |
map_num(consistency_policies, s.consistency_policy));
|
|
|
2c1b57 |
@@ -1275,7 +1274,8 @@ int main(int argc, char *argv[])
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
- if (mode == CREATE && s.consistency_policy != UnSet) {
|
|
|
2c1b57 |
+ if (mode == CREATE &&
|
|
|
2c1b57 |
+ s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN) {
|
|
|
2c1b57 |
if (s.level <= 0) {
|
|
|
2c1b57 |
pr_err("--consistency-policy not meaningful with level %s.\n",
|
|
|
2c1b57 |
map_num(pers, s.level));
|
|
|
2c1b57 |
@@ -1687,7 +1687,7 @@ int main(int argc, char *argv[])
|
|
|
2c1b57 |
rv = Grow_reshape(devlist->devname, mdfd,
|
|
|
2c1b57 |
devlist->next,
|
|
|
2c1b57 |
data_offset, &c, &s);
|
|
|
2c1b57 |
- } else if (s.consistency_policy != UnSet) {
|
|
|
2c1b57 |
+ } else if (s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN) {
|
|
|
2c1b57 |
rv = Grow_consistency_policy(devlist->devname, mdfd, &c, &s);
|
|
|
2c1b57 |
} else if (array_size == 0)
|
|
|
2c1b57 |
pr_err("no changes to --grow\n");
|
|
|
2c1b57 |
diff --git a/super-intel.c b/super-intel.c
|
|
|
2c1b57 |
index 0aed57c..fbff215 100644
|
|
|
2c1b57 |
--- a/super-intel.c
|
|
|
2c1b57 |
+++ b/super-intel.c
|
|
|
2c1b57 |
@@ -5369,9 +5369,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
mpb->num_raid_devs++;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
- if (s->consistency_policy == UnSet ||
|
|
|
2c1b57 |
- s->consistency_policy == CONSISTENCY_POLICY_RESYNC ||
|
|
|
2c1b57 |
- s->consistency_policy == CONSISTENCY_POLICY_NONE) {
|
|
|
2c1b57 |
+ if (s->consistency_policy <= CONSISTENCY_POLICY_RESYNC) {
|
|
|
2c1b57 |
dev->rwh_policy = RWH_OFF;
|
|
|
2c1b57 |
} else if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
|
2c1b57 |
dev->rwh_policy = RWH_DISTRIBUTED;
|
|
|
2c1b57 |
diff --git a/sysfs.c b/sysfs.c
|
|
|
2c1b57 |
index 712f8b3..aa30de5 100644
|
|
|
2c1b57 |
--- a/sysfs.c
|
|
|
2c1b57 |
+++ b/sysfs.c
|
|
|
2c1b57 |
@@ -254,13 +254,11 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
if (options & GET_CONSISTENCY_POLICY) {
|
|
|
2c1b57 |
strcpy(base, "consistency_policy");
|
|
|
2c1b57 |
- if (load_sys(fname, buf, sizeof(buf))) {
|
|
|
2c1b57 |
+ if (load_sys(fname, buf, sizeof(buf)))
|
|
|
2c1b57 |
sra->consistency_policy = CONSISTENCY_POLICY_UNKNOWN;
|
|
|
2c1b57 |
- } else {
|
|
|
2c1b57 |
- sra->consistency_policy = map_name(consistency_policies, buf);
|
|
|
2c1b57 |
- if (sra->consistency_policy == UnSet)
|
|
|
2c1b57 |
- sra->consistency_policy = CONSISTENCY_POLICY_UNKNOWN;
|
|
|
2c1b57 |
- }
|
|
|
2c1b57 |
+ else
|
|
|
2c1b57 |
+ sra->consistency_policy = map_name(consistency_policies,
|
|
|
2c1b57 |
+ buf);
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
if (! (options & GET_DEVS))
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|