Commit Graph

188 Commits

Author SHA1 Message Date
Adam Kwolek 6e75048bc5 Add recovery blocked field to mdinfo
When container is assembled while reshape is active on one of its member
whole container can be required to be blocked from monitoring.
For such purpose field recovery blocked is added to mdinfo structure.

When metadata handler finds active reshape in container it should set
recovery_blocked field to disable whole container monitoring during
reshape.

For arrays that doesn't use containers, recovery_blocked field
has the same value as reshape_active field e.g. super0/1.
In fact,recovery is blocked during reshape for such arrays.
For ddf, metadata handler doesn't set reshape_active field,
so recovery_blocked is not set also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-10-05 13:30:50 +11:00
Doug Ledford 16715c01f7 Fix readding of a readwrite drive into a writemostly array
If you create a two drive raid1 array with one device writemostly, then
fail the readwrite drive, when you add a new device, it will get the
writemostly bit copied out of the remaining device's superblock into
it's own.  You can then remove the new drive and readd it as readwrite,
which will work for the readd, but it leaves the stale WriteMostly1 bit
in devflags resulting in the device going back to writemostly on the
next assembly.

The fix is to make sure that A) when we readd a device and we might have
filled the st->sb info from a running device instead of the device being
readded, then clear/set the WriteMostly1 bit in the super1 struct in
addition to setting the disk state (ditto for super0, but slightly
different mechanism) and B) when adding a clean device to an array (when
we most certainly did copy the superblock info from an existing device),
then clear any writemostly bits.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-09-19 13:06:38 +10:00
NeilBrown 01619b4818 Fix component size checks in validate_super0.
A 0.90 array can use at most 4TB of each device - 2TB between
2.6.39 and 3.1 due to a kernel bug.

The test for this in validate_super0 is very wrong.  'size' is sectors
and the number it is compared against is just confusing.

So fix it all up and correct the spelling of terabytes and remove
a second redundant test on 'size'.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-09-08 12:20:36 +10:00
Luca Berra 3b7e9d0cbe Fix some type-aliasing issues.
Warnings for these are reported with -Wstrict-aliasing=2, and
avoiding the cast is certainly an improvement.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-17 14:38:14 +10:00
NeilBrown 95eeceeb32 getinfo_super now clears the 'info' structure before filling it in.
Some code currently clears 'info' before calling getinfo_super,
some code doesn't.

To be consistent, change it so no caller ever clears 'info',
but ever getinfo_super function must clear it.

Note that ->raid_disk may be meaningful if that 'map' is passed
non-NULL.  In that case it is copied out before the structure
is zeroed.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 15:54:13 +10:00
NeilBrown 0f23aa88f8 config: restore the possibility of a NULL homehost
As homehost defaults to the system name it is not possible to specify
a NULL homehost.

This patch restored this ability with either --homehost="" or
--homehost="<none>".

This allows the creation of v1.x arrays without a "hostname:"
prefix in the name.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-05-10 16:17:12 +10:00
NeilBrown ca6529edf6 Merge branch 'master' into devel-3.2
Conflicts:
	Grow.c
	Manage.c
	managemon.c
	mdadm.8.in
	util.c
2011-03-10 17:37:04 +11:00
NeilBrown 1f9476aaf8 Assemble: add --update=no-bitmap
This allows an array with a corrupt internal bitmap to be assembled
without the bitmap.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10 17:21:43 +11:00
NeilBrown bb7295f15e Fix chunksize defaulting.
the new code for defaulting chunksizes didn't work quite right
 - default was set to late in super1/super0/ddf
 - defaults would over-ride values of '0' imposed by some levels
 - default value wasn't applied to size properly.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-09 18:27:19 +11:00
Czarnowska, Anna c21e737ba1 set default chunk in validate_geometry
When chunk size is not set from command line we need to guess it
depending on metadata given on command line or found on listed devices.

Validate_geometry sets the default for it's metadata if chunk is not set.
For external metadata chunk is set only when creating in a container.
For imsm validate_geometry_imsm_orom is responsible for finding default
chunk depending on container metadata loaded. Container will already know
which controller it is attached to, and have this controllers orom
available.
do_default_chunk indicates that we need to find default chunk and
if validate_geometry fails for some metadata it tells us to reset chunk
that may have been set.

Current solution would set default chunk correctly for imsm only if
container device was given on command line. With the list of devices
chunk was always set to 512.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-22 11:25:07 +11:00
NeilBrown d43494fc3c Teach --assemble --force to handle reshapes a little better.
When we force-assemble an array which is in the middle of a reshape,
we should repeat the reshape of any parts that aren't recorded in
the oldest superblock.

This is unlikely to make a significant difference, but could make
a small difference, and is safer.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-21 11:41:01 +11:00
NeilBrown 1cc7f4feb9 Don't close fds in write_init_super
We previously closed all 'fds' associated with an array in
write_init_super .. sometimes, and sometimes at bad times.
This isn't neat and free_super is a better place to close them.

So make sure free_super always closes the fds that the metadata
manager kept hold of, and stop closing them in write_init_super.

Also add a few more calls to free_super to make sure they really do
get closed.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-25 07:56:53 +11:00
NeilBrown 5a31170d95 Assemble: add --update=no-bitmap
This allows an array with a corrupt internal bitmap to be assembled
without the bitmap.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-30 16:46:01 +11:00
NeilBrown d1d599ea0d Create: user container_dev rather than subarray for some tests.
It makes more sense to test for container_dev than for subarray
for several places in Create where it then uses container_dev.

This allows us to subsequently remove subarray.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown e32bd33f44 Remove subarray detection from load_super.
Nothing relies on this any more, so remove it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown 00bbdbdac6 Add subarray arg to container_content.
This allows the info for a single array to be extracted,
so we don't have to write it into st->subarray.

For consistency, implement container_content for super0 and super1,
to just return the mdinfo for the single array.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:26 +11:00
NeilBrown a5d85af748 get_info_super: report which other devices are thought to be working/failed.
To accurately detect when an array has been split and is now being
recombined, we need to track which other devices each thinks is
working.

We should never include a device in an array if it thinks that the
primary device has failed.

This patch just allows get_info_super to return a list of devices
and whether they are thought to be working or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown 1e2b276535 Report error in --update string is not recognised.
If an --update is requested by the relevant metadata doesn't
understand it, print a useful message rather than silently ignoring
the issue.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:24 +11:00
NeilBrown f21e18ca89 Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 13:13:02 +10:00
NeilBrown c43f7d91cc Don't report Used Dev Size for RAID0.
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>
2010-07-22 15:45:18 +10:00
NeilBrown 50526e9090 super-0.90: don't write bitmap larger than 60K
The 4K superblock can be as close as 64K from the end
of the device.  As the bitmap (with header) lives after
the superblock (with 0.90 metadata) there could be as
little as 60K of space.
So limit the bitmaps to 59.5K, and only write 60K including
the header.

The bug fixed here means that bitmaps cannot be created
on devices which are exact multiples of 64K in size

Signed-off-by: NeilBrown <neilb@suse.de>
2010-07-07 21:31:33 +10:00
martin f. krafft 26f467a954 Compile-time switch to enable 0.9 metadata as default
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>
2010-05-31 12:52:37 +10:00
NeilBrown 5082750467 Revert change to handling of -empty-string- metadata.
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 7d5c3964cc

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>
2010-05-31 12:08:02 +10:00
NeilBrown 921d9e164f Assemble: fix --force assembly of v1.x arrays which are recovering.
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>
2010-02-04 12:02:09 +11:00
NeilBrown 9277cc7752 Various fixes for --kill
- 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>
2009-11-24 16:32:01 +11:00
NeilBrown b42f577a0d Improve error messages when metadata handler does not support request.
->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>
2009-11-17 13:15:34 +11:00
NeilBrown b8ab2a50ab Set default bitmap-chunksize for internal bitmaps to at least 64Meg
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>
2009-11-17 13:15:34 +11:00
NeilBrown 7d5c3964cc Change default metadata from 0.90 to 1.1
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>
2009-11-17 13:15:32 +11:00
NeilBrown 672ca1b727 Assemble/super0: allow non-in-sync devices to be assembled without complaint.
Other metadata formats already did not worry about whether 'sync' was
missing or not.  super0 needs that now, but only for 0.91 metadata
that is undergoing reshape.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 12:31:10 +11:00
NeilBrown 4180aa4d4e Handle negative delta_disks in super0 and super1.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-16 17:43:54 +11:00
NeilBrown ca4f89a3b7 Merge branch 'master' into devel-3.1
Conflicts:
	mdadm.8
2009-10-01 16:58:40 +10:00
NeilBrown 40d28f0d1b super0: fix crash on assemble if homehost is not set.
If homehost is not set - typically during early boot,
and assemble of v0.90 metadata arrays will crash.

Reported-by: Paweł Sikora <pluto@agmk.net>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-09-25 17:56:22 +10:00
NeilBrown e9e43ec367 Grow: support restart of new migrations. 2009-08-13 11:12:54 +10:00
NeilBrown fe77a154b1 Examine/Detail: report raid6 layout
Somehow this was missing before...

Signed-off-by: NeilBrown <neilb@suse.de>
2009-07-14 15:12:29 +10:00
NeilBrown e736b62389 Update copyright dates and remove references to @cse.unsw.edu.au
Also removed 'paper' addresses.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-06-02 14:35:45 +10:00
NeilBrown 061f2c6abd Make --brief even briefer.
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>
2009-05-11 15:18:20 +10:00
NeilBrown b550887f72 super0: Do all metadata IO with 4096byte alignment
.. because some devices (dasd) have 4096 byte sector size.

As the superblock is 4096 bytes and the bitmap is in a
60K region, this is safe from any possible corruption.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 10:16:17 +11:00
NeilBrown 45b662b611 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-12-18 16:58:25 +11:00
Dan Williams 4cce406959 introduce --detail-platform to display platform raid capabilities
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>
2008-12-08 16:59:18 -07:00
NeilBrown e46273ebe4 Change 'size' argument to validate_geometry to be sectors, not K
That way it is the same a *freesize, and generally less confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 15:47:57 +11:00
Dan Williams f20c396836 allow add_to_super to return errors
Prepare add_to_super to validate disks against the platform capabilities

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:30:39 +11:00
NeilBrown 6c766cf101 Merge branch 'master' into devel-3.0
Conflicts:

	Incremental.c
	super0.c
	super1.c
2008-10-30 13:59:11 +11:00
Doug Ledford d7ee65c960 Fix bad metadata formatting
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>
2008-10-30 08:53:02 +11:00
NeilBrown 492350045c Merge branch 'master' into devel-3.0
Conflicts:

	Manage.c
2008-10-17 12:46:23 +11:00
Dan Williams 3d2c4fc7b6 trivial warn_unused_result squashing
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>
2008-10-15 14:15:52 -07:00
NeilBrown e4965ef846 Improve reporting of layout for raid10.
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).
2008-10-13 16:15:18 +11:00
NeilBrown 35ddc76dcb Use common code to report MD_UUID for --detail --export
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.
2008-09-18 16:12:28 +10:00
NeilBrown 9b2a22d319 Ignore leading zeros in version number information.
--detail sometimes generates leading zero which are just noise.
2008-09-18 15:07:45 +10:00
NeilBrown 0e60042683 Compile fixes, particularly moving more stuff under MDASSEMBLE
Now 'make everything' works again.
2008-09-18 15:04:47 +10:00
Dan Williams a67dd8cc58 Allow metadata handlers to communicate desired safemode delay via mdinfo
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:42 -07:00
Neil Brown 2c514b7120 Pass 'verbose' flag to validate_geometry
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.
2008-07-12 20:28:38 +10:00
Neil Brown 6416d5275d 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.
2008-07-12 20:28:33 +10:00
Neil Brown ec9688ca70 Make super super0.c function static.
So only 'super0' is externally visible.
2008-07-12 20:27:39 +10:00
Neil Brown ba7eb04f71 Remove silly convention that major='-1' means 'zero superblock'.
Use 'info pointer is NULL' instead.
2008-07-12 20:27:39 +10:00
Neil Brown d2ca644994 Remove getinfo_super_n and do some other cleaning up.
Getting close to a sensible description of what some of the
superswitch methods are supposed to do!
2008-07-12 20:27:39 +10:00
Neil Brown f7e7067b47 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].
2008-07-12 20:27:38 +10:00
Neil Brown b8ac196795 Remove 'major' from superswitch.
It isn't generally meaningful.
2008-07-12 20:27:37 +10:00
Neil Brown 1522c538b1 Use text_version in map_file rather than major.minor. 2008-07-12 20:27:37 +10:00
Neil Brown a0c8a17f66 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.
2008-07-12 20:27:36 +10:00
Neil Brown ef60947720 Always initialise a struct super_type to zero 2008-07-12 20:27:36 +10:00
Neil Brown 370ac380fd Merge branch 'master' into devel-3.0
Conflicts:

	Makefile
2008-06-19 16:38:37 +10:00
Neil Brown 56f8add211 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).
2008-06-19 16:30:36 +10:00
Neil Brown 111d01fcc7 Change write_init_super to be called only once.
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.
2008-05-15 16:48:12 +10:00
Neil Brown 17f25ca6fb Add 'container' level and ->validate_geometry method.
These will be used for ddf.
2008-05-15 16:47:41 +10:00
Neil Brown ff1f6545db Fix support for --update=swapsuper
The user of dup_super broke it.
2008-05-15 15:50:48 +10:00
Neil Brown 294d6f450f Recent change broken handling of metadata-less arrays.
In particular, failing a device would give a silly
error message.
2008-05-15 15:50:47 +10:00
Kay Sievers 0d726f17e1 add --export option to --examine
From: Kay Sievers <kay.sievers@vrfy.org>

Cc: David Zeuthen <david@fubar.dk>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
2008-05-06 10:02:38 +10:00
Neil Brown 5f98d3cbd9 Small improvements to --incremental for arrays that are in the middle of reshape
There is still a problem:  If array is partially assembled and started
read-only, the last device doesn't get added properly.  Probably a kernel
problem.
2008-04-28 16:30:31 +10:00
Neil Brown 1486e43fec Print 'Events' more sensibly.
Instead of MSW.LSW, just print it as a 64bit number.
2008-04-28 16:29:45 +10:00
Neil Brown 3da92f272d Drop the superblock arg from all metadata methods.
It is now in the 'supertype'
2007-12-14 20:14:33 +11:00
Neil Brown 64557c3391 Fix compare_super to take supertype instead of a superblock.
As this function takes 2 superblocks, the change is a bit more subtle,
so is done separately.
2007-12-14 20:14:27 +11:00
Neil Brown 68c7d6d790 Add 'supertype' arg to almost all metadata methods.
The 'superblock' will be moved into this structure soon.
2007-12-14 20:14:16 +11:00
Neil Brown df37ffc039 Allow metadata handlers to free their own superblock.
As the metadata handler allocates the superblock, it should free it
too.  DDF will have a more complex 'superblock' which needs more complex
freeing.
2007-12-14 20:14:00 +11:00
Neil Brown aba69144fd Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Neil Brown eb6dae9850 Fix error message when adding a device that is too small.
We were multiplying MD_RESERVED_SECTORS by 1024 instead of 512,
so lots of 'is it too small' checks were wrong.
2007-08-20 14:14:28 +10:00
Neil Brown f752781f81 Fix --grow --add for linear arrays.
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.
2007-05-21 14:25:37 +10:00
Kay Sievers 54bad3644f Add --export option to --detail to use key=value pairs.
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>
2007-05-08 17:17:33 +10:00
Neil Brown f8409e5478 Release 2.6 2006-12-21 17:24:38 +11:00
Neil Brown 8382f19bdc Add new mode: --incremental
--incremental allows arrays to be assembled one device at a time.
This is expected to be used with udev.
2006-12-21 17:10:52 +11:00
Neil Brown 3d3dd91e38 Support --uuid= with --create to choose your own UUID. 2006-12-14 17:33:10 +11:00
Neil Brown beae1dfe2e Central calls to ioctl BLKGETSIZE
Instead of opencoding the same thing everywhere.
2006-12-14 17:32:57 +11:00
Neil Brown e336254463 Change 'Device Size' to 'Used Dev Size'
because it only shows how much of each device is actually used, not
how big they are.
2006-12-14 17:31:19 +11:00
Neil Brown 583315d9c5 Give useful message if raid4/5/6 cannot be started because it is not clean and is also degraded. 2006-12-14 17:31:13 +11:00
Neil Brown 199171a297 Improve allocation and use of space for bitmaps in version1 metadata
Depending on the size of the array we reserve space for up to 128K
of bitmap, and we use it where possible.
When hot-adding to a version 1.0 we can still only use the 3K at the
end though - need a sysfs interface to improve that.

If a small chunksize is requested on Create, we don't auto-enlarge
the reserved space - this still needs to be fixed.
2006-12-14 17:31:00 +11:00
Neil Brown b5e3d1901f Remove some unused interfaces to the metadata handlers.
This stuff has never been used (at least as far as git history can
see).  I wonder why it was there...
2006-12-14 17:30:53 +11:00
Neil Brown 67a8c82d60 Make Assemble/Force work on raid6 with 2 missing devices.
Previously it onl worked when one missing device.
Also split the "force" update_super method into two and it
is really serving two functions.
2006-12-14 17:30:51 +11:00
Neil Brown 2c102711fd Make --examine report chunk size when it should
Currently it doesn't for raid6 and raid10
2006-10-09 11:16:56 +10:00
Neil Brown c56d3db4d3 Remove indeterminism from names in --examine --brief output.
It is much better for this sort of thing to be predictable
rather than depending on what devices exist, especially as
these days entries in /dev/ often don't pre-exist.
So make it always
   /dev/mdX

for version0 superblocks.

Version1 are always /dev/md/NAME
2006-08-11 17:59:53 +10:00
Neil Brown 08110d41bc Fix a recently introduced bug, and make --assemble more resilient to it.
Make -assemble a bit more resilient to finding strange
 information in superblocks.
Don't claim newly added spares are InSync!! (don't know why that
 code was ever in there)
2006-06-26 12:26:12 +10:00
Neil Brown 8268ed7403 Remove libssl dependancy and always use sha1.c code
Apparently there are license issues with openssl, so
just use sha1.c always.   This means we can get rid of
SHA1.c

Signed-off-by: Neil Brown <neilb@suse.de>
2006-06-02 06:12:19 +00:00
Neil Brown 9fca7d6236 check return status of all write/fwrite functions as required by glibc 2.4
From: Luca Berra <bluca@vodka.it>

glibc 2.4 is pedantic on ignoring return values from fprintf, fwrite and
write, so now we check the rval and actually do something with it.
in the Grow.c case i only print a warning, since i don't think we can do
anything in case we fail invalidating those superblocks (is should never
happen, but then...)

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-29 02:06:32 +00:00
Neil Brown d1f1011b94 Make sure everything compiles...
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 04:28:33 +00:00
Neil Brown 2998bc013c Improve names reported by --examine --brief
Instead of depending (too much) on what is in /dev,
we make names based on the content of the superblock.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 02:29:12 +00:00
Neil Brown e7bb5d23a9 Choose better devnumbers and tidy up some issues with finding names.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 01:40:53 +00:00
Neil Brown 8a46fe8487 Allow autoassembly to choose it's own name for the array.
This cannot be used yet, but it is working towards auto-assembly.

When auto-assembling an array, we make a name in /dev/md/
giving a number (from the peferred minor) or name (from set-name).

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 06:46:40 +00:00
Neil Brown 83b6208e89 When assembly arrays using incomplete detail, prefer arrays built for this host.
i.e. if assembling with --name or --super-minor, then if we find two
different arrays with the same apparent identity, and one was built
for 'this' host, then prefer that one instead of giving up in disgust.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 06:33:28 +00:00
Neil Brown 0237e0cafd Support --update=homehost to allow updating of homehost information.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 05:16:32 +00:00
Neil Brown e5eac01f3d Make sure homehost is set correctly when --update=uuid
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 04:51:39 +00:00
Neil Brown a1cbd7d053 Include homehost information in --examine as appropriate
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 07:19:04 +00:00
Neil Brown b6750aa8da Include homehost information in --detail where appropriate.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 07:13:03 +00:00