summaryrefslogtreecommitdiff
path: root/super-intel.c
Commit message (Collapse)AuthorAge
...
* raid0->raid10 takeover- process metadata updateKrzysztof Wojcik2011-01-26
| | | | | | | | | | | | | | Implementation of raid0->raid10 takeover metadata update at process_update level. - We are using memory previously allocated in prepare_update to create two dummy disks will be inserted in the metadata and new imsm_dev structure with expanded disk order table. - Update indexes in disk list - Update metadata map - Update disk order table Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* raid0->raid10 takeover- allocate memory for added disksKrzysztof Wojcik2011-01-26
| | | | | | | | | | Allocate memory will be used in process_update. For raid0->raid10 takeover operation number of disks doubles so we should allocate memory for additional disks and one imsm_dev structure with extended order table. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* raid0->raid10 takeover- create metadata updateKrzysztof Wojcik2011-01-26
| | | | | | | | | Create metadata update for raid0 -> raid10 takeover. Because we have no mdmon running for raid0 we have to update metadata using local update mechanism Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add raid10 -> raid0 takeover supportKrzysztof Wojcik2011-01-26
| | | | | | | | | | | | | | The patch introduces takeover from level 10 to level 0 for imsm metadata. This patch contains procedures connected with preparing and applying metadata update during 10 -> 0 takeover. When performing takeover 10->0 mdmon should update the external metadata (due to disk slot and level changes). To achieve that mdadm calls reshape_super() and prepare the "update_takeover" metadata update type. Prepared update is processed by mdmon in process_update(). Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't close fds in write_init_superNeilBrown2011-01-25
| | | | | | | | | | | | | | | We previously closed all 'fds' associated with an array in write_init_super .. sometimes, and sometimes at bad times. This isn't neat and free_super is a better place to close them. So make sure free_super always closes the fds that the metadata manager kept hold of, and stop closing them in write_init_super. Also add a few more calls to free_super to make sure they really do get closed. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Define imsm_analyze_change functionKrzysztof Wojcik2011-01-17
| | | | | | | | Function intended to use for single volume migration. Function analyze transition and validate if it is supported. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* reshape_super reorganizationKrzysztof Wojcik2011-01-13
| | | | | | | | | | | Function has been divided into two clear parts: 1. Container operations 2. Volume operations Prototype of imsm_analyze_change function has been added. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: spares are not countedAdam Kwolek2011-01-13
| | | | | | | | | | | | | Field info->array.spare_disks is used on begin of reshape_array() to check if there is enough number of spares to process reshape. During container_content_imsm() call spare disks are not counted. This causes that reshape_array() reports that there is not enough spares to execute reshape. Patch adds spares counting for reshape process. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: old devices memory has to be releasedAdam Kwolek2011-01-13
| | | | | | | | | | | | When process_update() replaces memory for bigger devices, old memory areas are collected in a list and has to be assigned in to pointer in update for later release. List created from old devices is created and attached to space_list for later releasing. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: local mdadm update shouldn't be done in update creation function.Adam Kwolek2011-01-13
| | | | | | | | | | | Local update is performed based on created update, so this code can broke local update and it is not necessary as prepare and process update functions are used. Code removed. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: mdadm should process local dataAdam Kwolek2011-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When update is created by mdadm, local information should be updated also. This makes us to prepare one update for mdmon and second "update" to maintain local changes. we can use prepared update for "local/mdadm" metadata update purposes. We have 2 cases: 1. when metadata is updated by mdmon, we avoid metadata reloading in mdadm. we proceed the same updtate 2 times: - one time in mdadm for "local update" - second time in mdmon for real metadat update 2. when metadata is updated by mdadm (no mdmon running) updates are processed in the same way. - one time in mdadm for "local update" - there is no "second time" update but mdadm just flushes metadata to array This let us to avoid code duplication by using prepare and process update functions as for update via mdmon. This makes update preparing mdmon independent and there is no need to maintain the same thing in 2 places in code. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: only one spare is passed in updateAdam Kwolek2011-01-12
| | | | | | | | Only one spare is passed in update. When more than one disk is added first spare is passed multiple times. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: set correct slot information in metadata (raid0)Adam Kwolek2011-01-12
| | | | | | | | Slot was set based on anchor information. Disks information was copied outside disk list area. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* load_super should not try to load_containerNeilBrown2011-01-12
| | | | | | | Now that load_container is a separate operation, load_super should not try it first. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: update disks status in container_contents()Adam Kwolek2011-01-12
| | | | | | | | | Based on status information disks are added to array during grow (in reshape_array()). This information currently is not present and all disks (old and new) were added to md. To avoid adding already present disks, disk.state has to be set. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Make child_monitor a candidate for ->manage_reshapeNeilBrown2011-01-12
| | | | | | | | | | | | 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>
* imsm: FIX: do not repair raid4 arraysAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: Update raid0 metadata for reshapeAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: Move reshape update processing to functionNeilBrown2011-01-06
| | | | | | | 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>
* imsm: Update metadata for second arrayAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: update array size information in metadataAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: FIX: Division by 0Adam Kwolek2011-01-06
| | | | | | | | | 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>
* imsm: Finalize reshape in metadataAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: FIX: support general migration by getinfo_super_imsm_volumeAdam Kwolek2011-01-06
| | | | | | | 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>
* imsm: FIX: update first array in container onlyAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: FIX: Perform first metadata update for container operationAdam Kwolek2011-01-06
| | | | | | | | | | | 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>
* imsm: FIX: display error messageAdam Kwolek2011-01-06
| | | | | | | | 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>
* imsm: FIX: display correct information for '-E' optionAdam Kwolek2011-01-06
| | | | | | | | | | 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>
* mdadm: second_map enhancement for imsm_get_map()Adam Kwolek2011-01-06
| | | | | | | | | | | 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>
* Use one function chosing spares from containerAnna Czarnowska2011-01-05
| | | | | | | | | | | | | | | | | 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>
* imsm: set imsm spare uuid to 0Anna Czarnowska2010-12-26
| | | | | | | | | | uuid_match_any is replaced by uuid_zero for imsm spares. Function fixup_container_spare_uuid not needed as it gives unwanted uuid to spares. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Bad block verification during assembling arrayKrzysztof Wojcik2010-12-26
| | | | | | | | | | | | | | | We need to refuse to assemble an arrays with bad blocks. Initially there was condition in container_content function that returns error value in the case when metadata store information about bad blocks. When the container_content function is called from functions NOT connected with assemble (Kill_subarray, Detail) we get faulty error return value. Patch introduces new flag in array.status - MD_SB_BBM_ERRORS. It is set in container_content when bad blocks are detected and can be checked by container_content caller. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Fill delta_disks field in getinfo_super()Adam Kwolek2010-12-16
| | | | | | | delta_disks field is not always filled during getinfo_super() call. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Do not indicate resync during reshapeAdam Kwolek2010-12-16
| | | | | | | | | If reshape is started resync is not allowed in parallel. This would break reshape. If array is in General Migration state do not indicate resync and allow for reshape continuation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Handle checkpointing during reshapeNeilBrown2010-12-16
| | | | | | | | | We need to allow metadata to handle progress of reshape, completion, and abort-before-start. Include all those in ->set_array_state() Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Block array state change during reshapeAdam Kwolek2010-12-16
| | | | | | | | | | Array state change is blocked due to reshape action in progress metadata changes are during applying. '1' is returned to indicate that array is clean Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Process reshape_update in mdmonAdam Kwolek2010-12-16
| | | | | | | | | | | | | | For this update prepare_update() allocates memory to relink imsm (bigger) device imsm structures. It calculates new /bigger/ anchor size. Process update applies update in to imsm structures. This includes - converting selected spares into configured devices - marking the arrays as migrating - making a new 'map' for each array with the changed details. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Allow a metadata update to have a linked list of allocated spaces.NeilBrown2010-12-16
| | | | | | | | | | | | Sometimes one metadata update will require allocating several larger data structures. As 'monitor' cannot allocate, 'manager' must, so it must be able to attach a list of allocates to the update, and importantly it must be able to easily free them. So add a 'space_list' element to metadata updates where each element on the list starts with a pointer to the next. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Prepare reshape_update in mdadmNeilBrown2010-12-16
| | | | | | | | | | | | | | | | | | | | | | | | During Online Capacity Expansion metadata has to be updated to show array changes and allow for future assembly of array. To do this mdadm prepares and sends reshape_update metadata update to mdmon. The update contains the old and new number of raid disks, and the indices of the spare disks that will be used to fill the spaces. This works as follows: 1. reshape_super() prepares metadata update. 2. mdadm discovers the spares and adds them to the array 3. mdadm sends the update to mdmon 4. managemon in prepare_update() allocates required memory for bigger device object 5. monitor in process_update() updates the metadata to record the new sizes and the newly assigned devices. 6. mdadm initiates the reshape Based on code From: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: add spares to --examine output.NeilBrown2010-12-16
| | | | | | | When we examine a container, list the spare devices as well as the active devices. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: imsm_add_spare() wrongly tests spares listAdam Kwolek2010-12-16
| | | | | | | | | | | For more than one disk tested additional_test_list was searched from last point, not from begin. This bug causes that more than 2 disks cannot be added to imsm array, when imsm_add_spare() is used for this. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: do not rebuild the array if a non-redundant sub-array with failed ↵Labun, Marcin2010-12-15
| | | | | | | | | | | | | | | | | | | | | disks is present Before looking for a spare to rebuild a degraded array, check if there are any failed disks in container. Block rebuild if another sub-array is failed until failed disks are removed from container. Currently, Intel metadata handler rebuilds all sub-arrays even if one of them is non-redundant. In case of failed sub-array, failed disks are just replaced with new ones in the metadata mapping. The data for failed disk is not restored even the disk is present in the system. With this fix, we require the removal of the failed disk from container to start the process of rebuilding the array with failed member. If the disk is physically pulled out of the system, the disk is removed from container automatically by exiting udev rules. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: Fix problem in mdmon monitor of using removed disk in imsm container.Labun, Marcin2010-12-15
| | | | | | | | | | | | | | | | | | | | | | | | | Manager thread shall pass the information to monitor thread (mdmon) that some devices are removed from container. Otherwise, monitor (mdmon) might use such devices (spares) to rebuild the array that has gone degraded. This problem happens for imsm containers, since a list of the container disks is maintained in intel_super structure. When array goes degraded, the list is searched to find a spare disks to start rebuild. Without this fix the rebuild could be stared on the spare device that was a member of the container, but has been removed from it. New super type function handler has been introduced to prepare metadata format specific information about removed devices. int (*remove_from_super)(struct supertype *st, mdu_disk_info_t *dinfo) The message prepared in remove_from_super is later processed by process_update handler in monitor thread. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.2NeilBrown2010-12-13
|\ | | | | | | | | Conflicts: super-intel.c
| * segfault in imsm create with wrong argumentsLuca Berra2010-12-13
| | | | | | | | | | | | | | | | | | When calling mdadm -C --metadata=imsm -l 1 /dev/sd.. mdadm segfaults in default_chunk_imsm() above syntax is incorrect, but mdadm should error instead of segfaulting Signed-off-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* | imsm: Allow multiple spares to be collected.Adam Kwolek2010-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assumption for spares searching was that after picking new device, it has to be added to array before next search. This causes returning different disk on each call. When creating a spare list during Online Capacity Expansion, we will first collect the devices list and then all devices are added to md. Picked device from spares pool has to be checked against picked devices so far. If not, the same disk will be returned all the time. Already picked devices are stored in the list and this list is used for new devices verification also. So add an extra arg to imsm_add_spare to hold a list of known spares to ignore. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | imsm: FIX: core dump during imsm metadata writingAdam Kwolek2010-11-29
| | | | | | | | | | | | | | | | | | Wrong number of disks during metadata update causes core dump. New disks number based on internal mdmon information has to used for calculation (not previously read from metadata). Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | imsm: Add support for general migrationAdam Kwolek2010-11-29
| | | | | | | | | | | | | | | | | | | | | | | | Internal IMSM procedures need to support the General Migration. It is used during operations like: - Online Capacity Expansion, - migration initialization, - finishing migration, - apply changes to raid disks etc. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Create: cleanup/unify default geometry handlingDan Williams2010-11-23
| | | | | | | | | | | | | | | | Support metadata specific level, layout and chunksize defaults. Kill an uneeded superswitch methods ahead of adding more for the reshape case. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Policy is aware of metadata disk's controller domains.Marcin Labun2010-11-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Platform (metadata) domain let the metadata handlers differentiate disk domains based on controllers that the disk belongs to. Platform domain is sub-domain inside user specified domain in mdadm.conf configuration files inheriting all parameters from it. The metadata domain name is used disk domain matching functions. The disk with the same metadata domain name belong to the same metadata domain. New metadata handler is added that retrieves platform domain string based on disk path: const char *(*get_disk_controller_domain)(const char *path); Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>