Dan Williams [Tue, 24 Jun 2008 13:16:44 +0000 (06:16 -0700)]
imsm: remove extra superswitches
Following the lead of 75ede16d. This incidentally fixes creation of a second
array by gating call to getinfo_super_imsm_volume with a valid ->current_vol.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Neil Brown [Sat, 12 Jul 2008 10:28:38 +0000 (20:28 +1000)]
Print used message in place of "default metadata" message.
When creating an array in a container, print e.g.
Creating array inside ddf container /dev/whatever
rather than
Defaulting to version /md127/1 metadata
Neil Brown [Sat, 12 Jul 2008 10:28:33 +0000 (20:28 +1000)]
Use O_DIRECT for all IO to devices.
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.
Neil Brown [Sat, 12 Jul 2008 10:27:42 +0000 (20:27 +1000)]
Improve shutdown for container-based arrays.
1/ close a race where multiple arrays disappear at once
and monitor isn't woken up to find out that the last one
has gone.
2/ "mdadm -Ss" needs to pause briefly for mdmon to exit.
Neil Brown [Sat, 12 Jul 2008 10:27:40 +0000 (20:27 +1000)]
Remove mon_pipe for communicating from monitor to manager
The returned value was never used, and we don't really want
this return path anyway as writing to a pipe could conceivably
block, and the monitor must not block.
Neil Brown [Sat, 12 Jul 2008 10:27:40 +0000 (20:27 +1000)]
Handle device removal from container
This really should be done in mdadm, not mdmon.
We ensure the device won't be suddenly commited as a hot-spare
using O_EXCL, then check the 'holders' sysfs directory
to make sure it is only in use once.
Neil Brown [Sat, 12 Jul 2008 10:27:38 +0000 (20:27 +1000)]
Add subarray field to supertype.
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].
Neil Brown [Sat, 12 Jul 2008 10:27:38 +0000 (20:27 +1000)]
Hide subordinate superswitch structures.
Only one superswitch should be externally visible for each
general type. Others which handle different flavours
(e.g. container/data-array) should be internal only.
Neil Brown [Sat, 12 Jul 2008 10:27:36 +0000 (20:27 +1000)]
Fix write_init_super usage when hot-adding a spare
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.
Neil Brown [Thu, 10 Jul 2008 22:50:06 +0000 (08:50 +1000)]
Always assume_clean for raid0, linear, multipath, faulty
For arrays that don't have redundancy (raid0, linear etc), the
clean/dirty distinction doesn't mean anything. So always
'assume clean' for these arrays.
Neil Brown [Thu, 19 Jun 2008 06:30:36 +0000 (16:30 +1000)]
Fix an error when assembling arrays that are in the middle of a reshape.
It is important that dup_super always returns an 'st' with the same
->ss and ->minor_version as the st that was passed.
This wasn't happening for 0.91 metadata (i.e. in the middle of a reshape).
Neil Brown [Thu, 12 Jun 2008 00:13:23 +0000 (10:13 +1000)]
Allow passing metadata update to the monitor.
Code in manager can now just call queue_metadata_update with a
(freeable) buf holding the update, and it will get passed to the
monitor and written out.
Neil Brown [Tue, 27 May 2008 07:23:16 +0000 (17:23 +1000)]
Avoid NULL reference calling free_super and elsewhere.
Since we made free_super a superswitch call, we need to be careful
that st is non NULL before calling st->ss->free_super(st).
Also when updating byteorder there is a chance of a similar NULL
deref.
Neil Brown [Mon, 26 May 2008 23:18:56 +0000 (09:18 +1000)]
Discard st->container_member
'container_member' isn't really a well defined concept.
Each metadata might enumerate members differently, so just
let each format /mdX/YYYY as appropriate.
Neil Brown [Mon, 26 May 2008 23:18:55 +0000 (09:18 +1000)]
Remove st->text_version in favour of info->text_version
I want the metadata handler to have more control over the 'version',
particularly for arrays which are members of containers.
So discard st->text_version and instead use info->text_version
which getinfo_super can initialise.
Neil Brown [Mon, 26 May 2008 23:18:53 +0000 (09:18 +1000)]
Discard get_sync_pos. We should be using get_resync_start.
"sync_complete" just tracks the current resync/recover/check/whatever pass.
"resync_start" tracks which parts of the array are known to be in-sync
(modulo active writes). So it is what we need to use to update the metadata.
Also we cannot call it when the array has stopped, as the value is no longer
available then. We must call it when the resync completes.
Possibly also call it preiodically if the array is quiescent.
Neil Brown [Mon, 26 May 2008 23:18:38 +0000 (09:18 +1000)]
Implement mark_clean for ddf and remove mark_dirty and mark_sync
mark_dirty is just a special case of mark_clean - with sync_pos == 0.
mark_sync is not required. We don't modify the metadata when sync
finishes. Only when the array becomes non-writeable at which point we
use mark_clean to record how far the resync progressed.