NeilBrown [Sun, 1 Feb 2009 23:03:20 +0000 (10:03 +1100)]
Fix the used device size in mdadm -D output.
As get_component_size() returns the number of used sectors of a device
we need halve before pringing as K, and shift the value by 9, not 10,
before passing to human_size.
Thanks to Andre Noll <maan@systemlinux.org> for identifying problem
(and a slightly different version of this patch)
2008-12-08 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* Makefile (dadm.uclibc): Remove misspelled and unneeded rule.
* md5.h: Include stdint.h for uClibc.
* mdadm.h: uClibc defines __UCLIBC__. If uClibc has LFS off
then use lseek instead of lseek64.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Dan Williams [Fri, 23 Jan 2009 22:45:34 +0000 (15:45 -0700)]
imsm: fix failed disks are allowed back into the container
Failed disks do not have valid serial numbers which means we will not
pick up the 'failed' status bit from the metadata entry. Check for
dl->index == -2 to prevent failed disks from being incorporated into the
container.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Tue, 20 Jan 2009 08:36:51 +0000 (01:36 -0700)]
Create: warn when a metadata format's platform components are missing
If the metadata handler can not find its platform support components
then there is no way for it to verify that the raid configuration will
be supported by the option-rom. Provide a generic method for metadata
handlers to warn the user that the array they are about to create may
not work as intended with a given platform.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Tue, 20 Jan 2009 08:36:51 +0000 (01:36 -0700)]
imsm: enforce "all member disks must be members of all arrays"
This is a key orom-compatibility constraint. A nice side effect is that
it precludes the corner case of 'create' racing against 'spare activate'
since the create will fail to convert a spare into an array member. At
create time we check if this is the first member array in the container
if it is than all disks are possible candidates, if it is not then only
current members are permitted.
A bit hairier is spare-activation handling in the presence of this
constraint. It is difficult because spare handling is per array. The
approach taken is to:
1/ check that a new spare can cover all defined arrays in the container
2/ ensure that partially assimilated spares are the first candidates
when looking for a spare region to activate.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)]
Assemble: fix busy detection
Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays.
Ran into this after an encountering a case where mdadm -Ss ended in
segfault (missing check for NULL return from map_by_devnum() in
sles11:Manage.c). So, tried to stop the array by hand with echo clear >
md/array_state, after which I could not reassemble since GET_ARRAY_INFO
was succeeding.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
NeilBrown [Thu, 18 Dec 2008 05:23:46 +0000 (16:23 +1100)]
map: rebuild map if it doesn't exist.
It is possible for some arrays to be created e.g. by initrd, and so
not get mentioned in /var/run/mdadm/map.
As "-I" depends on things being listed in 'map', we create it by
scanning all devices if it doesn't exist.
NeilBrown [Thu, 18 Dec 2008 03:24:41 +0000 (14:24 +1100)]
Assemble: set stripe_cache_size properly when restarting a reshape.
Reshape with large chunk size can require a large stripe_cache.
We make this work when starting the reshape but not when
restarting at assemble time. So fix that.
NeilBrown [Thu, 18 Dec 2008 03:11:59 +0000 (14:11 +1100)]
Assemble: don't assume array is 'clean' unless all devices think it is.
This is only significant for --assemble --force where some old
devices might be included into the array. If anything looks like
it isn't clean, the kernel will not allow a degraded array to be started.
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)]
imsm: provide a detail_platform method
Dump the orom capabilities and hardware disk configuration. This code
relies on the name of scsi_host objects to determine the hardware port
number. Hopefully this information is stable...
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)]
imsm: validate arrays being created against firmware capabilities
These checks are only enabled when platform support for imsm is found,
i.e. ahci driver is loaded and talking to an Intel(R) controller, and
the option rom header is located.
They can be turned off by setting the environment variable
IMSM_NO_PLATFORM to 1.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)]
imsm: detect option-rom capabilities
The option-rom advertises its capabilities in a data structure located in
the platform ROM region 0xc0000-0xf0000. Attempt to detect the option-rom
and limit array creation to the platform's capabilities.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Mon, 8 Dec 2008 18:38:59 +0000 (11:38 -0700)]
imsm: correct start offset handling at create time
imsm metadata requires all members of a raid volume to start at the same
offset. So, incrementally build a composite disk from all the
candidates passed to ->validate_geometry. After each disk is added
merge the extents and search for a common start offset that satisfies
the requested raid device size.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
NeilBrown [Thu, 4 Dec 2008 05:08:33 +0000 (16:08 +1100)]
Create: support autolayout when creating in a DDF
If, when creating an array, a signal target device is given which
is a container, then allow the metadata handler to choose which
devices to use.
This is currently only supported for DDF.
NeilBrown [Thu, 27 Nov 2008 04:46:51 +0000 (15:46 +1100)]
Assemble: allow --force to work even when event counts are 0.
If any superblocks in a confused array had an event count of 0,
"mdadm -Af" would not update the event counts to assemble the array.
I don't remember why that text is there, and it has caused at least
one situation to be difficult to recover from. So remove the
test. --force means --force!
Dan Williams [Wed, 26 Nov 2008 22:39:51 +0000 (15:39 -0700)]
imsm: fix metadata reservation
1/ When truncating the space reserved for the metadata round down to an
even numbered sector count to avoid an off-by-one error when
sysfs_add_disk rounds up.
2/ Set the current metadata parameter block size
as a floor.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
NeilBrown [Thu, 20 Nov 2008 06:02:55 +0000 (17:02 +1100)]
Assemble: don't auto-assemble if any arrays are listed in mdadm.conf
Auto-assembly and planned assembly don't really work well together,
it can be confusing.
In particular in mkinitrd or similar creates an mdadm.conf to
assemble a particular array, we shouldn't go assembling any
other arrays as well.
If you want auto assembly, you need to give mdadm a config
file with no ARRAY lines.
mdadm -Ascpartitions
can do this.
NeilBrown [Thu, 20 Nov 2008 03:51:42 +0000 (14:51 +1100)]
mdmon: pass symbolic name to mdmon instead of device name.
Now that names in /dev are usually created (eventually) by udev,
it isn't really safe to rely in finding a name in /dev to pass to
mdmon to identify which array to monitor.
And it isn't really necessary to have a name in /dev.
So just pass the symbolic name, e.g. md127 or md123.
Change util.c to pass that name, and change mdmon to process the
name sensibly.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)]
Create: Don't optimise resync as recovery when creating raid5 in a container.
As spares are treated quite differently in containers, we cannot
fake-up a spare to optimise initialisation for a raid5 in a container,
so disable that code for ->external arrays.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)]
mdopen: use small sequence number for uniquifying array names.
Rather than appending the md minor number, we now append a small
sequence number to make sure name in /dev/md/ that aren't LOCAL are
unique. As the map file is locked while we do this, we are sure
of no losing any races.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)]
Assemble: allow members of containers to be assembled and auto-assembled.
Try to treat members of containers much like other arrays for
assembly.
We still look through the list of devices for a match (it will be
the container), then find the relevant 'info' and try to assemble
the array.