Commit Graph

1675 Commits

Author SHA1 Message Date
NeilBrown 999b497251 Make child_monitor a candidate for ->manage_reshape
Child_monitor was design to perform 'manage_reshape' for native
arrays.  So change the signature for ->manage_reshape to match
child_monitor and move the all to the same place that child_monitor
is called from.

Also give super-intel a manage_reshape handler which simple calls
child_monitor.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 14:46:17 +11:00
NeilBrown da8100ca48 Move setup of backup superblock into child_monitor
child_monitor has overall responsibility for backups using the generic
bsb, so move all handling under it's control.

signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 14:42:51 +11:00
NeilBrown 832b2b9a7e Add comment about future enhancement
We currently suspend rather large sections of
the array which can take a while to process.
Possibly smaller sections are better.  Possibly it should be
adjusted on a timeout basis.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 14:04:09 +11:00
NeilBrown e97ca00244 Correctly handle the final partial backup of an in-place reshape.
The array might not be a multiple of the chosen backup size, so
the last bit to be backed up might be a bit smaller.  Handle that
correctly.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 14:01:36 +11:00
NeilBrown 49cd738ba2 Handle edge case with suspend_point updates.
If reshape_progress equals suspend_point, it is also appropriate to
update the end of the suspend region.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 10:51:44 +11:00
NeilBrown 60204e4e54 Be more enthusiastic/flexible in backing up data.
At some points we need to perform 2 backups at once so as to
start the 'double buffering' approach.  So rather than assuming
what the next backup should be, example suspend_point and backup
as much as possible up to there.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 10:44:58 +11:00
NeilBrown 223c5c999e Fix issues with the finish of monitoring a reshape.
1/ We need to clean up the backup file after the reshape finishes.
2/ We need to remove the suspended region and clear the resync
   controls after the resync finishes.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 10:40:56 +11:00
NeilBrown 9653307272 fix array_size in child_monitor
The array_size we need to consider is the largest possible size of the
array, which is a different calculation depending on whether the array
is growing or shrinking.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 10:37:26 +11:00
NeilBrown 92d1991fff Fix calculations for max_progress and completed.
'sync_completed' can sometimes have a value which is slightly high.
So round-down relevant values to new-chunk size and that is what we
want.

Subtract from component_size after scaling down rather than before as
that is easier.
Make sure max_progress never goes negative when reshaping backwards.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 10:34:44 +11:00
NeilBrown d0ab945ee1 Improve determination of when a backup is needed.
The current code is right.
Instead compute where we might eventually need to back up to, and
then compare that to how far we have progressed.

Also move suspend_point up towards where we might need to backup to,
rather than just as far as max_progress - as max_progress can never
exceed where we are currently suspended to.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 15:20:40 +11:00
NeilBrown 2f3dd5e4bc Remove write_range from calculation of max_progress
It isn't needed as we always work in multiples of full
destination stripes.

Also multiply by 'after' disks, not before.

We can progress until the point we would write then lines up with
where we would read now.
We read now from
  array-address: reshape_progress   device-address: read_offset
So we write then to
  device-address: read_offset    array-address:  read_offset * after.disks

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 15:07:57 +11:00
NeilBrown ec757320c2 Switch calculations of read_offset and write_offset
These were backwards...  we read from 'before' and write to 'after'.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:57:14 +11:00
NeilBrown b4f8e38b94 Avoid confusing with 'blocks' number.
The 'blocks' number computed by analyse_change is the number of
blocks that it makes sense to back-up at a time.
It is the smallest number of blocks that is a whole number of
stripes in both the old and the new layout.

However we are also using it as the smallest amount of progress
that can be made at a time, which is wrong as it is always valid
to progress a single stripe in the new layout.

So change 'blocks' to be called 'backup_blocks' to make it more clear.
And pass new_chunk size down so it can be used for 'minimum forward
progress' calculations.

Also set 'stripes' (the amount actually backed up) from the
possibly-scaled 'blocks' number rather than ignoring it and using
backup_blocks.

Finally, get rid of 'read_range' as it isn't used (or needed).

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:51:09 +11:00
NeilBrown 6eb48844a5 Correctly abort level change when reshape_array fails.
We were returning too early.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:41:49 +11:00
NeilBrown 374ba335cb Misc reshape_array fixes.
1/ test on spares_needed is backwards
2/ stray white space
3/ reuse a goto instead of explicit exit().

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:41:48 +11:00
NeilBrown f94eedafc1 Avoid double-unfreeze of arrays during grow.
Once we have called reshape_container or reshape_super we have handed
on the responsibility for unfreezing the array, so Grow_reshape
shouldn't call unfreeze.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:41:47 +11:00
NeilBrown 4a8703648a analyse_change fixes
When converting to RAID6, the new layout should match the old
layout, not the RAID6 version of the old layout.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:41:46 +11:00
NeilBrown b6b951557d Fix some typos in fprintf messages.
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:41:42 +11:00
NeilBrown 3656edcdc6 Grow: fix type when 'or'ing flags together.
'||' should have been '|'

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 14:16:11 +11:00
NeilBrown 0f28668b93 Ensure start_reshape copes with unexpected state
We want start_reshape to work no matter what the current values
of suspend_lo/suspend_hi are.  So initialise suspend_lo very high
as this allows suspend_hi to be set to anything.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-11 13:23:16 +11:00
Adam Kwolek 4867e068e3 Raid0: detect reshape on array start
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:27:25 +11:00
Adam Kwolek 89c6788213 imsm: FIX: do not repair raid4 arrays
As raid4 is not supported by imsm (this is takeovered raid0)
do not fix degraded raid4 arrays.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:20:25 +11:00
Adam Kwolek 1b3cbac57f Raid0: execute backward takeover
After raid0 reshape is finished backward takeover has to be executed.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:20:01 +11:00
Adam Kwolek 57f8c76946 Detect level change
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 <maciej.trela@intel.com>
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:17:29 +11:00
Adam Kwolek ed08d51c1a imsm: Update raid0 metadata for reshape
When raid0 reshape is performed metadata has to be applied by mdadm.
(without mdmon)

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:14:24 +11:00
NeilBrown 2e5dc01050 imsm: Move reshape update processing to function
For code reuse in raid0 reshape case when monitor is not loaded.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 19:10:04 +11:00
Adam Kwolek 73cb8d43f4 Add spares to raid0 in mdadm
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 <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:42:53 +11:00
Adam Kwolek 0e2d1a4e68 imsm: Update metadata for second array
When second array reshape is about to start metadata should be updated
by mdmon in imsm_set_array_state().

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:23 +11:00
Adam Kwolek 582496b2c2 Set array size after adding new disks
When new disks are added array size has to be set by mdadm as array grows.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:20 +11:00
Adam Kwolek ef83fa1a7c imsm: update array size information in metadata
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:15 +11:00
Adam Kwolek 6345120e38 imsm: FIX: Division by 0
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:11 +11:00
Adam Kwolek a4546b6189 imsm: Finalize reshape in metadata
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:07 +11:00
Adam Kwolek 7477d51305 FIX: Use sysfs to change array parameters
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:03 +11:00
Adam Kwolek 9ff87c16ce FIX: Get array information in reshape_array()
Uninitialized array structure is used.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:29:02 +11:00
Adam Kwolek b335e59305 imsm: FIX: support general migration by getinfo_super_imsm_volume
Add support for reading volume information during migration process.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:28:56 +11:00
Adam Kwolek 834acc0bd2 imsm: FIX: update first array in container only
During first metadata update imsm for compatibility reason should update
only one array.
Buffers in prepare_update() are prepared for second update as well.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 18:26:59 +11:00
Adam Kwolek 1bb174ba0b FIX: get updated information from metadata
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:56:05 +11:00
Adam Kwolek d677e0b8ec imsm: FIX: Perform first metadata update for container operation
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:24:07 +11:00
Adam Kwolek 690aae1ae5 imsm: FIX: display error message
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:22:01 +11:00
Adam Kwolek dd8bcb3b69 imsm: FIX: display correct information for '-E' option
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 <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:11:35 +11:00
Adam Kwolek 98130f4013 mdadm: second_map enhancement for imsm_get_map()
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 <maciej.trela@intel.com>
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:08:04 +11:00
Krzysztof Wojcik f6f53092ff FIX: Position calculation in mdstat_by_subdev
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 16:07:20 +11:00
NeilBrown 7443ee8187 Refactor reshape monitoring.
Combine all the non-backing-up code into a single function:
progress_reshape.  It is called repeatedly to monitor a
reshape and allow it to happen safely.

Have a single separate function 'child_monitor' which
performs backups of data and calls progress_reshape to
wait for the next backup to be needed.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 15:58:32 +11:00
NeilBrown 5da9ab9874 Grow_reshape re-factor
Significant rewrite/refactor of Grow_reshape to make it easier to work
with externally-managed-metadata.

This patch it too big, but we'll just have to live with that.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-06 15:58:00 +11:00
Anna Czarnowska 037e12d6da Incremental: move suitable spares to container when subarrays started.
By default Incremental places all imsm spares in separate container
with uuid=0:0:0:0. (patch giving spares uuid_zero needed)

When we find enough members to start an array
we are able to determine domain so we search spare container
for suitable spares and move them to the container that
is currently assembled.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 14:42:27 +11:00
Anna Czarnowska d52bb542d4 move_spare function modified and moved to Manage.c
It will also be needed for Incremental.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 14:34:32 +11:00
Anna Czarnowska 326727d9c9 Use one function chosing spares from container
container_chose_spares in Monitor.c and
get_spares_for_grow in super-intel.c
do the same thing: search for spares in a container.

Another version will also be needed for Incremental
so a more general solution is presented here and
applied in two previous contexts.

Normally domlist==NULL would lead an empty list but
this is typically checked earlier so here it is interpreted
as "do not test domains".

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 14:34:14 +11:00
Anna Czarnowska ed7fc6b4d9 Assemble: allow to assemble spares on their own
If we find spares but no members of given array
we create container with just spares.

This allows auto assemble to pick up all lose imsm spares when there
is no config file.
When there is a valid config file and any array is assembled from it
we don't try auto assembly so we will not assemble spares that don't
match any array.
To remedy this we must add
ARRAY metadata=imsm UUID=00000000:00000000:00000000:00000000
to config file.
This container will include all remaining spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 13:54:18 +11:00
Anna Czarnowska 26b05aeaed Assemble: we need to read policy to know array domains
Policy must be read on all disks identified as array members
to get array's domains list.
Currently it is only read on first array member in auto assembly mode.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 13:42:59 +11:00
Przemyslaw Czarnowski fee6a49ee8 Consider target only for spare-same-domain
otherwise, matching target will force spare-same-domain regardless of
action that comes in domain.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-26 22:38:44 +11:00