summaryrefslogtreecommitdiff
path: root/super-ddf.c
Commit message (Collapse)AuthorAge
...
* DDF: ddf_activate_spare: fix gcc -O2 uninitialized warningNeilBrown2013-08-28
| | | | | | | | | At this point 'di' and 'rv' both have the same value. gcc doesn't realise that and a human reader might not either. 'rv' makes more sense too, so use that. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_open_new: check device status for new subarraymwilck@arcor.de2013-08-08
| | | | | | | | | | | It is possible that mdadm creates a new subarray containing failed devices. This may happen if a device has failed, but the meta data containing that information hasn't been written out yet. This code tests for this situation, and handles it in the monitor. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: Write new conf entries with a single write.NeilBrown2013-08-07
| | | | | | | | | | | | | The recent change to skip over invalid conf entries was bad because it could leave garbage on the disk. But we don't to write each entry separately as the writes a O_DIRECT and so synchronous so it takes way too long. So allocate a large buffer (probably the one used to read the config records) and fill that then write it all at once. Reported-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: get_extents: don't allocate space on failed disksmwilck@arcor.de2013-08-06
| | | | | | | | We should skip known failed disks when allocating space for new arrays. This fixes the problem with 10ddf-fail-spare. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix removal of failed devices.NeilBrown2013-08-05
| | | | | | | | | | | | | | | | | | | | | | Commit c7079c84 arrange for DDF to forget about any device that is failed and not still marked as part of any array. However such devices could still be part of the container and this removal and updating of 'pdnum' can result in multiple devices having the same pdnum. This in turn easily leads to confusion and corruption. So only discard pd entries for devices which are failed, not listed in any virtual device, and for which we don't have a handle on the device. pd entries will not get removed until a new device is added after the device has been removed from the container, either by "mdadm --remove" or by assembling without the failed devices. Reported-by: Albert Pauw <albert.pauw@gmail.com> Analysed-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix writing metadata updates.NeilBrown2013-08-05
| | | | | | | | | | Recent commit 273989b93a3185c0e4d54f0d1bc404248a92d157 skipped writing some large blocks of 0xFF, but didn't seek over the space, so subsequent data was written wrongly. When we don't write, we need to seek. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: no need for GET_LAYOUT any moremwilck@arcor.de2013-08-05
| | | | | | | With the previous patch, mdmon will provide the layout property for us. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: differentiate between new metadata and metadata updates.NeilBrown2013-08-01
| | | | | | | When writing an update, we don't need to overwrite lots of empty fields. This makes updates somewhat faster. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: use some #defines instead of bare constants.NeilBrown2013-08-01
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_set_disk: add some debug messagesMartin Wilck2013-07-31
| | | | | | | | Adds more verbose debugging in ddf_set_disk, to understand failures better. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: load_ddf_header: more error loggingMartin Wilck2013-07-31
| | | | | | | | Try to determine problem if load_ddf_header fails. May be useful for determining compatibility problems with Fake RAID BIOSes. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: log offsets for conf changesMartin Wilck2013-07-31
| | | | | | | | I needed this for tracking a bug with wrong offsets after array creation. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: log disk status changes more nicelyMartin Wilck2013-07-31
| | | | | | | | In particular, include refnum for better tracking. This makes it a little easier for humans to track what happened to which disk. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_activate_spare: bugfix for 62ff3c40Martin Wilck2013-07-31
| | | | | | | | Move the check for good drives in the dl loop - otherwise dl may be NULL and mdmon may crash. Signed-off-by: Martin Wilck <mwilck@arcor.de> 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>
* DDF: ddf_activate_spare: fix metadata update for SVDsmwilck@arcor.de2013-07-30
| | | | | | | Metadata updates for secondary RAID (RAID10) need to cover all BVDs. Compare with code in write_init_super_ddf(). Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_activate_spare: only activate good drivesmwilck@arcor.de2013-07-30
| | | | | | Do not try to activate drives marked missing or failed. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_activate_spare: Add RAID10 codemwilck@arcor.de2013-07-30
| | | | | | | The check for degraded array is a bit more complex for RAID10. Fixing it. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: find_vdcr: fix minor bug in debug messagemwilck@arcor.de2013-07-30
| | | | | | This code could find disk -1. Fixed. Signed-off-by: NeilBrown <neilb@suse.de>
* super-ddf: allow mdassemble to compile.NeilBrown2013-07-23
| | | | | | Just add/move some #ifdefs and move some code. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: convert big-endian __u16 to be16 typemwilck@arcor.de2013-07-23
| | | | | | | Last step of endian-safe recoding. This requires also bit operations. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: convert big-endian __u64 to be64 typemwilck@arcor.de2013-07-23
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: convert big endian to be32 typemwilck@arcor.de2013-07-23
| | | | | | Part 2 of endianness-safe conversion Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add endian-safe typedefsmwilck@arcor.de2013-07-23
| | | | | | | This adds typedefs for big-endian numbers. This will hopefully reduce the number of endianness bugs I make. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: getinfo_super_ddf_bvd: fix offset calculation for SVDsmwilck@arcor.de2013-07-22
| | | | | | | Fix a bug that caused the wrong conf record to be used to derive data offset and size on secondary RAID (RAID10). Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: kill_subarray_ddf: fix case without mdmon runningmwilck@arcor.de2013-07-22
| | | | | | | When mdmon wasn't runnning, meta data wasn't committed to disk. Fixed. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: err_bad_md_layout: fix return valuemwilck@arcor.de2013-07-22
| | | | | | This function must use -1 to indicate failure. Fix it. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: factor out writing super block to single diskmwilck@arcor.de2013-07-22
| | | | | | | Factor out single disk from __write_init_super_ddf to a new function _write_super_to_disk. Use this function in store_super_ddf. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: make "null_aligned" a static buffermwilck@arcor.de2013-07-22
| | | | | | | Use a static buffer for this "zero page". This makes it easier to factor out the header writing code. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: increase seq number in ddf_set_updates_pendingmwilck@arcor.de2013-07-22
| | | | | | | | | Increase seq number only when there's actually a metadata change. This is better then increasing it at every write. This also fixes another endianness bug. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF load headers: if primary is invalid, don't check fields.NeilBrown2013-07-10
| | | | | | | | Currently we compare fields between primary and secondary superblocks, before we check if the primary is even valid. This is a bit backwards, so reverse it. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: Fix updates for SVDsmwilck@arcor.de2013-07-10
| | | | | | | | | | | The "indirect" code path for adding VDs was not working correctly for secondary RAID level. The "other BVDs" were not transmitted to mdmon. Thus mdmon wouldn't build up correct information, and RAID creation would fail when mdmon was already running on the container. This patch fixes this. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: some more debug messagesmwilck@arcor.de2013-07-10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: guid_str: more readable outputmwilck@arcor.de2013-07-10
| | | | | | Print ASCII characters as ASCII Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: add debug messages fore adding VDsmwilck@arcor.de2013-07-10
| | | | | | Add some debug messages for the DDF_VIRTR_RECORDS_MAGIC case. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add debug message in add_super_ddf_bvdmwilck@arcor.de2013-07-10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix endianness of refnum in debug messagesmwilck@arcor.de2013-07-10
| | | | | | | This makes it easier to match the debug output to existing structures. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: getinfo_super_ddf_bvd: fix raid_disk calculationmwilck@arcor.de2013-07-10
| | | | | | | | | | | | | | | | The return value of disk.raid_disk may be wrong. The old code was using raiddisk, which is only valid with auto layout. This leads to errors when arrays are created with specified disks and mdmon is already running, like this: mdadm -CR /dev/md/container -n5 $d1 $d2 $d3 $d4 $d5 mdadm -CR /dev/md/r5 -n5 -l5 /dev/md/container -z 5000 mdadm -CR /dev/md/r1 -n2 -l1 $d1 $d2 => resulting array will use wrong disks This patch fixes that. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: getinfo_super_ddf_bvd: identify disk by refnummwilck@arcor.de2013-07-10
| | | | | | | Use refnum rather than raiddisk for identifying the physical disk. raiddisk should only be used for auto-layout. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: implement kill_subarraymwilck@arcor.de2013-07-10
| | | | | | | | | | | Implement kill_subarray, for mdmon running and not running. The way Kill_subarray() is implemented, this requires that the DDF layer uses "currentconf" to remember the last subarray queried with container_content(), and use it as the one to kill. I don't like this much but IMSM does it the same way. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: write_init_super_ddf: don't zero superblocks for subarraysmwilck@arcor.de2013-07-10
| | | | | | | | | | | | | commit d682f344 inserted this call to "Kill" in write_init_super_ddf: "Matching the functionality already in super0 and super1, when we first create a container, remove any other recognisable metadata to ensure it doesn't cause confusion." But we should do this only at first container creation, not when subarrays are created later. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: Fix vlist treatment for SVDsmwilck@arcor.de2013-07-08
| | | | | | | | | With secondary RAID level, disks may belong to other BVDs in a given conf record. This needs to be taken into account when fixing the vlist. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_process_update: handle update of conf records for SVDmwilck@arcor.de2013-07-08
| | | | | | | For secondary RAID, we need to check which BVD needs to be updated. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_set_array_state: more meaningful outputmwilck@arcor.de2013-07-08
| | | | | | | Print the array GUID and the array state. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: guid_str: convenience function to print GUID for debuggingmwilck@arcor.de2013-07-08
| | | | | | | | For debugging DDF structure changes, it is important to be able to identify VCs by their GUIDs. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: getinfo_super_ddf_bvd: lba_offset calculation for RAID10mwilck@arcor.de2013-07-08
| | | | | | | Secondary RAID needs some extra logic here, too. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add_to_super_ddf_bvd: use get_svd_state()mwilck@arcor.de2013-07-08
| | | | | | | Reuse get_svd_state() rather than own state algorithm. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add_to_super_ddf: RAID10 changesmwilck@arcor.de2013-07-08
| | | | | | | The index in the BVD may be different in the RAID10 case. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add_to_super_ddf: Use same amount of workspace as other disksmwilck@arcor.de2013-07-08
| | | | | | | | | If there are already disks in the container, reserve the same amount of workspace as the first disk. Fill in the primary/secondary/ workspace LBA values. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add_to_super_ddf: allow empty slots in phys disk tablemwilck@arcor.de2013-07-08
| | | | | | | | | The used slots in the phys disk table aren't necessarily the first ones. Rather, unused entries are represented by entries where the GUID is all 0xff. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>