diff options
author | NeilBrown <neilb@suse.de> | 2009-04-14 02:19:02 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-04-14 02:19:02 +0200 |
commit | 462906cdeebc07875a4c8653c86ca02c09280f78 (patch) | |
tree | 5af5fdb38d3863f9ca595806d849b68725d7d02b /sysfs.c | |
parent | mdadm udev rules change (diff) | |
download | mdadm-462906cdeebc07875a4c8653c86ca02c09280f78.tar.xz mdadm-462906cdeebc07875a4c8653c86ca02c09280f78.zip |
incremental_container: preserve 'in_sync' flag when adding to existing array.
When building container members with -IR, we need to ensure that
devices added to an active array preserve the 'in_sync' status so they
don't needlessly get rebuilt.
So allow sysfs_add_disk to do this (only works in kernels since
2.6.30) and pass the relevant flag down.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -530,7 +530,7 @@ int sysfs_set_array(struct mdinfo *info, int vers) return rv; } -int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd) +int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int in_sync) { char dv[100]; char nm[100]; @@ -556,8 +556,12 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd) rv = sysfs_set_num(sra, sd, "offset", sd->data_offset); rv |= sysfs_set_num(sra, sd, "size", (sd->component_size+1) / 2); if (sra->array.level != LEVEL_CONTAINER) { + if (in_sync) + /* This can correctly fail if array isn't started, + * yet, so just ignore status for now. + */ + sysfs_set_str(sra, sd, "state", "in_sync"); rv |= sysfs_set_num(sra, sd, "slot", sd->disk.raid_disk); -// rv |= sysfs_set_str(sra, sd, "state", "in_sync"); } return rv; } |