summaryrefslogtreecommitdiff
path: root/super1.c
Commit message (Collapse)AuthorAge
* super1: make sure 'room' includes 'bbl_size' when creating array.NeilBrown2014-08-21
| | | | | | Because we then go ahead and subtrace bbl_size from room. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: don't allow adding a bitmap if there is no space.NeilBrown2014-08-15
| | | | | | | | | | If the data is too close to the superblock there may be no space for a bitmap. If that happens, fail the adding of the bitmap rather than corrupt data. Reported-by: Lars Wijtemans <rhelbugzilla@lars.wijtemans.nl> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=922944
* config: new option to suppress adding bad block lists.NeilBrown2014-08-07
| | | | | | | | | | | | | | CREATE bbl=no in mdadm.conf will cause any devices added to an array to not have a bad block list. By default they do for 1.x metadata. This is useful if you are suspicious of the bad-block-list implementation. Reported-by: Ethan Wilson <ethan.wilson@shiftmail.org> Signed-off-by: NeilBrown <neilb@suse.de>
* super: make sure to ignore disk state flags that we don't understand.NeilBrown2014-08-07
| | | | | | | This make it easier to add new flags that some super-types don't understand. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: Do not reimplment offsetofCristian Rodríguez2014-05-22
| | | | | | Proper implementations have offsetof in stddef.h Signed-off-by: NeilBrown <neilb@suse.de>
* super1: fix setting of data_offset for 1.0 metadata.NeilBrown2013-08-14
| | | | | | | | | | commit 23bf42cc79d46de019d4b27c16354a191a98ed41 super1: simplify setting of array size. removed the setting for sb->data_offset for 1.0 metadata for some reason, and messed up the size calculation for 1.0 metadata too. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: simplify setting of array size.NeilBrown2013-07-30
| | | | | | | | | | | | | | | | | | Currently the extra space to leave before the data in the array is calculated in two separate places, and they can be inconsistent. Instead, do it all in validate_geometry. This records the 'data_offset' chosen which all other devices then use. 'write_init_super' now just uses the value rather than doing all the calculations again. This results in more consistent numbers. Also, load_super sets st->data_offset so that it is used by "--add", so the new device has a data offset matching a pre-existing device. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: separate to version of _avail_space1().NeilBrown2013-07-30
| | | | | | | | | | | | | | | | | _avail_space1() is calls from both avail_space1() and validate_geometry1() and does slightly different things. The partial code sharing doesn't really help. In particularly the responsibility for setting the size of the array is currently confused. So duplicate the code into the two locations - one where 'super' is always NULL (validate_geometry1) and one where it is never NULL (avail_space1), and simplify. No behaviour change - just code re-organisation. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: remove call to validate_geometry.NeilBrown2013-07-30
| | | | | | | | | | | | | | This call to validate_geometry is really rather gratuitous. It is purely about the fact that super0 cannot use more than 4TB. So just make it an explicit test - less confusing that way. With this, validate_geometry is only called from Create, which makes it easier to reason about. Also validate_geometry is now never passed NULL for the 'chunk' parameter, so we can remove those annoying tests for NULL. Signed-off-by: NeilBrown <neilb@suse.de>
* super0/1: fix typo in error messages.NeilBrown2013-07-24
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* super1: update data_size when performing "revert-reshape".NeilBrown2013-07-24
| | | | | | | | | | | The "data_size" is with respect to "data_offset". When the kernel changes "data_offset" it modifies "data_size" to match - see md_finish_reshape() in the kernel. So when mdadm switches the data_offset for the new data_offset, it must update data_size correspondingly. Signed-off-by: NeilBrown <neilb@suse.de>
* revert-reshape: only impose reshape_position tests on raid[456]NeilBrown2013-07-02
| | | | | | | This test is irrelevant for RAID10, so restrict it to those levels in which it is meaningful. Signed-off-by: NeilBrown <neilb@suse.de>
* revert-reshape: make sure reshape_position is acceptable.NeilBrown2013-06-27
| | | | | | | | | | We can only revert a reshape if the reshape_position aligns properly for the old geometry. If it doesn't we just fail for now. Also fix a +/- error with updating raid_disks for super1.c Signed-off-by: NeilBrown <neilb@suse.de>
* super1: fix space_{before,after} for RAID0NeilBrown2013-06-24
| | | | | | For RAID0 we need to use 'data_size', no 'size' as later is 0. Signed-off-by: NeilBrown <neilb@suse.de>
* Add test for --update=metadata and fix bug it found.NeilBrown2013-06-19
| | | | | | We were not setting device size correctly for raid0. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove lots of unnecessary white space.NeilBrown2013-06-19
| | | | | | | Now that I am using white-space mode in Emacs I can see all of this, and I don't like it :-) Signed-off-by: NeilBrown <neilb@suse.de>
* super1: set RESHAPE_NO_BACKUP based on new_offset.NeilBrown2013-05-28
| | | | | | | We need to check for a backup iff the data_offset has changed. Testing against level==10 was an effective but short-sighted approach. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow --update=revert-reshapeNeilBrown2013-05-28
| | | | This will cause a reshape to start going backwards.
* Assemble: --update=metadata converts v0.90 to v1.0NeilBrown2013-05-28
| | | | | | | | | | This allows the smooth conversion of legacy 0.90 arrays to 1.0 metadata. Old metadata is likely to remain but will be ignored. It can be removed with mdadm --zero-superblock --metadata=0.90 /dev/whatever Signed-off-by: NeilBrown <neilb@suse.de>
* super1: fix some casts of signed superblock fields.NeilBrown2013-05-28
| | | | | | | | | These need to be cast to uint32_t before being cast to 'long', else sign extension doesn't happen on 64bit hosts. And bitmap_offset is le32, not le64 !! Signed-off-by: NeilBrown <neilb@suse.de>
* Examine/super1 - report Unused space, before and after.NeilBrown2013-05-22
| | | | | | Might be confusing, or might be useful when reshaping. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: don't put the bblog at the end of the free space.NeilBrown2013-05-22
| | | | | | | | | It seems like a nice location, but it means that we cannot decrease the data_offset during a reshape. So put it just after the bitmap, leaving 32K. 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>
* super1: improve calculation of space_before/space_afterNeilBrown2013-05-21
| | | | | | | | 1/ these must allow for bad-block-list 2/ they must match the kernel, which has a 32k buffer after the superblock. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine/super1: don't report "New Offset" when feature not set.NeilBrown2013-05-21
| | | | | | | The "new_offset" field may be non-zero, but if the feature flag is not set, it should be ignored. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --dump / --restore functionality.NeilBrown2013-05-16
| | | | | | | | This allows the metadata on a device to be saved and later restored. This can be useful before experimenting on an array that is misbehaving. Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Always test return value of posix_memalign.NeilBrown2013-05-13
| | | | | | FORTIFY_SOURCE likes this, and it is good practice. Signed-off-by: NeilBrown <neilb@suse.de>
* mdassemble - fix new compile-time problems.NeilBrown2013-05-13
| | | | 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>
* make --update=homehost work againNeilBrown2013-02-10
| | | | | | | | | | Commit 1e2b276535cea41c348292a019bdda8a58cb1679 (Report error in --update string is not recognised) broke homehost updating functionality because it depended on each string comparison being done even after we already found a match. Make it work again by restructuring code. Reported-by: (and original version by) Justin Maggard <jmaggard10@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Avoid using BLKFLSBUF.NeilBrown2013-02-05
| | | | | | | | | | | Now that we use O_DIRECT for all device IO, BLKFLSBUF is not needed to ensure we get current data, and it can impose a cost if any flush-out is needed. So remove it. To be safe, add O_DIRECT to one place where it isn't currently used: when reading a bitmap. Signed-off-by: NeilBrown <neilb@suse.de>
* MISC: Add --examine-badblocks optionNeilBrown2012-12-05
| | | | | | This will list the contents of the bad-blocks log, if one is present. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: support replacement devices.NeilBrown2012-10-24
| | | | | | These need to be counted in the number of 'active' devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: add support for replacement devices.NeilBrown2012-10-24
| | | | | | | Need to possibly collect 2 devices for each slot, and original and a replacement. Signed-off-by: NeilBrown <neilb@suse.de>
* Report replacement devices correctly with --detail and --examineNeilBrown2012-10-23
| | | | | | | | --detail needs to be read to report 2 devices in each slot, and --examine need to report if the device is the original or the replacement. Signed-off-by: NeilBrown <neilb@suse.de>
* Replace a lot of leading spaces with tabs.NeilBrown2012-10-10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Allow data-offset to be specified per-device for createNeilBrown2012-10-04
| | | | | | | | | mdadm --create /dev/md0 .... /dev/sda1:1024 /dev/sdb1:2048 ... The size is in K unless a suffix: K M G is given. The suffix 's' means sectors. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: reserve at least 2 chunks for reshape headroom.NeilBrown2012-10-04
| | | | | | | | sometimes 0.1% isn't enough, though mostly only in testing. We need one chunk for a successful reshape, so reserve 2. Signed-off-by: NeilBrown <neilb@suse.de>
* New RESHAPE_NO_BACKUP flag to track when backup action is needed.NeilBrown2012-10-04
| | | | | | | | | | | | Some arrays (raid10) never need a backup file, so during assembly we can avoid the whole Grow_continue check in that case. Achieve this using a flag set by the metadata handler. Also get "mdadm -I" to fail if a backup process would be needed. It currently does fail as the kernel rejects things, but it is nicer to have this explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Add space_before/space_after fields to mdinfoNeilBrown2012-10-04
| | | | | | | These will be needed to guide changes to data_offset during reshape. Only set them for super1 for now. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: add new_offset field.NeilBrown2012-10-04
| | | | | | | | | The 'new_offset' is used for reshaping to avoid the need for a backup file. For now we only report the value when it is set. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->init_super and use it in super1.cNeilBrown2012-10-04
| | | | | | | So if ->data_offset is already set, use that rather than computing one. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->validate_geometry.NeilBrown2012-10-04
| | | | | | | This is needed to return correct available size. It isn't really used yet. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->avail_sizeNeilBrown2012-10-04
| | | | | | | This is currently only useful for 1.x metadata and will allow an explicit --data-offset request on command line. Signed-off-by: NeilBrown <neilb@suse.de>
* Handles spaces in array names better.NeilBrown2012-10-04
| | | | | | | | | | | | 1/ When printing the "name=" entry for --brief output, enclose name in quotes if it contains spaces etc. Quotes are already supported for reading mdadm.conf 2/ When a name is used as a device name, translate spaces and tabs to '_', as well as the current translation of '/' to '-'. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: ensure bitmap doesn't overlap bad block log.NeilBrown2012-10-03
| | | | | | | If a bad block log already exists when adding a bitmap, make sure the bitmap stays before the log. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow --update to add or remove space for a bad block list.NeilBrown2012-10-03
| | | | | | | | --update=bbl will add a bad block list to each device. --update=no-bblk will remove the bad block list providing that it is empty. Signed-off-by: NeilBrown <neilb@suse.de>
* Bad block logNeilBrown2012-10-03
|
* Add MD_ARRAY_SIZE for --examine --exportMaciej Naruszewicz2012-10-02
| | | | | | | An additional pair of key=value for --examine --export. Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> 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>