From: Adam Kwolek <hidden> Date: 2011-01-04 14:34:38
This patch series implements Online Capacity Expansion (OLCE) feature in mdadm devel3.2. for Raid5 and Raid0.
This is implemented as reshape of whole container (all arrays that belongs to container are reshaped).
Raid0 reshape is implemented using takeover to raid4 transition.
---
Adam Kwolek (31):
Raid0: detect reshape on array start
Raid0: Reload disk list on 'next' raid0 array
Raid0: Run 'next' reshapes without meta update
imsm: FIX: do not repair raid4 arrays
Raid0: execute backward takeover
Detect level change
Take in mind takeover during disk add
imsm: Update raid0 metadata for reshape
imsm: Move reshape update processing to function
Add spares to raid0 in mdadm
imsm: Update metadata for second array
Set array size after adding new disks
imsm: update array size information in metadata
FIX: Initialize subarray variable in reshape_array
imsm: FIX: Division by 0
imsm: Finalize reshape in metadata
Finalize reshape after adding disks to array
imsm: FIX: Fill sys_name in container_content()
FIX: Use sysfs to change array parameters
FIX: added disks are not used by reshape process /md/
FIX: change adding disks criteria
FIX: Get array information in reshape_array()
imsm: FIX: support general migration by getinfo_super_imsm_volume
FIX: Arrays cannot be opened exclusively
imsm: FIX: update first array in container only
FIX: get updated information from metadata
imsm: FIX: Do not update anchor directly
imsm: FIX: Perform first metadata update for container operation
imsm: FIX: display error message
imsm: FIX: display correct information for '-E' option
mdadm: second_map enhancement for imsm_get_map()
Krzysztof Wojcik (3):
FIX: Position calculation in mdstat_by_subdev
FIX: Change size condition in imsm_reshape_is_allowed_on_container
Manage reshape process in manage_reshape vector.
Grow.c | 174 ++++++++++++------
Manage.c | 13 -
managemon.c | 12 +
mdstat.c | 4
monitor.c | 20 ++
super-intel.c | 561 ++++++++++++++++++++++++++++++++++++++++++---------------
6 files changed, 576 insertions(+), 208 deletions(-)
--
Signature
From: Adam Kwolek <hidden> Date: 2011-01-04 14:35:26
From: Krzysztof Wojcik <redacted>
The manage_reshape vector is intended to be be used as
reshape process supervisor for external metadata types.
This patch introduces dummy function and necessary definitions.
Signed-off-by: Krzysztof Wojcik <redacted>
---
Grow.c | 7 ++++---
super-intel.c | 12 ++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
@@ -1941,9 +1941,10 @@ static int reshape_array(char *container, int fd, char *devname,if(st->ss->external){/* metadata handler takes it from here */ping_manager(container);-st->ss->manage_reshape(st,backup_file);-frozen=0;-gotorelease;+if(st->ss->manage_reshape(st,backup_file)!=1){+frozen=0;+gotorelease;+}}/* set up the backup-super-block. This requires the
@@ -6432,6 +6432,17 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,returnret_val;}+/* function: manage_reshape_imsm+*Parameters:supertypestructure,backupfile+*Returms:0onsuccess,+*-1iffailed,+*1-managementofprocessnotsupported+*/+intmanage_reshape_imsm(structsupertype*st,char*backup)+{+return1;+}+structsuperswitchsuper_imsm={#ifndef MDASSEMBLE.examine_super=examine_super_imsm,
From: Adam Kwolek <hidden> Date: 2011-01-04 14:35:54
From: Krzysztof Wojcik <redacted>
Size has to be "0" when imsm_reshape_is_allowed_on_container
function is called.
Signed-off-by: Krzysztof Wojcik <redacted>
---
super-intel.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:10
Allow map related operations for the given map: first of second.
For reshape specific functionality it is required to have an access
Until now, the active map was chosen according to the current volume status.
Signed-off-by: Maciej Trela <redacted>
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 70 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 41 insertions(+), 29 deletions(-)
@@ -3367,7 +3379,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,/* Check the device has not already been added */slot=get_imsm_disk_slot(map,dl->index);if(slot>=0&&-(get_imsm_ord_tbl_ent(dev,slot)&IMSM_ORD_REBUILD)==0){+(get_imsm_ord_tbl_ent(dev,slot,-1)&IMSM_ORD_REBUILD)==0){fprintf(stderr,Name": %s has been included in this array twice\n",devname);return1;
@@ -3651,7 +3663,7 @@ static int create_array(struct supertype *st, int dev_idx)imsm_copy_dev(&u->dev,dev);inf=get_disk_info(u);for(i=0;i<map->num_members;i++){-intidx=get_imsm_disk_idx(dev,i);+intidx=get_imsm_disk_idx(dev,i,-1);disk=get_imsm_disk(super,idx);serialcpy(inf[i].serial,disk->serial);
@@ -4855,7 +4867,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)dev->vol.migr_type=0;dev->vol.curr_migr_unit=0;-used_disks=imsm_num_data_members(dev);+used_disks=imsm_num_data_members(dev,-1);array_blocks=map->blocks_per_member*used_disks;/* round array size down to closest MB */array_blocks=(array_blocks>>SECT_PER_MB_SHIFT)
@@ -4965,7 +4977,7 @@ static void imsm_set_disk(struct active_array *a, int n, int state)dprintf("imsm: set_disk %d:%x\n",n,state);-ord=get_imsm_ord_tbl_ent(dev,n);+ord=get_imsm_ord_tbl_ent(dev,n,-1);disk=get_imsm_disk(super,ord_to_idx(ord));/* check for new failures */
@@ -5222,7 +5234,7 @@ static int imsm_rebuild_allowed(struct supertype *cont, int dev_idx, int failed)*Checkiffaileddisksaredeletedfromintel*disklistoraremarkedtobedeleted*/-idx=get_imsm_disk_idx(dev2,slot);+idx=get_imsm_disk_idx(dev2,slot,-1);idisk=get_imsm_dl_disk(cont->sb,idx);/**Donotrebuildthearrayiffaileddisks
@@ -5426,7 +5438,7 @@ static int disks_overlap(struct intel_super *super, int idx, struct imsm_update_intj;for(i=0;i<map->num_members;i++){-disk=get_imsm_disk(super,get_imsm_disk_idx(dev,i));+disk=get_imsm_disk(super,get_imsm_disk_idx(dev,i,-1));for(j=0;j<new_map->num_members;j++)if(serialcmp(disk->serial,inf[j].serial)==0)return1;
@@ -5567,7 +5579,6 @@ static void imsm_process_update(struct supertype *st,/* enable spares to use in array */for(i=0;i<delta_disks;i++){-new_disk=get_disk_super(super,major(u->new_disks[i]),minor(u->new_disks[i]));
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:18
Correct information displayed by '-E' option.
1. FIX: Slot information during raid0 migration is displayed incorrectly
(missing disk position is taken from wrong map)
2. Improvement: information about (level, members, chunk size) migration is displayed.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:25
When container operation is not allowed user has to get proper information on console about it
Currently this information was displayed as debug info only.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -6455,7 +6455,7 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,dprintf("imsm: Cannot prepare "\"update\n");}else-dprintf("imsm: Operation is not allowed "\+fprintf(stderr,Name"imsm: Operation is not allowed "\"on this container\n");}elsedprintf("imsm: not a container operation\n");
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:33
Meta data was not updated due to the following problems:
1.disk index < 0 was treated as invalid, but this is spare device
2. disk index greater than currently used disks is correct also
3. newmap pointer has to be refreshed for second map copy operation
4. size calculation has to be guarded for shrinking operation
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
@@ -5602,7 +5602,13 @@ static void imsm_process_update(struct supertype *st,new_disk=get_disk_super(super,major(u->new_disks[i]),minor(u->new_disks[i]));-if(new_disk==NULL||new_disk->index<0)+dprintf("imsm: imsm_process_update(): new disk "\+"for reshape is: %i:%i (%p, index = %i)\n",+major(u->new_disks[i]),minor(u->new_disks[i]),+new_disk,new_disk->index);+if((new_disk==NULL)||+((new_disk->index>=0)&&+(new_disk->index<u->old_raid_disks)))gotoupdate_reshape_exit;new_disk->index=mpb->num_disks++;
@@ -5642,7 +5648,7 @@ static void imsm_process_update(struct supertype *st,u->old_raid_disks+i);}/* New map is correct, now need to save old map */-oldmap=get_imsm_map(newdev,1);+newmap=get_imsm_map(newdev,1);memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));sp=(void**)id->dev;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:41
During preparing metadata update local /mdadm/ anchor shouldn't be updated directly.
information should be get from metadata after update.
It makes us sure that metadata is on disk(s) already.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 31 ++++++++-----------------------
1 files changed, 8 insertions(+), 23 deletions(-)
@@ -6329,13 +6329,13 @@ static int imsm_create_metadata_update_for_reshape(intold_raid_disks,structimsm_update_reshape**updatep){-structintel_super*super=st->sb;-structimsm_super*mpb=super->anchor;intupdate_memory_size=0;structimsm_update_reshape*u=NULL;structmdinfo*spares=NULL;inti;intdelta_disks=0;+structmdinfo*dev;+intadded_disks=0;dprintf("imsm_update_metadata_for_reshape(enter) raid_disks = %i\n",geo->raid_disks);
@@ -6374,27 +6374,12 @@ static int imsm_create_metadata_update_for_reshape(dprintf("imsm: %i spares are available.\n\n",spares->array.spare_disks);-for(i=0;i<delta_disks;i++){-structmdinfo*dev=spares->devs;-structdl*dl;-+dev=spares->devs;+for(i=0;(i<delta_disks)&&dev;i++){u->new_disks[i]=makedev(dev->disk.major,dev->disk.minor);-dl=get_disk_super(super,dev->disk.major,dev->disk.minor);-dl->index=mpb->num_disks++;-}-/* Now update the metadata so that container_content will find-*thenewdevices-*/-for(i=0;i<mpb->num_raid_devs;i++){-intd;-structimsm_dev*dev=get_imsm_dev(super,i);-structimsm_map*map=get_imsm_map(dev,0);-map->num_members=geo->raid_disks;-for(d=0;d<delta_disks;d++){-set_imsm_ord_tbl_ent(map,old_raid_disks+d,-mpb->num_disks-delta_disks+d);-}+dev=dev->next;+added_disks++;}abort:
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:49
Metadata is not modified by metadata preparation handler.
It has to be read again from array.
There is 2 read required:
1. before 'for' entry to get updated information after reshape_super() call
2. inside 'for' loop to get updated information for every processed array
(it can happen /i.e. imsm case/ that container operation is a set of array operations
and information in metadata is changed after every loop).
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
@@ -2083,6 +2083,8 @@ int reshape_container(char *container, int cfd, char *devname,intquiet){structmdinfo*cc;+structmdinfo*cc_fresh=NULL;+if(reshape_super(st,info->component_size,info->new_level,info->new_layout,info->new_chunk,info->array.raid_disks+info->delta_disks,
@@ -2091,6 +2093,14 @@ int reshape_container(char *container, int cfd, char *devname,sync_metadata(st);+/* ping monitor to be sure that update is on disk+*/+ping_monitor(container);++/* reload metadata to get updated information+*/+st->ss->load_container(st,cfd,NULL);+cc=st->ss->container_content(st,NULL);if(!cc)
@@ -2106,7 +2116,6 @@ int reshape_container(char *container, int cfd, char *devname,case0:/* child */break;}-/* For each member array, we need to perform the reshape */for(;cc;cc=cc->next){intrv;
@@ -2128,12 +2137,18 @@ int reshape_container(char *container, int cfd, char *devname,if(!adev)adev=cc->text_version;-rv=reshape_array(container,fd,adev,st,cc,force,+sysfs_free(cc_fresh);+st->ss->load_container(st,cfd,NULL);+cc_fresh=st->ss->container_content(st,subarray);+rv=reshape_array(container,fd,adev,st,+cc_fresh,force,backup_file,quiet,1);close(fd);if(rv)break;}+sysfs_free(cc_fresh);+sysfs_free(cc);exit(0);}
From: Adam Kwolek <hidden> Date: 2011-01-04 14:36:57
During first metadata update imsm for compatibility reason should update
only one array.
Buffers in prepare_update() are prepared for second update as well.
---
super-intel.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
@@ -5638,18 +5639,26 @@ static void imsm_process_update(struct supertype *st,newmap=get_imsm_map(newdev,0);/* Copy the current map */memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));-newdev->vol.migr_state=1;-newdev->vol.curr_migr_unit=0;-newdev->vol.migr_type=MIGR_GEN_MIGR;-newmap->num_members=u->new_raid_disks;-for(i=0;i<delta_disks;i++){-set_imsm_ord_tbl_ent(newmap,-u->old_raid_disks+i,-u->old_raid_disks+i);+/* update one device only+*/+if(devices_to_reshape){+dprintf("process_update(): modifying "\+"subdev: %i\n",id->index);+devices_to_reshape--;+newdev->vol.migr_state=1;+newdev->vol.curr_migr_unit=0;+newdev->vol.migr_type=MIGR_GEN_MIGR;+newmap->num_members=u->new_raid_disks;+for(i=0;i<delta_disks;i++){+set_imsm_ord_tbl_ent(newmap,+u->old_raid_disks+i,+u->old_raid_disks+i);+}+/* New map is correct, now need to save old map+*/+newmap=get_imsm_map(newdev,1);+memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));}-/* New map is correct, now need to save old map */-newmap=get_imsm_map(newdev,1);-memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));sp=(void**)id->dev;id->dev=newdev;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:37:13
Add support for reading volume information during migration process.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:37:28
Some of disks tried to add are array member already.
New disks should be added only.
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -1696,8 +1696,8 @@ static int reshape_array(char *container, int fd, char *devname,if(info2)for(d=info2->devs;d;d=d->next){-if(d->disk.state==0&&-d->disk.raid_disk>=0){+if(d->disk.raid_disk>=+reshape.before.raid_disks){/* This is a spare that wants to*bepartofthearray.*/
From: Adam Kwolek <hidden> Date: 2011-01-04 14:37:36
md runs reshape but added disk is not touched
/proc/mdstat reports that disk is used.
To fix this let md to set slot for reshape.
It is possible that slot verification mechanism has to be added.
Second possibility is to investigate problem in md
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
@@ -1701,6 +1701,7 @@ static int reshape_array(char *container, int fd, char *devname,/* This is a spare that wants to*bepartofthearray.*/+d->disk.raid_disk=-1;add_disk(fd,st,info2,d);}}
From: Adam Kwolek <hidden> Date: 2011-01-04 14:37:44
For external metadata parameters has to be changed via sysfs.
i.e. change of raid_disks requires handshake mdmon<->md (md_allow_write())
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:37:52
If sys_name field is empty structures produced by container_content()
cannot be used for sysfs access.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:00
When reshape is finished monitor, has to finalize reshape in metadata.
To do this set_array_state() should be called.
This finishes migration and stores metadata on disks.
reshape_delta_disks is set to not active value.
This finishes reshape flow in mdmon.
Signed-off-by: Adam Kwolek <redacted>
---
monitor.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
@@ -315,6 +315,17 @@ static int read_and_act(struct active_array *a)*/check_reshape=1;+/* finalize reshape detection+*/+if((a->curr_action!=reshape)&&+(a->prev_action==reshape)){+/* A reshape has finished.+*Somedisksmaybeinsyncnow.+*/+a->container->ss->set_array_state(a,a->curr_state<=clean);+check_degraded=1;+}+/* Check for failures and if found:*1/Recordthefailureinthemetadataandunblockthedevice.*FIXMEupdatethekerneltostopnotifyingonfaileddriveswhen
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:08
When reshape is finished monitor calls set_array_state() and finishes migration in metadata.
This change allows for finishing metadata migration on reshape end.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -4894,6 +4894,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)dev->vol.curr_migr_unit=__cpu_to_le32(unit);super->updates_pending++;}+return0;}else{if(a->last_checkpoint==0&&a->prev_action==reshape){/* for some reason we aborted the reshape.
@@ -4928,7 +4929,6 @@ static int imsm_set_array_state(struct active_array *a, int consistent)super->updates_pending++;}}-return0;}/* before we activate this array handle any missing disks */
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:16
For general migration function blocks_per_migr_unit() has to return valid value.
If there is no valid return, 0 is returned instead and causes division by 0 error.
Additionally guard in function was added for such case.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
@@ -1534,8 +1535,6 @@ static __u64 blocks_per_migr_unit(struct imsm_dev *dev)migr_chunk=migr_strip_blocks_rebuild(dev);returnmigr_chunk*stripes_per_unit;}-caseMIGR_GEN_MIGR:-/* FIXME I need a number here */caseMIGR_STATE_CHANGE:default:return0;
@@ -4889,10 +4888,14 @@ static int imsm_set_array_state(struct active_array *a, int consistent)/* still reshaping, maybe update curr_migr_unit */longlongblocks_per_unit=blocks_per_migr_unit(dev);longlongunit=a->last_checkpoint;-unit/=blocks_per_unit;-if(unit>__le32_to_cpu(dev->vol.curr_migr_unit)){-dev->vol.curr_migr_unit=__cpu_to_le32(unit);-super->updates_pending++;+if(blocks_per_unit){+unit/=blocks_per_unit;+if(unit>+__le32_to_cpu(dev->vol.curr_migr_unit)){+dev->vol.curr_migr_unit=+__cpu_to_le32(unit);+super->updates_pending++;+}}return0;}else{
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:31
When disks are added size has to increase in metadata.
This size should be used by common code to set size in md when reshape will be finished.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:39
When new disks are added array size has to be set by mdadm as array grows.
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 51 insertions(+), 16 deletions(-)
@@ -2034,26 +2034,61 @@ static int reshape_array(char *container, int fd, char *devname,unlink(backup_file);if(!done)abort_reshape(sra);-elseif(info->new_level!=info->array.level){-/* We need to wait for the reshape to finish-*(whichwillhavehappenedunlessodata<ndata)-*andthensetthelevel+else{+/* set new array size size - if required*/+if(reshape.before.raid_disks<+reshape.after.raid_disks){+structmdinfo*info2;-c=map_num(pers,info->new_level);-if(c==NULL){-if(forked)-return1;-exit(0);/* not possible */+wait_reshape(sra);+ping_monitor(container);++info2=st->ss->container_content(st,subarray);+if(info2){+unsignedlonglongcurrent_size=0;+unsignedlonglongnew_size=+info2->custom_array_size/2;++sysfs_get_ll(sra,+NULL,+"array_size",+¤t_size);+if(new_size>current_size){+if(sysfs_set_num(sra,NULL,+"array_size",new_size)+<0)+dprintf("Error: Cannot"\+" set array size");+else+dprintf("Array size "\+"changed");+dprintf(" from %llu to %llu.\n",+current_size,new_size);+}+sysfs_free(info2);+}}-if(reshape.before.raid_disks<-reshape.after.raid_disks)-wait_reshape(sra);-err=sysfs_set_str(sra,NULL,"level",c);-if(err)-fprintf(stderr,Name": %s: could not set level to %s\n",-devname,c);+if(info->new_level!=info->array.level){+/* We need to wait for the reshape to finish+*(whichwillhavehappenedunless+*odata<ndata)andthensetthelevel+*/++c=map_num(pers,info->new_level);+if(c==NULL){+if(forked)+return1;+exit(0);/* not possible */+}++err=sysfs_set_str(sra,NULL,"level",c);+if(err)+fprintf(stderr,Name\+": %s: could not set level"\+"to %s\n",devname,c);+}}if(forked)return0;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:47
When second array reshape is about to start metadata should be update
by mdmon in imsm_set_array_state().
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
@@ -5002,6 +5002,83 @@ static int imsm_set_array_state(struct active_array *a, int consistent)for(mdi=a->info.devs;mdi;mdi=mdi->next)imsm_set_disk(a,mdi->disk.raid_disk,mdi->curr_state);+}elseif(dev->vol.migr_state==0){+/* check here if this is container action+*andnextmetadatashouldbeprepared+*/+structactive_array*aa=a->container->arrays;+intarrays_under_reshape=0;++/* check if no other arrays is under reshape+*/+while(aa){+if(aa->container){+intinst=aa->info.container_member;+structintel_super*super=aa->container->sb;+structimsm_dev*dev=+get_imsm_dev(super,inst);+structimsm_map*map2=get_imsm_map(dev,1);++if(map2)+arrays_under_reshape++;+}+aa=aa->next;+}+if(arrays_under_reshape==0){+structimsm_map*map=get_imsm_map(dev,0);+structdl*dl=NULL;+intdisks_count=0;++/* check if this array should be reshaped+*/+for(dl=super->disks;dl;dl=dl->next)+if(dl->index>=0)+disks_count++;+if(disks_count>map->num_members){+/* manage changes in volume+*/+structimsm_map*map,*map2;+intprev_num_members;+intused_disks;+inti;++map=get_imsm_map(dev,0);+prev_num_members=map->num_members;+map->num_members=disks_count;+dev->vol.migr_state=1;+dev->vol.curr_migr_unit=0;+dev->vol.migr_type=MIGR_GEN_MIGR;+for(i=prev_num_members;+i<map->num_members;i++)+set_imsm_ord_tbl_ent(map,i,i);+map2=get_imsm_map(dev,1);+/* Copy the current map */+memcpy(map2,map,sizeof_imsm_map(map));+map2->num_members=prev_num_members;++/* calculate new size+*/+used_disks=imsm_num_data_members(dev,0);+if(used_disks){+unsignedlonglongarray_blocks;++array_blocks=+map->blocks_per_member+*used_disks;+/* round array size down to closest MB+*/+array_blocks=(array_blocks+>>SECT_PER_MB_SHIFT)+<<SECT_PER_MB_SHIFT;+dev->size_low=+__cpu_to_le32((__u32)array_blocks);+dev->size_high=+__cpu_to_le32(+(__u32)(array_blocks>>32));+}+super->updates_pending++;+}+}}returnconsistent;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:38:55
When user wants to add spares to container with raid0 arrays only
it is not possible to update metadata due to lack of running mdmon.
To allow for this direct metadata update by mdadm is used in such case.
Signed-off-by: Krzysztof Wojcik <redacted>
---
Manage.c | 13 +++----------
super-intel.c | 8 ++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
@@ -844,9 +844,8 @@ int Manage_subdevs(char *devname, int fd,if(dv->writemostly==1)disc.state|=(1<<MD_DISK_WRITEMOSTLY);if(tst->ss->external){-/* add a disk to an external metadata container-*onlyifmdmonisaroundtoseeit-*/+/* add a disk+*toanexternalmetadatacontainer*/structmdinfonew_mdi;structmdinfo*sra;intcontainer_fd;
@@ -860,13 +859,6 @@ int Manage_subdevs(char *devname, int fd,return1;}-if(!mdmon_running(devnum)){-fprintf(stderr,Name": add failed for %s: mdmon not running\n",-dv->devname);-close(container_fd);-return1;-}-sra=sysfs_read(container_fd,-1,0);if(!sra){fprintf(stderr,Name": add failed for %s: sysfs_read failed\n",
@@ -884,6 +876,7 @@ int Manage_subdevs(char *devname, int fd,fprintf(stderr,Name": add new device to external metadata"" failed for %s\n",dv->devname);close(container_fd);+sysfs_free(sra);return1;}ping_monitor(devnum2devname(devnum));
@@ -3506,6 +3508,12 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,super->disks=dd;}+if(!mdmon_running(st->container_dev)){+dprintf("imsm: mdmon is not active- write metadata by mdadm\n");+super->updates_pending++;+write_super_imsm(st,0);+}+return0;}
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:03
For code reuse in raid0 reshape case when monitor is not loaded.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 229 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 126 insertions(+), 103 deletions(-)
@@ -5660,6 +5660,121 @@ static int add_remove_disk_update(struct intel_super *super)returncheck_degraded;}+staticintapply_reshape_container_disks_update(structimsm_update_reshape*u,+structintel_super*super,+void***space_list,+intdevices_to_reshape)+{+structdl*new_disk;+structintel_dev*id;+inti;+intdelta_disks=u->new_raid_disks-u->old_raid_disks;+void**tofree=NULL;+structimsm_super*mpb;+intret_val=0;++dprintf("imsm: apply_reshape_container_disks_update() for reshape\n");+mpb=super->anchor;+/* enable spares to use in array+*/+for(i=0;i<delta_disks;i++){+new_disk=get_disk_super(super,+major(u->new_disks[i]),+minor(u->new_disks[i]));+dprintf("imsm: apply_reshape_container_disks_update():"\+"new disk for reshape is: %i:%i (%p, index = %i)\n",+major(u->new_disks[i]),minor(u->new_disks[i]),+new_disk,new_disk->index);+if((new_disk==NULL)||+((new_disk->index>=0)&&+(new_disk->index<u->old_raid_disks)))+gotoupdate_reshape_exit;+new_disk->index=mpb->num_disks++;+/* slot to fill in autolayout+*/+new_disk->raiddisk=new_disk->index;+new_disk->disk.status|=+CONFIGURED_DISK;+new_disk->disk.status&=~SPARE_DISK;+}++dprintf("imsm: apply_reshape_container_disks_update():"+"update_reshape: volume set mpb->num_raid_devs = %i\n",+mpb->num_raid_devs);+/* manage changes in volume+*/+for(id=super->devlist;id;id=id->next){+void**sp=*space_list;+structimsm_dev*newdev;+structimsm_map*newmap,*oldmap;++if(!sp)+continue;+*space_list=*sp;+newdev=(void*)sp;+/* Copy the dev, but not (all of) the map+*/+memcpy(newdev,id->dev,sizeof(*newdev));+oldmap=get_imsm_map(id->dev,0);+newmap=get_imsm_map(newdev,0);+/* Copy the current map+*/+memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));+/* update one device only+*/+if(devices_to_reshape){+intused_disks;++dprintf("apply_reshape_container_disks_update():"\+"modifying subdev: %i\n",id->index);+devices_to_reshape--;+newdev->vol.migr_state=1;+newdev->vol.curr_migr_unit=0;+newdev->vol.migr_type=MIGR_GEN_MIGR;+newmap->num_members=u->new_raid_disks;+for(i=0;i<delta_disks;i++){+set_imsm_ord_tbl_ent(newmap,+u->old_raid_disks+i,+u->old_raid_disks+i);+}+/* New map is correct, now need to save old map+*/+newmap=get_imsm_map(newdev,1);+memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));++/* calculate new size+*/+used_disks=imsm_num_data_members(newdev,0);+if(used_disks){+unsignedlonglongarray_blocks;++array_blocks=+newmap->blocks_per_member*used_disks;+/* round array size down to closest MB+*/+array_blocks=(array_blocks+>>SECT_PER_MB_SHIFT)+<<SECT_PER_MB_SHIFT;+newdev->size_low=+__cpu_to_le32((__u32)array_blocks);+newdev->size_high=+__cpu_to_le32((__u32)+(array_blocks>>32));+}+}++sp=(void**)id->dev;+id->dev=newdev;+*sp=tofree;+tofree=sp;+}+ret_val=1;++update_reshape_exit:++returnret_val;+}+staticvoidimsm_process_update(structsupertype*st,structmetadata_update*update){
@@ -5704,109 +5819,12 @@ static void imsm_process_update(struct supertype *st,switch(type){caseupdate_reshape_container_disks:{structimsm_update_reshape*u=(void*)update->buf;-structdl*new_disk;-structintel_dev*id;-inti;-intdelta_disks=u->new_raid_disks-u->old_raid_disks;-void**tofree=NULL;-intdevices_to_reshape=1;--dprintf("imsm: imsm_process_update() for update_reshape\n");--/* enable spares to use in array */-for(i=0;i<delta_disks;i++){-new_disk=get_disk_super(super,-major(u->new_disks[i]),-minor(u->new_disks[i]));-dprintf("imsm: imsm_process_update(): new disk "\-"for reshape is: %i:%i (%p, index = %i)\n",-major(u->new_disks[i]),minor(u->new_disks[i]),-new_disk,new_disk->index);-if((new_disk==NULL)||-((new_disk->index>=0)&&-(new_disk->index<u->old_raid_disks)))-gotoupdate_reshape_exit;--new_disk->index=mpb->num_disks++;-/* slot to fill in autolayout */-new_disk->raiddisk=new_disk->index;-new_disk->disk.status|=-CONFIGURED_DISK;-new_disk->disk.status&=~SPARE_DISK;-}--dprintf("imsm: process_update(): update_reshape: volume set"\-" mpb->num_raid_devs = %i\n",mpb->num_raid_devs);-/* manage changes in volume-*/-for(id=super->devlist;id;id=id->next){-void**sp=update->space_list;-structimsm_dev*newdev;-structimsm_map*newmap,*oldmap;--if(!sp)-continue;-update->space_list=*sp;-newdev=(void*)sp;-/* Copy the dev, but not (all of) the map */-memcpy(newdev,id->dev,sizeof(*newdev));-oldmap=get_imsm_map(id->dev,0);-newmap=get_imsm_map(newdev,0);-/* Copy the current map */-memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));-/* update one device only-*/-if(devices_to_reshape){-intused_disks;-dprintf("process_update(): modifying "\-"subdev: %i\n",id->index);-devices_to_reshape--;-newdev->vol.migr_state=1;-newdev->vol.curr_migr_unit=0;-newdev->vol.migr_type=MIGR_GEN_MIGR;-newmap->num_members=u->new_raid_disks;-for(i=0;i<delta_disks;i++){-set_imsm_ord_tbl_ent(newmap,-u->old_raid_disks+i,-u->old_raid_disks+i);-}-/* New map is correct, now need to save old map-*/-newmap=get_imsm_map(newdev,1);-memcpy(newmap,oldmap,sizeof_imsm_map(oldmap));+intret_val;-/* calculate new size-*/-used_disks=imsm_num_data_members(newdev,0);-if(used_disks){-unsignedlonglongarray_blocks;--array_blocks=-newmap->blocks_per_member-*used_disks;-/* round array size down to closest MB-*/-array_blocks=(array_blocks->>SECT_PER_MB_SHIFT)-<<SECT_PER_MB_SHIFT;-newdev->size_low=-__cpu_to_le32(-(__u32)array_blocks);-newdev->size_high=-__cpu_to_le32(-(__u32)(array_blocks>>32));-}-}--sp=(void**)id->dev;-id->dev=newdev;-*sp=tofree;-tofree=sp;-}--update->space_list=tofree;-super->updates_pending++;-update_reshape_exit:+ret_val=apply_reshape_container_disks_update(u,super,+&update->space_list,1);+if(ret_val)+super->updates_pending++;break;}caseupdate_activate_spare:{
@@ -6592,7 +6610,12 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,if(len){ret_val=0;-append_metadata_update(st,u,len);+if(mdmon_running(st->container_dev))+append_metadata_update(st,u,len);+else{+/* no mdmon - apply update+*/+}}elsedprintf("imsm: Cannot prepare "\"update\n");
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:11
When raid0 reshape is performed metadata has to be applied by mdadm.
(without mdmon)
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 71 insertions(+), 11 deletions(-)
@@ -6595,36 +6595,96 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,returnret_val;/* verify reshape conditions-*oncontainerlevelwecanonlyincreasenumberofdevices.*/+*oncontainerlevelwecanonlyincreasenumberofdevices.+*/if(st->container_dev==st->devnum){/* check for delta_disks > 0-*andsupportedraidlevels0and5onlyincontainer*/+*andsupportedraidlevels0and5onlyincontainer+*/intold_raid_disks=0;if(imsm_reshape_is_allowed_on_container(st,&geo,&old_raid_disks)){structimsm_update_reshape*u=NULL;intlen;+structintel_super*super=st->sb;+void**space_list;+structintel_dev*dl;+void**space_tail=(void**)&space_list;+len=imsm_create_metadata_update_for_reshape(st,&geo,old_raid_disks,&u);-if(len){+if(len<=0){+dprintf("imsm: Cannot prepare update\n");+gotoexit_imsm_reshape_super;++}+if(mdmon_running(st->container_dev)){ret_val=0;-if(mdmon_running(st->container_dev))-append_metadata_update(st,u,len);-else{-/* no mdmon - apply update-*/+append_metadata_update(st,u,len);+gotoexit_imsm_reshape_super;+}++/* no mdmon - apply update+*/++dprintf("imsm:prepare space list for update_reshape\n");+for(dl=super->devlist;dl;+dl=dl->next){+intsize=sizeof_imsm_dev(dl->dev,1);+void*s;+if(u->new_raid_disks>u->old_raid_disks)+size+=sizeof(__u32)*2*+(u->new_raid_disks-u->old_raid_disks);+s=malloc(size);+if(!s)+break;+*space_tail=s;+space_tail=s;+*space_tail=NULL;+}+ret_val=apply_reshape_container_disks_update(u,super,+&space_list,1);+if(ret_val){+/* reallocate anchor+*/+size_tbuf_len=super->len;+size_tlen=+disks_to_mpb_size(u->new_raid_disks);+structimsm_super*mpb=super->anchor;+void*new_anchor;++if(__le32_to_cpu(mpb->mpb_size)+len>+buf_len){+buf_len=ROUND_UP(__le32_to_cpu(+mpb->mpb_size)+len,512);+if(posix_memalign(&new_anchor,+512,buf_len)==0){+memcpy(new_anchor,super->buf,+super->len);+free(super->buf);+super->buf=new_anchor;+super->len=buf_len;+}+super->updates_pending++;+ret_val=0;+}+}else{+while(space_list){+void*space=space_list;+space_list=*space_list;+free(space);}-}else-dprintf("imsm: Cannot prepare "\-"update\n");+free(u);+}}elsefprintf(stderr,Name"imsm: Operation is not allowed "\"on this container\n");}elsedprintf("imsm: not a container operation\n");+exit_imsm_reshape_super:dprintf("imsm: reshape_super Exit code = %i\n",ret_val);returnret_val;}
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:19
Reduce disk number of added disks if disk number was increased by takeover.
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
@@ -1694,10 +1694,12 @@ static int reshape_array(char *container, int fd, char *devname,st->ss->container_content(st,subarray);structmdinfo*d;-if(info2)+if(info2){+intbefore_raid_disks=reshape.before.raid_disks;+if(orig_level==0)+before_raid_disks--;for(d=info2->devs;d;d=d->next){-if(d->disk.raid_disk>=-reshape.before.raid_disks){+if(d->disk.raid_disk>=before_raid_disks){/* This is a spare that wants to*bepartofthearray.*/
@@ -1705,7 +1707,8 @@ static int reshape_array(char *container, int fd, char *devname,add_disk(fd,st,info2,d);}}-sysfs_free(info2);+sysfs_free(info2);+}}if(reshape.blocks==0){
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:27
For level migration support it is necessary to allow mdmon to react for level changes.
It has to have ability to change configuration of active array,
and for array level change to raid0 finish array monitoring.
Signed-off-by: Maciej Trela <redacted>
Signed-off-by: Adam Kwolek <redacted>
---
managemon.c | 12 ++++++++++++
monitor.c | 2 +-
2 files changed, 13 insertions(+), 1 deletions(-)
@@ -517,7 +517,7 @@ static int wait_and_act(struct supertype *container, int nowait)/* once an array has been deactivated we want to*askthemanagertodiscardit.*/-if(!a->container){+if(!a->container||(a->info.array.level==0)){if(discard_this){ap=&(*ap)->next;continue;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:34
After raid0 reshape is finished backward takeover has to be executed.
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -2072,8 +2072,8 @@ static int reshape_array(char *container, int fd, char *devname,sysfs_free(info2);}}--if(info->new_level!=info->array.level){+if((info->new_level!=info->array.level)||+((info->new_level==0)&&(orig_level==0))){/* We need to wait for the reshape to finish*(whichwillhavehappenedunless*odata<ndata)andthensetthelevel
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:42
As raid4 is not supported by imsm (this is takeovered raid0)
do not fix degraded raid4 arrays.
Signed-off-by: Adam Kwolek <redacted>
---
super-intel.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
@@ -5432,6 +5432,12 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,/* No repair during migration */returnNULL;+if(a->info.array.level==4)+/* No repair for takeovered array+*imsmdoesn'tsupportraid4+*/+returnNULL;+if(imsm_check_degraded(super,dev,failed)!=IMSM_T_STATE_DEGRADED)returnNULL;
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:50
For metadatas that container operation requires set of arrays operations
for 2nd (and next) arrays in raid0 case reshape_array() is executed before
array is monitored and before metadat update is stored,
because in such case mdmon updates metadata via set_array_state().
for such cases some of parameters (i.e. delta_disks) should be used from input parameters,
instead from metadata.
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
From: Adam Kwolek <hidden> Date: 2011-01-04 14:39:58
To execute second raid0 array reshape, metadata has to be reloaded after takeover (and update by monitor).
To do this container handle has to be passed to reshape_array() and takeover operation is moved to begin of reshape_array().
For adding disks metadata is reloaded to get added disk list, updated after takeover).
Signed-off-by: Adam Kwolek <redacted>
---
Grow.c | 63 ++++++++++++++++++++++++++++++++++-----------------------------
1 files changed, 34 insertions(+), 29 deletions(-)
@@ -1594,15 +1594,15 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,gotorelease;}sync_metadata(st);-rv=reshape_array(container,fd,devname,st,&info,force,-backup_file,quiet,0);+rv=reshape_array(container,cfd,fd,devname,st,&info,+force,backup_file,quiet,0);}release:unfreeze(st,frozen);returnrv;}-staticintreshape_array(char*container,intfd,char*devname,+staticintreshape_array(char*container,intcfd,intfd,char*devname,structsupertype*st,structmdinfo*info,intforce,char*backup_file,intquiet,intforked)
@@ -1637,24 +1637,6 @@ static int reshape_array(char *container, int fd, char *devname,fprintf(stderr,Name": %s\n",msg);return1;}-if(ioctl(fd,GET_ARRAY_INFO,&array)!=0){-dprintf("Canot get array information.\n");-return1;-}-spares_needed=max(reshape.before.raid_disks,-reshape.after.raid_disks)-array.raid_disks;--if(!force&&spares_needed<info->array.spare_disks){-fprintf(stderr,-Name": Need %d spare%s to avoid degraded array,"-" and only have %d.\n"-" Use --force to over-ride this check.\n",-spares_needed,-spares_needed==1?"":"s",-info->array.spare_disks);-return1;-}-if(reshape.level!=info->array.level){char*c=map_num(pers,reshape.level);interr;
@@ -1676,12 +1658,33 @@ static int reshape_array(char *container, int fd, char *devname,fprintf(stderr,Name" level of %s changed to %s\n",devname,c);orig_level=info->array.level;-}+if(mdmon_running(st->container_dev)&&+(orig_level==0))+ping_manager(container);-if(reshape.level>0&&st->ss->external&&-!mdmon_running(st->container_dev)){-start_mdmon(st->container_dev);+if(reshape.level>0&&st->ss->external&&+!mdmon_running(st->container_dev))+start_mdmon(st->container_dev);ping_monitor(container);++}++if(ioctl(fd,GET_ARRAY_INFO,&array)!=0){+dprintf("Canot get array information.\n");+return1;+}+spares_needed=max(reshape.before.raid_disks,+reshape.after.raid_disks)-array.raid_disks;++if(!force&&spares_needed<info->array.spare_disks){+fprintf(stderr,+Name": Need %d spare%s to avoid degraded array,"+" and only have %d.\n"+" Use --force to over-ride this check.\n",+spares_needed,+spares_needed==1?"":"s",+info->array.spare_disks);+return1;}/* ->reshape_super might have chosen some spares from the
@@ -1690,10 +1693,11 @@ static int reshape_array(char *container, int fd, char *devname,*themtothekernel.*/if(st->ss->reshape_super&&st->ss->container_content){-structmdinfo*info2=-st->ss->container_content(st,subarray);+structmdinfo*info2;structmdinfo*d;+st->ss->load_container(st,cfd,NULL);+info2=st->ss->container_content(st,subarray);if(info2){intbefore_raid_disks=reshape.before.raid_disks;if(orig_level==0)
@@ -2189,7 +2193,8 @@ int reshape_container(char *container, int cfd, char *devname,cc_fresh->delta_disks=delta_disks;}elsedelta_disks=cc_fresh->delta_disks;-rv=reshape_array(container,fd,adev,st,++rv=reshape_array(container,cfd,fd,adev,st,cc_fresh,force,backup_file,quiet,1);close(fd);
From: Adam Kwolek <hidden> Date: 2011-01-04 14:40:06
When raid0 array is takeovered to raid4 for reshape it should be possible to detect
that array for reshape is monitored now for metadata update.
Signed-off-by: Adam Kwolek <redacted>
---
monitor.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
@@ -235,6 +235,13 @@ static int read_and_act(struct active_array *a)}}+if(a->curr_state>inactive&&+a->prev_state==inactive){+/* array has been started+*possiblethatcontaineroperationhastobecompleted+*/+a->container->ss->set_array_state(a,0);+}if(a->curr_state<=inactive&&a->prev_state>inactive){/* array has been stopped */
On Tue, 04 Jan 2011 15:34:38 +0100 Adam Kwolek [off-list ref] wrote:
This patch series implements Online Capacity Expansion (OLCE) feature in mdadm devel3.2. for Raid5 and Raid0.
This is implemented as reshape of whole container (all arrays that belongs to container are reshaped).
Raid0 reshape is implemented using takeover to raid4 transition.
---
Thanks.
I have reviewed all of these and applied several, changed other, rejected the
rest as detailed below.
Before doing that I finished the refactoring that I was doing so devel-3.2
compiles again.
My next step with this is to do some testing.
As I say below, feel free to resend anything that you find that you still
need. Maybe I'll understand it better the second time around, or will be
able to suggest a better way of doing it.
In particular, there is no ->manage_reshape method (I didn't take that patch)
so any attempt to reshape an imsm array will crash. We need to write a
manage_reshape based on the new child_monitor and using the new
progress_reshape.
BTW, when you split a string e.g.
"this is a long string"
to
"this is a"
" long string"
you do *not* need a '\' at the end of the first line.
Thanks,
NeilBrown
Adam Kwolek (31):
Raid0: detect reshape on array start
Applied, but I'm not sure that it is needed or that set_array_state
does what is expected any more...
Raid0: Reload disk list on 'next' raid0 array
Not applied - probably because I am too tired to think clearly
about it. If you still need this, feel free to resubmit it
and I'll think about it then.
Raid0: Run 'next' reshapes without meta update
Not applied. I don't think the fix is right, but I'm not
100% sure, and it might be fixed by other changes that I have
made. So feel free to resubmit something like this if it is
still a problem.
imsm: FIX: do not repair raid4 arrays
Applied
Raid0: execute backward takeover
Applied, but I used a different test which is more generic.
Detect level change
Applied
Take in mind takeover during disk add
Not applied. This patch is irrelevant because of an earlier patch
which I didn't apply.
imsm: Update raid0 metadata for reshape
Applied, though reshape_super should *both* queue and update and
change the metadata in-place, so I changed it to do that.
imsm: Move reshape update processing to function
Applied, though I had to do it by hand - hope I didn't break anything.
However the little extra bit in imsm_reshape_super didn't make sense,
and wasn't documented, so I left it out.
Add spares to raid0 in mdadm
Applied with changes. The Assemble.c part of this was OK.
The super-intel.c was not. That logic needed to be in Assemble.c
I have put it there (untested).
imsm: Update metadata for second array
Applied with a few changes. I broke the new code out into
a separate function, and then called that function from a
different place - I think a more correct place but you might
like to check.
Set array size after adding new disks
Applied, with a few changes. e.g. 'array_size' can read as 'default'.
And we might want to change array_size when raid_disks decreases as well.
imsm: update array size information in metadata
Applied.
FIX: Initialize subarray variable in reshape_array
No applied - I fixed this a different way already.
imsm: FIX: Division by 0
Applied
imsm: Finalize reshape in metadata
Applied
Finalize reshape after adding disks to array
Not applied. This should not be needed as the code near the comment:
/* Reshape has progressed or completed so we need to
* update the array state - and possibly the array size
*/
should handle this case. If it doesn't it should be fixed.
imsm: FIX: Fill sys_name in container_content()
Not applied. container_content should not set sys_name as the volume could
easily not have a sys_name yet. Rather some other code should call
sysfs_init() at an appropriate time. I have done that.
FIX: Use sysfs to change array parameters
Applied
FIX: added disks are not used by reshape process /md/
Not applied. Definitely the wrong fix. Need more details of the
problem.
FIX: change adding disks criteria
Not applied. I'm not convinced this is the correct fix.
For devices already in the array, disk.state should not be zero.
So if it is, then something else is wrong. I would need to know more
about that problem you are seeing.
FIX: Get array information in reshape_array()
Applied
imsm: FIX: support general migration by getinfo_super_imsm_volume
Applied.
FIX: Arrays cannot be opened exclusively
Why do you say that arrays cannot be opened exclusively? You might be right,
but I need mor explanation before I can apply this patch - it "seems" wrong
to me.
Not applied.
imsm: FIX: update first array in container only
Applied. Note that when starting array that is part-way through a reshape
of the first array we will need to alloc space just like we allocate
spare here.
FIX: get updated information from metadata
Applied, but with substantial changes.
reshape_super reloads the metadata, not reshape_container, so that
it can know if the array size needs to be changed.
imsm: FIX: Do not update anchor directly
Not applied. I don't think this is correct. The metadata *should* be
updated directly.
When converting a RAID0 to a RAID5 there is no mdadm running so we should:
->reshape_super
->sync_super
start mdmon
proceed with reshape.
imsm: FIX: Perform first metadata update for container operation
Applied.
imsm: FIX: display error message
Applied ... and I change the other dprintfs to fprintfs as I think
reshape_super should give an message any time it doesn't succeed.
imsm: FIX: display correct information for '-E' option
Applied
mdadm: second_map enhancement for imsm_get_map()
Applied.
Krzysztof Wojcik (3):
FIX: Position calculation in mdstat_by_subdev
Applied.
FIX: Change size condition in imsm_reshape_is_allowed_on_container
Not applied. Size of '-1' means 'not change was requested'. Size of '0'
means 'set to maximum size'. So the test requiring '-1' seems correct.
Manage reshape process in manage_reshape vector.
Not applied. Seems pointless, and ->manage_reshape is not allowed to say
"management of process not supported". If ->reshape_super allows the
reshape, then ->manage_reshape *must* support it.