Add recovery blocked field to mdinfo

When container is assembled while reshape is active on one of its member
whole container can be required to be blocked from monitoring.
For such purpose field recovery blocked is added to mdinfo structure.

When metadata handler finds active reshape in container it should set
recovery_blocked field to disable whole container monitoring during
reshape.

For arrays that doesn't use containers, recovery_blocked field
has the same value as reshape_active field e.g. super0/1.
In fact,recovery is blocked during reshape for such arrays.
For ddf, metadata handler doesn't set reshape_active field,
so recovery_blocked is not set also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Adam Kwolek 2011-10-05 13:30:50 +11:00 committed by NeilBrown
parent cc7f63e553
commit 6e75048bc5
5 changed files with 14 additions and 1 deletions

View File

@ -1527,7 +1527,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
if (sysfs_set_array(content, md_get_version(mdfd)) != 0)
return 1;
if (content->reshape_active)
if (st->ss->external && content->recovery_blocked)
block_subarray(content);
if (sra)

View File

@ -196,6 +196,13 @@ struct mdinfo {
*/
int reshape_active;
unsigned long long reshape_progress;
int recovery_blocked; /* for external metadata it
* indicates that there is
* reshape in progress in
* container,
* for native metadata it is
* reshape_active field mirror
*/
union {
unsigned long long resync_start; /* per-array resync position */
unsigned long long recovery_start; /* per-device rebuild position */

View File

@ -1374,6 +1374,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m
info->recovery_start = MaxSector;
info->reshape_active = 0;
info->recovery_blocked = 0;
info->name[0] = 0;
info->array.major_version = -1;
@ -1449,6 +1450,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
info->recovery_start = MaxSector;
info->resync_start = 0;
info->reshape_active = 0;
info->recovery_blocked = 0;
if (!(ddf->virt->entries[info->container_member].state
& DDF_state_inconsistent) &&
(ddf->virt->entries[info->container_member].init_state

View File

@ -387,6 +387,8 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map)
} else
info->reshape_active = 0;
info->recovery_blocked = info->reshape_active;
sprintf(info->name, "%d", sb->md_minor);
/* work_disks is calculated rather than read directly */
for (i=0; i < MD_SB_DISKS; i++)

View File

@ -626,6 +626,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
} else
info->reshape_active = 0;
info->recovery_blocked = info->reshape_active;
if (map)
for (i=0; i<map_disks; i++)
map[i] = 0;