You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
4.2 KiB

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