summaryrefslogtreecommitdiffstats
path: root/Grow.c
Commit message (Collapse)AuthorAgeFilesLines
* Grow: be more careful when using array.sizeNeilBrown2009-11-261-8/+14
| | | | | | | | As array.size is 32bit we need to prefer the 'component_size' read from sysfs when that is available. Grow wasn't always suitably careful. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: avoid truncation error when checking size of array.NeilBrown2009-11-261-1/+1
| | | | | | | | | | array.size is only 32bit so it is not safe to multiply it up before casting to (long long). Actually, we shouldn't be using array.size here at all, but that will get fixed in a subsequent patch. Reported-by: Andrew Burgess <aab@cichlid.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: various fixes to recent breakages.NeilBrown2009-11-171-5/+8
| | | | | | | - I forgot to write the send backup-super-block on spares. - I wasn't adding the data_offset to an offset Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: data_offset is in sectors, offsets[] is in bytes - convertNeilBrown2009-11-161-1/+1
| | | | | | Another missed sectors->bytes conversion. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: do not allow size changes with other changes.NeilBrown2009-11-061-0/+9
| | | | | | | | | | | A change the reduces the size of an array always happens before any other change. So it can cause data to be lost. By themselves these changes are reversible. But once another change has started, the data would be permanently lost. So recommend data integrity be checked between a size change and any other change. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: goto release rather than just returnNeilBrown2009-11-061-4/+8
| | | | | | otherwise we exit with the array frozen. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: restrict to 2.6.32NeilBrown2009-11-061-0/+6
| | | | | | | | | 2.6.31 has a bug which can lead to unsafe reshaping. So only allow a reshape with 2.6.32. When the required fixed get into 2.6.31.y, this can be relaxed slightly Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: use large block count and make sure stripe cache can hold it.NeilBrown2009-11-061-7/+27
| | | | | | | | The bigger the backup is, the fast it goes to some extend. 16Meg is fairly arbitrary Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: get component_size before using it.NeilBrown2009-11-061-4/+5
| | | | | | | | We were using ->component_size while it hadn't been set. This effectively meant that 'blocks' wasn't multiplied by 16 and reshape was even slower than it should have been. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: handle array going degraded during reshape.NeilBrown2009-11-061-6/+35
| | | | | | | | If an array goes degraded during reshape, we need to adjust the devices we read from so as not to back up stale data. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: restore backup to proper location.NeilBrown2009-11-061-2/+2
| | | | | | | | | | The 'arraystart' is in sectors while restore_stripes requires bytes, so we need a conversion. Without this, backups get restored to the wrong offset. Reported-by: "KueiHuan Chen" <kueihuan.chen@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: update backup-metadata mtime every time we write it.NeilBrown2009-10-221-2/+4
| | | | | | | | | | | | | | | | | | | | | | Originally the backup-metadata was only written once at the start of a raid5 reshape that made the array bigger. So we only set the mtime once. Now that we can be writing metadata continually during an in-place reshape, we need to update the mtime more often. Also, allow the metadata mtime to be slightly in advance of the array mtime. Normally the difference will be less than a second, so 10 minutes should be plenty. This guards against an old backup file being used to restart an array. but starting two reshapes in the 10 minutes is sufficiently unlikely, and the possibility of an accident is already sufficiently small, that 10 minutes is probably fine. Thanks to Guy Martin <gmsoft@tuxicoman.be> for discovering and reporting that .mtime wasn't being updated properly. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: reject raid-disks reduction in RAID5 etc before 2.6.32NeilBrown2009-10-201-1/+9
| | | | | | | 2.6.31 has some bugs with restarting a RAID5 reduction, so refuse to try unless at least 2.6.32. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: print more verbose messages about restarting a reshapeNeilBrown2009-10-201-18/+57
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Add missing 'continue' in Grow_restart.NeilBrown2009-10-201-0/+1
| | | | | | Thus we weren't checking the uuid properly. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow_restart to handle reducing number of devices in an array.NeilBrown2009-10-161-10/+31
| | | | | | | | | | FIXME this is wrong . what direction does reshape_position move? If the device count in an array is shrinking, the critical region is different so the tests need to be different when restarting. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: don't make 'blocks' too large during in-place reshape.NeilBrown2009-10-161-3/+7
| | | | | | | On small (test) arrays, multiplying by 16 can make the 'chunk' size larger than half the array, which is a problem. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: ignore error from final wait_backupNeilBrown2009-10-121-12/+8
| | | | | | | | | The last time wait_backup is called, it might see reshape finish and so return an error indicator. But this is not an error, and we must go ahead and prepare the array for full access. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: make sure bsb2 is properly alignedNeilBrown2009-10-121-3/+2
| | | | | | | We do O_DIRECT io in bsb2, so it must be aligned properly. Easiest if it is static. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.1NeilBrown2009-10-011-7/+2
|\ | | | | | | | | Conflicts: mdadm.8
| * Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-7/+2
| | | | | | | | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* | Grow: support restart of new migrations.NeilBrown2009-08-131-28/+251
| |
* | Handle extra 'grow' variations.NeilBrown2009-08-111-298/+921
| | | | | | | | UNFINISHED
* | restripe: support saving when not all devices are present.NeilBrown2009-07-141-1/+3
| |
* | Grow: --size improvements.NeilBrown2009-07-141-1/+14
| | | | | | | | | | | | | | 1/ allow --size to be given with 'G' or 'T' suffix. 2/ allow size to exceed 32bits, and in that case write through sysfs. Signed-off-by: NeilBrown <neilb@suse.de>
* | Grow: pass layout as a string rather than a number.NeilBrown2009-07-141-6/+32
|/ | | | | | | | This allows the layout to be parsed after the current level of the array is know, so that the level doesn't need to be given (otherwise pointlessly) on the command line. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0NeilBrown2009-04-141-0/+1
|\ | | | | | | | | | | | | | | | | Conflicts: Grow.c mdadm.h sysfs.c Due to independent fixes for the "mdadm hangs if reshape finishes too quickly" problem.
| * Grow: fix hang when reshape completes too fastDan Williams2009-04-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | For short reshapes the kernel may be done before mdadm can check that progress has passed the critical section. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | grow: don't wait forever for critical section to pass.NeilBrown2009-04-011-0/+8
|/ | | | | | | | | | If an array reshape completed within 1 second, then --grow will not notice that it has finished and will keep waiting for the critical section to pass. So be more cautious in the test. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix alignment for backup of reshape data.NeilBrown2008-08-191-6/+6
| | | | | | | | Since we introduced O_DIRECT for device access we need properly aligned buffers and IO requests. The reshape code missed out on the conversion. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into from-stableNeilBrown2008-08-071-3/+4
|\ | | | | | | | | | | | | Conflicts: Create.c Manage.c
| * Clean up usage of open()Doug Ledford2008-07-241-1/+1
| | | | | | | | | | | | | | | | Fix on call that passed an invalid mode to open Don't pass a third arg unless we also pass O_CREAT Use symbolic args for 2nd and 3rd args Signed-off-by: Doug Ledford <dledford@redhat.com>
| * Add test for stoping and restarting a raid5 reshape.Neil Brown2008-06-271-2/+3
| | | | | | | | | | There was a kernel bug with stopping and restarting raid5 recently. So add a test to check for it.
* | Use O_DIRECT for all IO to devices.Neil Brown2008-07-121-1/+1
|/ | | | | | | | Using buffered IO risks non-atomic updates to parts of the device that we don't actually want to write to. This isn't in general safe. So switch to O_DIRECT for all that IO and make sure we have properly aligned buffers.
* Replace sysarray with mdinfoNeil Brown2007-12-141-4/+4
| | | | | Sure, mdinfo is bigger, but having a uniform structure for lots of things will make life easier.
* Use 'mdinfo' instead of special 'sysdev' structure.Neil Brown2007-12-141-9/+12
| | | | | there is needless duplicatiion between mdinfo and sysdev, so discard the latter.
* Find super from fd on an array.Neil Brown2007-12-141-4/+4
| | | | | We used to use the major/minor numbers, but that isn't sufficient any more, so pass the fd, and possibly check 'text' version.
* Drop the superblock arg from all metadata methods.Neil Brown2007-12-141-34/+27
| | | | It is now in the 'supertype'
* Add 'supertype' arg to almost all metadata methods.Neil Brown2007-12-141-12/+14
| | | | The 'superblock' will be moved into this structure soon.
* Allow metadata handlers to free their own superblock.Neil Brown2007-12-141-4/+7
| | | | | | As the metadata handler allocates the superblock, it should free it too. DDF will have a more complex 'superblock' which needs more complex freeing.
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-4/+4
|
* Fix restarting of a reshaping array.Neil Brown2007-10-161-0/+21
| | | | | | | | The last release broke the ability to assemble an array that was in the middle of a reshape. This patch adds code to test if the critical section needs to be restored or not so that - if we have failed to restore it, we know whether to fail or not.
* Report error when grow cannot be restarted.Neil Brown2007-08-201-3/+2
| | | | | | Make sure that if --assemble find an array in the critical region of a reshape, and cannot find the critical data to restart the reshape, it gives an error message.
* Improve error message for adding bitmap to a level that cannot support it.Neil Brown2007-05-211-0/+5
| | | | Also give error on --build if no devices given.
* Fix --grow --add for linear arrays.Neil Brown2007-05-211-8/+7
| | | | | | | | | | | | | The new superblock needs to have a new disk.number. This is a bit of a hack... Fix handling of negative bitmap offsets on 64bit hosts. The bitmap offset is a signed 32bit number, so casting to (long) isn't sufficient. We must cast to (int32_t). Fix various problems with --grow --add for linear. The code to add a drive to a live linear array had never been tested properly and so was buggy. This tidies it up and means that the new regression-test passes.
* Central calls to ioctl BLKGETSIZENeil Brown2006-12-141-3/+1
| | | | Instead of opencoding the same thing everywhere.
* Increase raid456 stripe cache size if needed to --grow the array.Neil Brown2006-12-141-2/+18
| | | | | The setting used unfortunately requires intimate knowledge of the kernel, and it not reset when the reshape finishes.
* Improve allocation and use of space for bitmaps in version1 metadataNeil Brown2006-12-141-3/+5
| | | | | | | | | | Depending on the size of the array we reserve space for up to 128K of bitmap, and we use it where possible. When hot-adding to a version 1.0 we can still only use the 3K at the end though - need a sysfs interface to improve that. If a small chunksize is requested on Create, we don't auto-enlarge the reserved space - this still needs to be fixed.
* Stop map_dev from returning [0:0]Neil Brown2006-06-201-2/+2
| | | | | We sometimes need the NULL when major==minor==0. So make sure all callers of map_dev can cope with NULL.
* check return status of all write/fwrite functions as required by glibc 2.4Neil Brown2006-05-291-1/+4
| | | | | | | | | | | | From: Luca Berra <bluca@vodka.it> glibc 2.4 is pedantic on ignoring return values from fprintf, fwrite and write, so now we check the rval and actually do something with it. in the Grow.c case i only print a warning, since i don't think we can do anything in case we fail invalidating those superblocks (is should never happen, but then...) Signed-off-by: Neil Brown <neilb@suse.de>