summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorAlexey Obitotskiy <aleksey.obitotskiy@intel.com>2017-05-09 12:25:46 +0200
committerJes Sorensen <jsorensen@fb.com>2017-05-09 20:18:36 +0200
commitfbfdcb06dc5b1dcb227b0394f174faa2df734700 (patch)
treef7c3a01306d65df5eed6b797356704e37824ae94 /util.c
parentimsm: don't allow disks with different sector size in one array (diff)
downloadmdadm-fbfdcb06dc5b1dcb227b0394f174faa2df734700.tar.xz
mdadm-fbfdcb06dc5b1dcb227b0394f174faa2df734700.zip
Allow more spare selection criteria
Disks can be moved across containers in order to be used as a spare drive for reubild. At the moment the only requirement checked for such disk is its size (if it matches donor expectations). In order to introduce more criteria rename corresponding superswitch method to more generic name and move function parameter to a structure. This change is a big edit but it doesn't introduce any changes in code logic, it just updates function naming and parameters. Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util.c b/util.c
index 11ff2ccb..8b3c67dd 100644
--- a/util.c
+++ b/util.c
@@ -2107,7 +2107,7 @@ int experimental(void)
* if spare_group given add it to domains of each spare
* metadata allows to test domains using metadata of destination array */
struct mdinfo *container_choose_spares(struct supertype *st,
- unsigned long long min_size,
+ struct spare_criteria *criteria,
struct domainlist *domlist,
char *spare_group,
const char *metadata, int get_one)
@@ -2131,9 +2131,9 @@ struct mdinfo *container_choose_spares(struct supertype *st,
unsigned long long dev_size;
dev_t dev = makedev(d->disk.major,d->disk.minor);
- if (!min_size ||
+ if (!criteria->min_size ||
(dev_size_from_id(dev, &dev_size) &&
- dev_size >= min_size))
+ dev_size >= criteria->min_size))
found = 1;
/* check if domain matches */
if (found && domlist) {