summaryrefslogtreecommitdiffstats
path: root/super1.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't report Used Dev Size for RAID0.NeilBrown2010-07-221-1/+1
| | | | | | | | | | | | This number isn't meaningful for RAID0 as a different amount of space might be used from each device. It isn't meaningful for linear either, but already was not reported for linear. Detail doesn't report it either. So make --examine not report it. Signed-off-by: NeilBrown <neilb@suse.de> Reported-by: Mario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
* Compile-time switch to enable 0.9 metadata as defaultmartin f. krafft2010-05-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | This commit introduces DEFAULT_OLD_METADATA as a preprocessor definition. If defined, it causes mdadm to assume metadata version 0.9 as default. If not defined, version 1.x (currently 1.2) is used as default. The man page mdadm.8 is also modified to reflect the chosen default. The selftests will not work if the old default is chosen. This patch was requested by Debian so they could distribute a current mdadm together with boot loaders that only understand 0.90 metadata for md-raid. Preferred usage is simply make DEFAULT_OLD_METADATA=yes Signed-off-by: martin f. krafft <madduck@debian.org> Signed-off-by: NeilBrown <neilb@suse.de>
* Revert change to handling of -empty-string- metadata.NeilBrown2010-05-311-2/+1
| | | | | | | | | | | | | | | | | | If the metadata is an empty string, it means the array in question does not use metadata. This comes from sysfs_read finding "none" in "metadata_version", then super_by_fd noticing the vers == -1, and so just using the ->text_version (which is empty). In this case we want to use the super0 metadata handler routines because that is what we always used to do before commit 7d5c3964ccfaace123f7b75e15d38c2650e013d8 And that commit was wrong because "" doesn't mean "default" and so should not have been changed at the same time. Reported-by: martin f. krafft <madduck@debian.org> Signed-off-by: NeilBrown <neilb@suse.de>
* super1: encourage data alignment on 1Meg boundaryNeilBrown2010-03-031-12/+40
| | | | | | | | | | | | | For 1.1 and 1.2 metadata where data_offset is not zero, it is important to align the data_offset to underlying block size. We don't currently have access to the particular device in avail_size so just try to force to a 1Meg boundary. Also default 1.x metadata to 1.2 as documented. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: change default metadata type to 1.2NeilBrown2010-02-241-1/+1
| | | | | | | | | | | | | Change default - again, sorry. v1.1 causes problems as the conflicts with a boot sector, whether on the whole device or in a partition. I guess the rule is they you aren't allowed to use the first sector in general. v1.2 is mostly just as good and avoid boot-sector problems so default to that instead. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: put bitmap on a 4K boundary when possible.NeilBrown2010-02-241-8/+7
| | | | | | | | Some devices have 4K sector sizes. So try to align the bitmap on a 4K boundary. This isn't possible when hot-adding a bitmap, but will be once we add support for configuring the bitmap via sysfs. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix --force assembly of v1.x arrays which are recovering.NeilBrown2010-02-041-0/+5
| | | | | | | | | | | | | | | | 1.x metadata allows a device to be a member of the array while it is still recoverying. So it is a working member, but is not completely in-sync. mdadm/assemble does not understand this distinction and assumes that a work member is fully in-sync for the purpose of determining if there are enough in-sync devices for the array to be functional. So collect the 'recovery_start' value from the metadata and use it in assemble when determining how useful a given device is. Reported-by: Mikael Abrahamsson <swmike@swm.pp.se> Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce MaxSectorDan Williams2009-12-211-3/+3
| | | | | | | Replace occurrences of ~0ULL to make it clear we are talking about maximal resync/recovery position. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Various fixes for --killNeilBrown2009-11-241-2/+2
| | | | | | | | | - When --kill-superblock is used with --metadata, find every different superblock if there are several and kill them all. - When creating a new array, kill off any old metadata. The code to do this was already present but has become broken over time. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve error messages when metadata handler does not support request.NeilBrown2009-11-171-1/+4
| | | | | | | | | ->validate_geometry is called to validate overall parameters, and to validate each individual device. If it ever fails, it needs to report the reason, as common code cannot possible know. Signed-off-by: NeilBrown <neilb@suse.de>
* Set default bitmap-chunksize for internal bitmaps to at least 64MegNeilBrown2009-11-171-2/+7
| | | | | | | | | A small bitmap-chunksize hurts performance without helping resync speed much - particularly on internal bitmaps. So set the default to at least 64Meg. Signed-off-by: NeilBrown <neilb@suse.de>
* Change default metadata from 0.90 to 1.1NeilBrown2009-11-171-1/+4
| | | | | | | | | 1.1 is more flexible in a number of ways and is safer. 0.90 is still fully supported. 1.0 should possibly be used for RAID1 arrays that you want to boot off, depending on your boot loader. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: include ACTIVE but not in-sync devices as non-spares.NeilBrown2009-11-171-1/+1
| | | | | | | | | Previously such things did not exist: ACTIVE and SYNC were either both set or both clear. Recent changes with reshape means that a device can be ACTIVE but not yet fully in-sync, so they need to be handled and included in the array as active devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Handle negative delta_disks in super0 and super1.NeilBrown2009-10-161-11/+12
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.1NeilBrown2009-10-011-7/+4
|\ | | | | | | | | Conflicts: mdadm.8
| * super1: remove fd leak when opening /dev/urandomNeilBrown2009-08-131-0/+2
| | | | | | | | | | | | | | | | | | As reported in https://bugzilla.novell.com/show_bug.cgi?id=527722 I forgot to close the fd after reading the random number. Signed-off-by: NeilBrown <neilb@suse.de>
| * 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>
* | Examine/Detail: report raid6 layoutNeilBrown2009-07-141-0/+8
|/ | | | | | Somehow this was missing before... Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.0NeilBrown2009-05-111-13/+9
|\ | | | | | | | | | | | | | | Conflicts: Build.c mdadm.c mdadm.h super1.c
| * Fix gcc-4.4 compiler warning.NeilBrown2009-04-291-12/+7
| | | | | | | | | | | | | | | | | | Apparently the dereferencing of a type-punned pointer breaks strict aliasing rules. And we wouldn't want to do that. So just make a different array of the appropriate type and use memcpy. Resolves-Debian-bug: 505375 Signed-off-by: NeilBrown <neilb@suse.de>
* | super1 - fix brief examine.NeilBrown2009-05-111-3/+3
| | | | | | | | | | | | We manage to lose some space here... Signed-off-by: NeilBrown <neilb@suse.de>
* | Make --brief even briefer.NeilBrown2009-05-111-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Because ---examine --brief, or --detail --brief are often used to create mdadm.conf, and because people don't want to have to update their mdadm.conf unnecessarily, we don't want to include information that might change. And now that level changing is supported, that is almost everything but UUID. So move some more fields into the "Only print with --verbose" class. Signed-off-by: NeilBrown <neilb@suse.de>
* | conf/assemble: new config line "auto".NeilBrown2009-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The line 'auto' in mdadm.conf can be used to disable assembly of specific metadata types, or of all arrays. This does not affect assembly of arrays listed in mdadm.conf or on command line. auto -all will disable all auto-assembly. auto -ddf will cause mdadm to ignore ddf arrays that are not explicitly mentioned, and auto assemble anything else it finds. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' in devel-3.0NeilBrown2009-03-101-0/+4
|\|
| * super1: make sure max_dev grows enough when adding a device to an array.NeilBrown2009-03-091-0/+3
| | | | | | | | | | | | | | | | | | | | There was a few kernel releases where the kernel would shrink max_dev to be just enough to hold the current number of devices. More recent kernels never shrink it. However to be as compatible as possible, if we notice that max_dev is too small to successfully add a device, increase it. Signed-off-by: NeilBrown <neilb@suse.de>
| * Fix bad metadata formattingDoug Ledford2008-10-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | Certain operations (Detail.c mainly) would print out the metadata of an array in a format that the scan operation in super0.c and super1.c would later reject as unknown when it was found in the mdadm.conf file. Use a consistent format, but also modify the super0 and super1 match methods to accept the other format without complaint. Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | super1/examine: remove confusing information.NeilBrown2009-03-091-4/+21
| | | | | | | | | | | | | | | | | | The information about how slots and roles in the array lined up turned out to be confusing. So simplify it and one provide the interesting information. Signed-off-by: NeilBrown <neilb@suse.de>
* | super1 - do metadata IO in sector_size units.NeilBrown2009-03-091-7/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the sector size is > 512, we need to be more careful about alignment. The largest known sector size is 4096 and (fortunately) both the superblock and (in many cases) the bitmap are 4096-byte aligned. So there should be no data-overlap problems. The exception is when the bitmap is squeezed into the 3K after the superblock. This arrangement cannot currently be supported on 4K sector-size devices. Signed-off-by: NeilBrown <neilb@suse.de>
* | introduce --detail-platform to display platform raid capabilitiesDan Williams2008-12-081-0/+1
| | | | | | | | | | | | | | Metadata formats like imsm work in concert with platform firmware and hardware, so provide a way for mdadm to display this info to the user. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | allow add_to_super to return errorsDan Williams2008-11-271-1/+3
| | | | | | | | | | | | Prepare add_to_super to validate disks against the platform capabilities Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Don't give array name in --examine --brief output if it is doubtful.NeilBrown2008-11-041-2/+4
| | | | | | | | | | Now that mdadm.conf doesn't need an array name, we don't need to give one if the array cannot reliably provide one.
* | Merge branch 'master' into devel-3.0NeilBrown2008-10-171-10/+38
|\| | | | | | | | | | | Conflicts: Manage.c
| * Grow: Fix linear-growth when devices are not all the same size.NeilBrown2008-10-151-1/+20
| | | | | | | | | | | | If we add a device to a linear array which is a difference size to the other devices in the array then, for v1.x metadata, we need to make sure the size is correctly reflected in the superblock.
| * Improve reporting of layout for raid10.NeilBrown2008-10-131-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | Showing e.g. near=1, far=2 for the 'far2' layout of raid10 is confusing even though there is a sense in which is it correct. Make it less confusing by only printing whichever number is not 1. If both are 1, make that clear too (i.e. no redundancy).
| * Manage: allow adding device that is just large enough to v1.x array.NeilBrown2008-10-131-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | When adding a device to an array, we check that it is large enough. Currently the check makes sure there is also room for a reasonably sized bitmap. But if the array doesn't have a bitmap, then this test might be too restrictive. So when adding, only insist there is enough space for the current bitmap. When Creating, still require room for the standard sized bitmap. This resolved Debian Bug 500309
* | trivial warn_unused_result squashingDan Williams2008-10-151-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made the mistake of recompiling the F9 mdadm rpm which has a patch to remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots of errors: config.c:568: warning: ignoring return value of asprintf Assemble.c:411: warning: ignoring return value of asprintf Assemble.c:413: warning: ignoring return value of asprintf super0.c:549: warning: ignoring return value of posix_memalign super0.c:742: warning: ignoring return value of posix_memalign super0.c:812: warning: ignoring return value of posix_memalign super1.c:692: warning: ignoring return value of posix_memalign super1.c:1039: warning: ignoring return value of posix_memalign super1.c:1155: warning: ignoring return value of posix_memalign super-ddf.c:508: warning: ignoring return value of posix_memalign super-ddf.c:645: warning: ignoring return value of posix_memalign super-ddf.c:696: warning: ignoring return value of posix_memalign super-ddf.c:715: warning: ignoring return value of posix_memalign super-ddf.c:1476: warning: ignoring return value of posix_memalign super-ddf.c:1603: warning: ignoring return value of posix_memalign super-ddf.c:1614: warning: ignoring return value of posix_memalign super-ddf.c:1842: warning: ignoring return value of posix_memalign super-ddf.c:2013: warning: ignoring return value of posix_memalign super-ddf.c:2140: warning: ignoring return value of write super-ddf.c:2143: warning: ignoring return value of write super-ddf.c:2147: warning: ignoring return value of write super-ddf.c:2150: warning: ignoring return value of write super-ddf.c:2162: warning: ignoring return value of write super-ddf.c:2169: warning: ignoring return value of write super-ddf.c:2172: warning: ignoring return value of write super-ddf.c:2176: warning: ignoring return value of write super-ddf.c:2181: warning: ignoring return value of write super-ddf.c:2686: warning: ignoring return value of posix_memalign super-ddf.c:2690: warning: ignoring return value of write super-ddf.c:3070: warning: ignoring return value of posix_memalign super-ddf.c:3254: warning: ignoring return value of posix_memalign bitmap.c:128: warning: ignoring return value of posix_memalign mdmon.c:94: warning: ignoring return value of write mdmon.c:221: warning: ignoring return value of pipe mdmon.c:327: warning: ignoring return value of write mdmon.c:330: warning: ignoring return value of chdir mdmon.c:335: warning: ignoring return value of dup monitor.c:415: warning: rv may be used uninitialized in this function ...some of these like the write() ones are not so trivial so save those fixes for the next patch. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Use common code to report MD_UUID for --detail --exportNeilBrown2008-09-181-6/+0
| | | | | | | | | | | | As we need to be able to extract a UUID from any superblock for matching, use that as the MD_UUID as it will probably be used for array matching too.
* | Ignore leading zeros in version number information.NeilBrown2008-09-181-3/+9
| | | | | | | | --detail sometimes generates leading zero which are just noise.
* | Compile fixes, particularly moving more stuff under MDASSEMBLENeilBrown2008-09-181-2/+6
| | | | | | | | Now 'make everything' works again.
* | Allow metadata handlers to communicate desired safemode delay via mdinfoDan Williams2008-09-151-0/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Pass 'verbose' flag to validate_geometryNeil Brown2008-07-121-3/+6
| | | | | | | | | | That way it can be silent when we are just trying to figure out which metadata to use, and noisy when detecting a real problem.
* | Use O_DIRECT for all IO to devices.Neil Brown2008-07-121-17/+26
| | | | | | | | | | | | | | | | 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.
* | Remove silly convention that major='-1' means 'zero superblock'.Neil Brown2008-07-121-1/+1
| | | | | | | | Use 'info pointer is NULL' instead.
* | Remove getinfo_super_n and do some other cleaning up.Neil Brown2008-07-121-0/+3
| | | | | | | | | | Getting close to a sensible description of what some of the superswitch methods are supposed to do!
* | Add subarray field to supertype.Neil Brown2008-07-121-0/+3
| | | | | | | | | | | | | | | | | | When loading the metadata for a subarray (super_by_fd), we set ->subarray to be the name read from md/metadata_version so that getinfo_super can return info about the correct array. With this we can differentiate between a container and an array within the container by looking at ->subarray[0].
* | Remove 'major' from superswitch.Neil Brown2008-07-121-2/+1
| | | | | | | | It isn't generally meaningful.
* | Use text_version in map_file rather than major.minor.Neil Brown2008-07-121-0/+1
| |
* | Fix write_init_super usage when hot-adding a spareNeil Brown2008-07-121-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Using write_init_super to add a spare to an active array is quite different to how it is used when creating an array. It mostly works, but if we are adding two devices to an array, then when we add the second, there are still traces of the first which confuse write_init_super. So get write_init_super to ignore those traces. Longer term, we probably want to do this differently as for DDF, hot-adding to an active array will have to be quite different - it will want to write to all metadata, possibly via mdmon.
* | Always initialise a struct super_type to zeroNeil Brown2008-07-121-1/+2
| |
* | Change write_init_super to be called only once.Neil Brown2008-05-151-96/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current model for creating arrays involves writing a superblock to each device in the array. With containers (as with DDF), that model doesn't work. Every device in the container may need to be updated for an array made from just some the devices in a container. So instead of calling write_init_super for each device, we call it once for the array and have it iterate over all the devices in the array. To help with this, ->add_to_super now passes in an 'fd' and name for the device. These get saved for use by write_init_super. So add_to_super takes ownership of the fd, and write_init_super will close it. This information is stored in the new 'info' field of supertype. As part of this, write_init_super now removes any old traces of raid metadata rather than doing this in common code.