summaryrefslogtreecommitdiff
path: root/Grow.c
Commit message (Collapse)AuthorAge
...
* Grow: allow --data-offset to be specified for raid4/5/6NeilBrown2013-05-22
| | | | | | Previously it was rejected for non-RAID10. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: allow metadata to indicate that changing data_offset not supported.NeilBrown2013-05-22
| | | | | | | If space_after and space_before are zero (the default) then assume that metadata doesn't support changing data_offset. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: use new_data_offset instead of backups for raid4/5/6 reshape.NeilBrown2013-05-22
| | | | | | | | If we can modify the data_offset, we can avoid doing any backups at all. If we can't fall back on old approach - but not if --data-offset was requested. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: introduce min_offset_change to struct reshape.NeilBrown2013-05-22
| | | | | | | | | raid10 currently uses the 'backup_blocks' field to store something else: a minimum offset change. This is bad practice, we will shortly need to have both for RAID5/6, so make a separate field. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: have analyse_change zero the reshape structure first.NeilBrown2013-05-22
| | | | | | | This is generally safer and means we can remove lots of zero assignments. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c: split impose_reshape out as a function.NeilBrown2013-05-21
| | | | | It will be useful soon. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c: split out update_cache_size() function.NeilBrown2013-05-21
| | | | | | | Make this a separate function as I might want to call it from another location. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c remove some pointless casts on 'data_offset'.NeilBrown2013-05-21
| | | | | | 'data_offset' is 'unsigned long long' so the cast is pointless. Signed-off-by: NeilBrown <neilb@suse.de>
* Change some fprintf(stderrs to cont_err()NeilBrown2013-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change some "fprintf(stderr,"s to pr_err.NeilBrown2013-05-21
| | | | | | They just keep slipping in.. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: set_new_data_offset should report if kernel is too old.NeilBrown2013-05-21
| | | | | | | | | For RAID5, not being able to set new_data_offset because of old kernel is not a problem. So make this fatal on for RAID10. Also remove an unused assignment to 'rv'. Signed-off-by: NeilBrown <neilb@suse.de>
* comment typoNeilBrown2013-05-21
|
* Grow: just pass delta_disks instead of all of 'info'.NeilBrown2013-05-21
| | | | | | | That is all we need, so make purpose of code more obvious by only passing delta_disks. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: split out code for setting new_data_offsetNeilBrown2013-05-21
| | | | | | | This will soon be used for more than just RAID10, so it deserves independent existence. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: replace '1' with 'INVALID_SECTORS' where appropriate.NeilBrown2013-05-21
| | | | | | | Here are some '1's which missed the introduction of INVALID_SECTORS as a useful #define. Signed-off-by: NeilBrown <neilb@suse.de>
* Discard devnum in favour of devnmNeilBrown2013-02-21
| | | | | | | | | | | | | | We widely use a "devnum" which is 0 or +ve for md%d devices and -ve for md_d%d devices. But I want to be able to use md_%s device names. So get rid of devnum (a number) and use devnm (a 32char string). eg. md0 md_d2 md_home Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix problem with reshaping RAID4 to RAID0.NeilBrown2013-02-21
| | | | | | | | | As 'layout' doesn't map neatly from RAID4 to RAID5, we need to set it correctly for RAID4. Also, when no reshape is needed we should set re->level to the final desired level. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: disallow --size changes on RAID0 and Linear.NeilBrown2013-02-21
| | | | | | These aren't meaningful and must be disabled. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix bug when multiple arrays present.NeilBrown2012-11-22
| | | | | | | | | | commit 1f9b0e2845e1ec22dc24dcef275a733c09ff2edd Grow - be careful about 'delayed' reshapes. Introduced a bug where a list of devices longer than 1 would cause an infinite loop. Oops. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c: fix uninitialized variables compilation-time errorLukasz Dorau2012-11-20
| | | | | | | | | | | | | | | It fixes the following uninitialized variables compilation-time error: WARN - Grow.c: In function ‘reshape_array’: WARN - Grow.c:2413:21: error: ‘min_space_after’ may be used uninitialized in this function [-Werror=maybe-uninitialized] WARN - Grow.c:2376:39: note: ‘min_space_after’ was declared here WARN - Grow.c:2414:22: error: ‘min_space_before’ may be used uninitialized in this function [-Werror=maybe-uninitialized] WARN - Grow.c:2376:21: note: ‘min_space_before’ was declared here WARN - cc1: all warnings being treated as errors WARN - make: *** [Grow.o] Error 1 It occurs during compilation of mdadm on Fedora 17. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix reshape from RAID5 to RAID1.NeilBrown2012-11-20
| | | | | | | | | | | Commit 5da9ab9874cb5896023afae1462550d83a869831 Grow_reshape re-factor in mdadm-3.2 broke conversion from RAID5 and RAID1 - and we never noticed. This fixes it. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix a couple of typos with --assume-clean usageNeilBrown2012-10-11
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: allow --grow --continue to work for native metadata.NeilBrown2012-10-09
| | | | | | | | As it was the code would crash due to "mdstat" being NULL. Code is now more sane, but hasn't been tested on an array that needs to grow. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow/raid10: support reducing the devices in a RAID10.NeilBrown2012-10-04
| | | | | | | | | | | | | | | | When reducing the number of devices in a RAID10, we increase the data offset to avoid the need for backup area. If there is no room at the end of the device to allow this, we need to first reduce the component size of each device. However if there is room, we don't want to insist on that, otherwise growing then shrinking the array would not be idempotent. So find the min before/after space before analysing a RAID10 for reshape, and if the after space is insufficient, reduce the total size of the array and the component size accordingly. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: add raid10 reshape.NeilBrown2012-10-04
| | | | | | | | RAID10 reshape requires that data_offset be changed. So we only allow it if the new_data_offset attribute is available, and we compute a suitable change in data offset. Signed-off-by: NeilBrown <neilb@suse.de>
* Split 'GCD' out into a separate function.NeilBrown2012-10-04
| | | | | | It is neater that way. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --data-offset flag for Create and GrowNeilBrown2012-10-04
| | | | | | | | | | This can be used to over-ride the automatic assignment of data offset. For --create, it is useful to re-create old arrays where different defaults applied. For --grow it may be able to force a reshape in the reverse direction. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: make warning about old metadata more explicit.NeilBrown2012-10-03
| | | | | | | Don't print it just when --verbose is set, and explain how to over-ride it. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow - be careful about 'delayed' reshapes.NeilBrown2012-10-03
| | | | | | | | | | | | | | | | | | If multiple reshapes are activated on the same devices (different partitions) then one might be forced to wait for the other to complete. As reshaping suspends access to small sections of the array at time, this cause a region to be suspended for a long time, which isn't good. To try to detect this and don't start suspending until the reshape is actually happening. This is only effective on 3.7 and later as prior kernels don't report when the delayed reshape can progress. For the earlier kernels, just give a warning. Signed-off-by; NeilBrown <neilb@suse.de>
* grow: fix typo : MAX_DISKS -> MAX_SIZENeilBrown2012-09-20
| | | | | | oopps. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c: change size to be unsigned and use '0' in case of 'no change'Lukasz Dorau2012-08-13
| | | | | | | | | The 'size' has been changed to be unsigned recently. Analogous changes should be made to reshape_super(). '0' should be used in case of 'no change' now. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Minor cosmetic fixes in various files.NeilBrown2012-08-13
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Fix default size calculations that were recently broken.NeilBrown2012-08-13
| | | | | | | | | | commit d04f65f48c93e7e57cc3c1d70dd07d094dece717 Change the values for "max size" from -1 to 1. Messed up 's->size' - leaving it as '1' (MAX_SIZE) in some cases and causing the array reshape to fail. Signed-off-by: NeilBrown <neilb@suse.de>
* Use new struct context and struct shape for Grow_addbitmapNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use new struct context and struct shape in Grow_reshapeNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change the values for "max size" from -1 to 1.NeilBrown2012-07-09
| | | | | | | | Both are impossible, and '1' allows size to be unsigned, which is neater. Also #define MAX_SIZE to be '1' to make it all more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Convert 'quiet' to 'not verbose' in various places.NeilBrown2012-07-09
| | | | | | | | If we change some functions to accept 'verbose', where <0 means to be quiet, in place of 'quiet', then we will be able to merge 'quiet' and 'verbose' together for simplicity. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: don't print message if unfreezing fails.NeilBrown2012-05-15
| | | | | | | | This is most likely to happen if the array has been stopped, in which case the error is pointless. Reported-by: Patrik Horník <patrik@dsl.sk> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix --layout=preserve to match man page.NeilBrown2012-05-15
| | | | | | | | | | | I think there was some confusion about what --layout=preserve actually means, but in any case it wasn't doing what the man page says it should. So add some case analysis and make sure it does the right thing, or complains if it cannot. Reported-by: Patrik Horník <patrik@dsl.sk> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: failing the set the per-device size is not an error.NeilBrown2012-05-03
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce sysfs_set_num_signed() and use it to set bitmap/offsetJes Sorensen2012-04-30
| | | | | | | | | | mdinfo->bitmap_offset is a signed long and needs to be treated as such when passed to the kernel. This resolves the problem with adding internal bitmaps to a 1.0 array. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: correct extending size of raid0 arrayLukasz Dorau2012-04-23
| | | | | | | | | Setting "sync_action" to "idle" while extending size of raid0 array is racy and sometimes fails. "sync_action" should be set to "frozen" instead. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Size change is possible as standalone change onlyAdam Kwolek2012-04-17
| | | | | | | | Size change is possible as standalone change only. To make sure size change is not requested pass '-1' as size parameter. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Detect error and rollback metadataAdam Kwolek2012-04-17
| | | | | | | | | Some setting size error cases were not detected. When error occurs, stop setting new size action and rollback metadata changes. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Respect metadata size limitationsAdam Kwolek2012-04-17
| | | | | | | | | When reshape_super() updates metadata with new size, due to some metadata limitations saved value can be different than requested value by user. Update size (read it from metadata) for setting it in md. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Extend size of raid0 arrayAdam Kwolek2012-04-17
| | | | | | | | | For raid0, takeover operation is required for size change. Add takeover to degraded raid4 before size change and back to raid0 after. Array information has to be read again from md after takeover. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Support metadata changes rollbackAdam Kwolek2012-04-17
| | | | | | | | | | | | | | Function reshape_super() guards metadata changes. It is used to apply changes rollback in error case also. As change (apply and rollback) can be not bi-directional reshape_super() has to know if current action is metadata change that should be guarded using metadata restrictions, or this is metadata rollback change executed due to error occurrence. In second case change has to be unconditional. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Execute size change for external metatdataAdam Kwolek2012-04-17
| | | | | | | | | For external metatdata ioctl doesn't set new size. Set new size using sysfs. Put code for size change in to function to re-use the same code as during On-line Capacity Expansion Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>