summaryrefslogtreecommitdiff
path: root/policy.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 20:58:06 +1100
committerNeilBrown <neilb@suse.de>2010-11-22 20:58:06 +1100
commitd2db30455891a97ac0ac17bb64848de52bfb1566 (patch)
treedfb02e2a2edd5384c20f534aafc24e257e9eb458 /policy.c
parent625b25071bb6db4d1c019d5bab0344d82d5ae4c4 (diff)
downloadmdadm-d2db30455891a97ac0ac17bb64848de52bfb1566.tar.gz
Add action=spare-same-slot policy.
When "mdadm -I" is given a device with no metadata, mdadm tries to add it as a 'spare' somewhere based on policy. This patch changes the behaviour in two ways: 1/ If the device is at a 'path' where a previous device was removed from an array or container, then we preferentially add the spare to that array or container. 2/ Previously only 'bare' devices were considered for adding as spares. Now if action=spare-same-slot is active, we will add non-bare devices, but *only* if the path was previously in use for some array, and the device will only be added to that array. Based on code From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'policy.c')
-rw-r--r--policy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/policy.c b/policy.c
index 28751fb..cc12694 100644
--- a/policy.c
+++ b/policy.c
@@ -519,6 +519,8 @@ static enum policy_action map_act(char *act)
return act_re_add;
if (strcmp(act, "spare") == 0)
return act_spare;
+ if (strcmp(act, "spare-same-slot") == 0)
+ return act_spare_same_slot;
if (strcmp(act, "force-spare") == 0)
return act_force_spare;
return act_err;