Commit Graph

229 Commits

Author SHA1 Message Date
Neil Brown 2318b9f0dc Remove 'fd' arg from sysfs_add_disk
It it never used, and removing means there are several 'open's that can
go.
2008-05-27 09:18:32 +10:00
Dan Williams 3cfe624740 imsm: create support
From: Dan Williams <dan.j.williams@intel.com>

This should probably be made into a generic 'external' capability rather
than hardcoding 'ddf' and 'imsm'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:32 +10:00
Neil Brown 2f6079dc96 Create a container member
From: Neil Brown <neilb@suse.de>
2008-05-15 16:48:21 +10:00
Neil Brown 598f0d58ac Can now mostly assemble DDF arrays 2008-05-15 16:48:19 +10:00
Neil Brown 2503d23b5a More ddf stuff 2008-05-15 16:48:17 +10:00
Neil Brown 5f8097beb9 more ddf stuff
Create a BVD in a DDF

Do not actually assemble it yet...
2008-05-15 16:48:15 +10:00
Dan Williams a322f70c41 Initial DDF support code.
Create a ddf array by naming the device /dev/ddf* or
specifying metadata 'ddf'.

If ddf is specified with no level, assume a container (indeed,
anything else would be wrong).

**Need to use text_Version to set external metadata...

More ddf support

Load a ddf container.  Now
   --examine /dev/ddf
works.
super-ddf: fix compile warning

From: Dan Williams <dan.j.williams@intel.com>

super-ddf.c:723: format %lu expects type long unsigned int, but argument 3 has type unsigned int

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:14 +10:00
Neil Brown d03373f1de Some support for external metadata.
Allow specifying metadata type when creating arrays etc.
2008-05-15 16:48:13 +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 b6e63da496 Reduce openning of dev in create.
Now that validate_geometry opens and checks the device,
we don't need to do it as much in top level Create.
We only need it to check for old array or filesystem info.
So only open the device at that place.
2008-05-15 16:48:08 +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 6fb79233b0 Allow creation of a RAID6 with a single missing device.
This did not work before as we couldn't mark it clean as there would
be some parity blocks out of sync, and raid6 will not assemble a
dirty degraded array.
So make such arrays doubly degraded (the last device becomes a spare)
and clean.
2008-04-28 16:30:09 +10:00
Neil Brown 06c7f68e40 Use 'mdinfo' instead of special 'sysdev' structure.
there is needless duplicatiion between mdinfo and sysdev, so discard
the latter.
2007-12-14 20:14:57 +11: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 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 08e43379e5 A recent patch broke --create --level=faulty - fix it.
Thanks to Martin Bene.
2007-11-29 14:40:01 +11:00
Neil Brown 570510ba32 Add some extra consistency checks based on level.
Also use LEVEL_LINEAR, LEVEL_MULTIPATH in place of -1 or -4 in a few places.
2007-10-17 13:08:12 +10:00
maximilian attems 943eafefca Create.c s/major/major_num/
don't shadow the major() function by int major.

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-24 13:21:38 +10:00
Doug Ledford 66f8bbbe90 Enhance raid4 support: --assemble and --monitor wasn't quite happy with it.
From: Doug Ledford <dledford@redhat.com>

This one actually does a couple things.  Mainly related to raid4, but
kinda touches other raid levels some.

When creating a raid4 array, treat it like a raid5 array in that we
create it in degraded mode by default and add the last disk as a spare.
Besides speeding things up, this has a second effect that it makes mdadm
more consistent.  In order to create a degraded raid5 array, you need
only passing missing as one of the devices.  For a degraded raid4 array,
prior to this patch, you must pass assume-clean or else it refuses to
create the array.  Even force won't make it work without assume-clean.
With the patch, raid4 behaves identical to raid5.

Separate from that, the monitor functionality completely ignores raid4
arrays.  That seems to stem from the code that checks to see if the
array is part of a long list of types.  It seems easier to check which
array types *aren't* redundant instead of listing the ones that are
redundant and missing some of them.  This makes the monitor service
actually watch raid4 arrays.
2007-07-09 10:00:02 +10:00
Doug Ledford 32e5a4ee4c Improve error message when trying to create an array that already exists.
From: Doug Ledford <dledford@redhat.com>

Simple bugfix.  If an array already exists and we are asked to create
this array, error out with an error message that makes sense to people
instead of an error that the SET_ARRAY_INFO ioctl had an invalid
argument.  Plus a typo correction.
2007-07-09 09:59:50 +10:00
Neil Brown 5b28bd5672 Improve error message for adding bitmap to a level that cannot support it.
Also give error on --build if no devices given.
2007-05-21 14:25:47 +10: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 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 702b557b1c Fix bugs related to raid10 and the new offset layout.
Need to mask of bits above the bottom 16 when calculating number of
copies.
2006-10-19 16:38:29 +10:00
Neil Brown 0430ed4868 Remove partitions from components of an md array
They do nothing but cause confusion.
2006-10-13 09:02:35 +10:00
Neil Brown d1e80164a2 Minor improvement in name auto-chosen for version-1 superblocks.
/dev/md_d0  should have name 'd0' by default to
make /dev/md/d0.
2006-08-11 17:59:57 +10:00
Neil Brown 60248f7433 Tidyup automatic name choice for v-1 arrays
/dev/md_d0 now becomes '0', not '_d0'.
2006-08-07 11:30:02 +10:00
Neil Brown 8aec876d2e More consistent honoring of --configfile
Never use /etc/mdadm.conf if --config file is given (previously
some code used one, some used the other).
2006-06-26 15:11:01 +10:00
Neil Brown 058574b1da Allow default metadata to be specified in mdadm.conf
CREATE metadata=1
in mdadm.conf will cause version-1 superblocks to be the default.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-06-02 05:33:40 +00:00
Neil Brown b3b33eb5cd Set default name for v1 array based on device name.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 03:24:02 +00:00
Neil Brown 05697ec1e2 Make homehost information appear in superblock.
When an array is created, if the homehost is know,
the superblock gets it, either in the uuid, (via sha1)
or in the name field.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 06:56:06 +00:00
Neil Brown 4f589ad0c5 Just updaqte copyright dates and email address
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 05:25:11 +00:00
Neil Brown 1bfdbe01ff Limit size of bitmap to 2million chunks.
When creating a file bitmap, choose a default size that
results in fewer than 2^21 chunks.  Without this kmalloc
failure in the kernel becomes likely.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-15 04:21:33 +00:00
Neil Brown 6409687b55 Kill old superblocks on create.
Make sure old-version superblocks are not around to confuse anything
when a new array is created.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-28 23:22:58 +00:00
Neil Brown 576d6d83af Prefer version-1 superblocks for v.large devices.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-01-31 00:01:48 +00:00
Neil Brown 5dd497eecb Enable support for v.large raid1.
clean up 'long long' usage for size of array, so that
with v-1 superblocks a raid1 larger than 2TB is possible.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-01-27 06:21:06 +00:00
Neil Brown 29e766a5f4 Minor fixes
Signed-off-by: Neil Brown <neilb@suse.de>
2006-01-27 04:48:28 +00:00
Neil Brown 838acbc272 Assorted fixes...
Signed-off-by: Neil Brown <neilb@suse.de>
2006-01-27 01:44:47 +00:00
Neil Brown d2cd3ffc02 uhm.. assort fixes, particularly for recovery offset...
Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-16 01:34:49 +00:00
Neil Brown 47d79ef8e5 Support --assume-clean for --create
Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:54:48 +00:00
Neil Brown f9c25f1d2a Support bitmaps with raid10
And a couple of other little things

Signed-off-by: Neil Brown <neilb@suse.de>
2005-11-22 03:37:14 +00:00
Neil Brown dcec9ee547 Create version-4 bitmaps if kernel supports it.
Version-3 bitmaps are host-endian.  Version-4 are little-endian
and so more portable.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-10-11 04:44:44 +00:00
Neil Brown 1bf4e2d962 Passes all tests, nearly ready for release.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-26 06:08:28 +00:00
Neil Brown 34163fc7cf Support internal bitmaps with format-1 superblocks.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-25 04:31:44 +00:00
Neil Brown c13c45e913 Add test for multipath and make it work.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-16 07:00:22 +00:00
Neil Brown dab6685f3d Add 'quite' option and tidy up some tests.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-15 06:14:27 +00:00
Neil Brown 947fd4ddb5 Support nameing of version-1 arrays.
--name is recognised in --create and --assemble
name= is recognised in config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-09 05:23:20 +00:00
Neil Brown dfd4d8ee42 Add write-behind support
Currently this includes
  --write-behind  to set level of write-behind supported
  --write-mostly  to flag devices as write-mostly.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-09 04:25:47 +00:00
Neil Brown 91f068bf5c Retry --stop --scan until all stoppable devices have been stopped
This is needed to reliably stop stacked arrays

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-14 06:32:18 +00:00
Neil Brown 96395475fc Make --zero-superblock work for version 1 superblocks.
This requires passing the supertype to store_super

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:03:45 +00:00
Neil Brown 55935d5180 Add support for internal bitmaps
For version 0.90 superblocks, an internal bitmap can be specified at create.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:03:47 +00:00
Neil Brown eaac7dde09 Fix create bug which initialised superblocks wrongly.
Description...

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:16:35 +00:00
Neil Brown c82f047cfc Initial bitmap support
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:16:35 +00:00
Neil Brown 570c054247 Release 1.8.1 after some man page updates and other fixes.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:16:36 +00:00
Neil Brown 82d9eba687 super1
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Fix raid5 creation with new code.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:40 +00:00
Neil Brown f9ce90ba50 Add a 'super-switch' so that different format superblocks can be used.
This includes:
  adding --metadata= option to choose metadata format
  adding metadata= word to config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:32 +00:00
Neil Brown 4b1ac34b51 Separate sueprblock handling into separate file
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:18 +00:00
Neil Brown d7eaf49f65 Use O_EXCL when opening component devices to be assembled into an array
In 2.6, this will fail if the device is already in use, so we can detect this error
more easily.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 06:02:49 +00:00
Neil Brown 0df46c2ad8 Change MAJOR() etc to major() etc
This allows for larger device number if glibc supports
it (requires 2.3.3).
Also fail before creating larger device number if glibc
support isn't present.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 05:16:13 +00:00
Neil Brown b5e6464503 mdadm-1.8.0 2004-11-01 04:49:34 +00:00
Neil Brown e5329c3747 mdadm-1.7.0 2004-08-11 02:16:01 +00:00
Neil Brown dd0781e505 mdadm-1.6.0 2004-06-04 12:03:19 +00:00
Neil Brown 98c6faba80 mdadm-1.5.0 2004-01-22 02:10:29 +00:00
Neil Brown aa88f531b4 mdadm-1.3.0 2003-07-28 23:59:00 +00:00
Neil Brown 2d46552003 mdadm-1.0.0 2002-05-10 04:06:19 +00:00
Neil Brown b83d95f362 mdadm-0.8.2 2002-04-11 01:36:14 +00:00
Neil Brown c913b90e6d mdadm-0.8.1 2002-04-05 22:00:28 +00:00
Neil Brown e0d1903663 mdadm-0.8 2002-04-04 01:58:32 +00:00
Neil Brown 56eb10c0b6 mdadm-0.7.1 2002-03-15 05:21:36 +00:00
Neil Brown 9a9dab3670 mdadm-0.7 2002-03-08 00:03:52 +00:00
Neil Brown cd29a5c835 mdctl-0.6 2002-03-06 23:17:40 +00:00
Neil Brown 5282684628 mdctl-0.5 2001-08-23 02:33:20 +00:00
Neil Brown 5e52ae9ed0 mdctl-v0.4.1 2001-07-26 09:39:46 +00:00
Neil Brown 82b27616de mdctl-v0.4 2001-07-26 07:00:09 +00:00
Neil Brown 682c705194 mdctl-v0.3 2001-06-14 05:33:53 +00:00
Neil Brown 64c4757e27 mdctl-v0.2 2001-06-08 02:36:23 +00:00