summaryrefslogtreecommitdiffstats
path: root/super1.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Add 'container' level and ->validate_geometry method.Neil Brown2008-05-151-1/+31
|/ | | | These will be used for ddf.
* add --export option to --examineKay Sievers2008-05-061-2/+37
| | | | | | | From: Kay Sievers <kay.sievers@vrfy.org> Cc: David Zeuthen <david@fubar.dk> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
* Fix possible bug with bitmap space allocation with v1.0 metadataNeil Brown2008-04-291-1/+3
| | | | | When adding a device to an array, make sure we don't reserve so much space for the bitmap that there isn't room for the data.
* Drop the superblock arg from all metadata methods.Neil Brown2007-12-141-58/+62
| | | | It is now in the 'supertype'
* Fix compare_super to take supertype instead of a superblock.Neil Brown2007-12-141-4/+7
| | | | | As this function takes 2 superblocks, the change is a bit more subtle, so is done separately.
* Add 'supertype' arg to almost all metadata methods.Neil Brown2007-12-141-13/+14
| | | | The 'superblock' will be moved into this structure soon.
* Allow metadata handlers to free their own superblock.Neil Brown2007-12-141-0/+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.
* Clarify the avail/used devices sizes with version1 superblock.Neil Brown2007-10-171-2/+2
| | | | | Not all of the device may be available. Of that, not all may be used (if devices are of different sizes).
* Also use &tst instead of st later on when loading v1 superblocksJérémy Bobbio2007-10-011-1/+1
|
* Fix segfault on assembly on amd64 with v1 superblocksmartin f. krafft2007-09-301-1/+1
| | | | | | | | Commit a40b4fe introduced a temporary supertype variable tst, instead of manipulating st directly. However, it was forgotton to pass &tst into the recursive load_super1 call, causing an infinite recursion. Signed-off-by: martin f. krafft <madduck@debian.org>
* Don't corrupt 'supertype' when speculatively calling load_super1Neil Brown2007-09-241-9/+10
| | | | | | | | When load_super1 is trying to see which sub-version of v1 superblock is present, failure will cause it to clear st->ss, which is not good. So use a temporary 'super_type' for the 'test if this version works' calls, then copy that into 'st' on success.
* Fix problem with add a device to a 1.x array created with older mdadm.Neil Brown2007-08-201-0/+4
| | | | | | When adding new disk to an array, don't reserve so much bitmap space that the disk cannot store the required data. (Needed when 1.x array was created with older mdadm).
* Interpret "--metadata=1" with --assemble to imply any version-1, not just 1.0Doug Ledford2007-07-091-8/+29
| | | | | | | | | | | | | | | | | | | | | | From: Doug Ledford <dledford@redhat.com> OK, this one fixes an issue where people were doing manual array creation and specifying superblock types other than 1.0 (aka, 1.1, 1.2) and then using mdadm -Ebs to populate their mdadm.conf file. The general problem is that if you specify a superblock type in the ARRAY line (or on the command line), then you must specify the superblock type *exactly*, including the minor version. Unfortunately, mdadm -Ebs prints out all version 1 superblocks, regardless of minor version, as just plain old 1. This breaks the mdadm.conf file for anything other than plain version 1 superblock devices. So, since I thought it was basically backwards that the mdadm -E output was lax on specifying the location of the superblock where as the mdadm -A input was strict, I reversed that. With this patch, the mdadm -E output is now exact for any given superblock. But, in addition, the mdadm -A input is now lax for any superblock that doesn't specifically list the minor version, aka version 1 now means version 1, not version 0.90, but any minor version. So does default/large.
* Update tests and add linear-addNeil Brown2007-05-211-0/+1
| | | | | | Update the testing scripts to allow for new space calculations for space for bitmaps. Add a test script for adding devices to linear arrays.
* Fix --grow --add for linear arrays.Neil Brown2007-05-211-4/+27
| | | | | | | | | | | | | 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.
* Fix handling of negative bitmap offsets on 64bit hosts.Neil Brown2007-05-211-2/+2
| | | | | The bitmap offset is a signed 32bit number, so casting to (long) isn't sufficient. We must cast to (int32_t).
* Add --export option to --detail to use key=value pairs.Kay Sievers2007-05-081-0/+23
| | | | | | | | udev likes to get information about a device as key=value pairs so it can create disk/by-id links etc. So add --export flag which causes the output of --detail to easily parsable. From: Kay Sievers <kay.sievers@novell.com>
* Fix up calculation of bitmap space when creating v1 metadata.Neil Brown2007-05-081-31/+20
| | | | | | | We have the same calculation in multiple places with subtle differences. So unite it all. Also fix up and endian problem in --examine.
* A couple of casts needed in printf statements.Neil Brown2007-02-221-2/+4
|
* Fix a warning about an uninitialised variable.Neil Brown2007-02-221-0/+2
| | | | | The case that doesn't initialise it is impossible, so just return with an error..
* Centralise code for copying uuidNeil Brown2006-12-141-26/+4
| | | | Rather than opencoding the byteswap all the time.