summaryrefslogtreecommitdiffstats
path: root/Create.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2010-07-061-2/+6
|\
| * create: Check with OROM limit before setting default chunk sizeDave Jiang2010-06-151-2/+6
| | | | | | | | | | | | | | | | | | | | Make create check with the appropriate meta data handler and see what the largest chunk size is supported. The current 512K default is not supported by existing imsm OROM. [dan.j.williams@intel.com: trim the upper limit to 512k for future oroms] Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Create: fix typo in RAID10 default layout message.NeilBrown2010-06-171-1/+1
|/ | | | | | | It reports "layout defaults to n1" but it means "... to n2". Reported-by: Adrian Sandor <aditsu@yahoo.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: cleanup after failed create in duplicated array member caseDan Williams2010-04-191-2/+8
| | | | | | | | | | | | | | | | mdadm prevents creation when device names are duplicated on the command line, but leaves the partially created array intact. Detect this case in the error code from add_to_super() and cleanup the partially created array. The imsm handler is updated to report this conflict in add_to_super_imsm_volume(). Note that since neither mdmon, nor userspace for that matter, ever saw an active array we only need to perform a subset of the cleanup actions. So call ioctl(STOP_ARRAY) directly and arrange for Create() to cleanup the map file rather than calling Manage_runstop(). Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Don't attempt to create or read bitmaps where the metadata doesn't support it.NeilBrown2010-04-071-0/+5
| | | | | | | In particular, if the relevant bitmap method is NULL, don't try to call it, print an error instead. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: Improve warning message about booting from v1.xNeilBrown2010-02-011-2/+2
| | | | | | | | | | | Suggesting that if your boot loaded doesn't support v1.x, then use --metadata=1.0 doesn't make a lot of sense. Also, '/', isn't really important, it is /boot that matters. Hopefully people who have /boot on '/' realise that /boot is on '/' .... Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2009-12-301-1/+1
|\
| * Introduce MaxSectorDan Williams2009-12-211-1/+1
| | | | | | | | | | | | | | Replace occurrences of ~0ULL to make it clear we are talking about maximal resync/recovery position. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Check partition tables when creating array.Trela, Maciej2009-12-081-3/+14
|/ | | | | | | When creating an array, check if the devices have partition tables and print a warning if the table or the partitions might be destroyed by array creation. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: warn when creating a raid1 using default metadata.NeilBrown2009-11-191-0/+11
| | | | | | | | As a some/most bootloaders don't understand md metadata, it might be difficult to boot off an array with the default 1.0 metadata. So if this is used for a RAID1, ask for confirmation. Signed-Off-By: NeilBrown <neilb@suse.de>
* Improve error messages when metadata handler does not support request.NeilBrown2009-11-171-2/+2
| | | | | | | | | ->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>
* Increase default chunk size to 512KNeilBrown2009-11-171-1/+8
| | | | | | | | | | | This seems more appropriate for current (and recent) model drives than 64K. 64K is still the default for '--build' as changing that could corrupt data. 64K is also the default rounding for 'linear' on kernels older than 2.6.16. Signed-off-by: NeilBrown <neilb@suse.de>
* conditionally update uuids in the map file after Create()Dan Williams2009-07-311-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The map file needs to be updated after adding the first member array to an Intel metadata container. The uuid for an imsm container uses the ->family_num field of the metadata. This field is static, but is only set after the first member array has been created. Prior to this all devices are free floating spares and do not have any information that can identify specific container membership. At Create() time we take the uninitialized uuid from ->get_info_super() prior to updating the metadata. So the current result is: # mdadm --create /dev/md/imsm /dev/sd[b-e] -n 4 -e imsm # mdadm --create /dev/md/vol0 /dev/md/imsm -n 4 -l 0 # cat /var/run/mdadm/map md126 /md127/0 3e03aee2:78c3c593:1e8ecaf0:eefb53ed /dev/md/vol0 md127 imsm 53d6f8b1:7a783f24:f30483c5:705c48c7 /dev/md/imsm # mdadm -Ebs ARRAY metadata=imsm UUID=589d2d2c:4221a54d:acb63c06:c3907f52 ARRAY /dev/md/vol0 container=589d2d2c:4221a54d:acb63c06:c3907f52 member=0 UUID=57b89b63:5cd0eae1:17dd26b3:51cc78d4 So, before we write out the new metadata check to see if the member array uuid has changed as a result of this addition. If it has, update its uuid in the map file and flag its parent container for updating. In support of updating the container uuid the semantics of ->write_init_super are changed to clear any metadata specific member array cursors (e.g. ddf_super.currentconf or intel_super.current_vol) such that a subsequent call to ->getinfo_super returns container information. Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-7/+2
| | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* wait_for improvement.NeilBrown2009-04-071-2/+2
| | | | | | | | wait not only for the name to appear, but for it to refer to the correct device. Sometimes old symlinks left lying around can be confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: round to chunk sizeNeilBrown2009-04-061-0/+2
| | | | | | | There are probably other places where rounding size to chunksize is needed, or useful, but this is a good start. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: fixup 'insert_point', dependent on 'subdevs', for auto-layoutDan Williams2009-02-241-1/+5
| | | | | | | | | 'subdevs' is read from the container in the auto-layout case so reset subdevs dependent default values. 'insert_point' without this change is always 2 blocking creation of arrays with > 2 raid disks. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: wait_for container creationDan Williams2009-02-241-0/+1
| | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: warn when a metadata format's platform components are missingDan Williams2009-01-201-0/+8
| | | | | | | | | | | | | | 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>
* Create: allow per-metadata default layoutsDan Williams2009-01-201-25/+48
| | | | | | | | Let handlers specifiy their own defaults, specifically needed for the imsm-raid5 case where mdadm defaults to 'ls' and imsm to 'la'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: support autolayout when creating in a DDFNeilBrown2008-12-041-30/+56
| | | | | | | | | 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. Signed-off-by: NeilBrown <neilb@suse.de>
* Change 'size' argument to validate_geometry to be sectors, not KNeilBrown2008-12-041-4/+4
| | | | | | That way it is the same a *freesize, and generally less confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: print message when preparing a container.NeilBrown2008-11-281-1/+2
| | | | | | | | We currently print e.g. "Array /dev/md0 started", but nothing for containers. Fix that. Signed-off-by: NeilBrown <neilb@suse.de>
* Tidy error messages for add_to_super failure.NeilBrown2008-11-271-4/+1
| | | | | | | Make sure every failure from add_to_super prints a suitable error message, and then don't print any error in the caller. Signed-off-by: NeilBrown <neilb@suse.de>
* allow add_to_super to return errorsDan Williams2008-11-271-2/+6
| | | | | | Prepare add_to_super to validate disks against the platform capabilities Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: don't wait for device to appear if we didn't actually start the arrayNeilBrown2008-11-071-1/+1
| | | | | | | Otherwise we get an unpleasant 2 second pause when array creation fails. Signed-off-by: NeilBrown <neilb@suse.de>
* Wait for name to appear after create/assemble etc.NeilBrown2008-11-041-0/+1
| | | | | | | We don't really want mdadm to exit until udev has created the names in /dev. So wait. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: make sure chosen_name is used for array name generation in CreateNeilBrown2008-11-041-0/+1
| | | | | | | As with Assemble, one create_mddev has chosen a name, we should always use that rather than the passed 'mddev'. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: Don't optimise resync as recovery when creating raid5 in a container.NeilBrown2008-11-041-1/+2
| | | | | | | | 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. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: report member arrays in examine_brief.NeilBrown2008-11-041-1/+1
| | | | | | Thus an auto-generated config file will list all the arrays. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: lock against multiple concurrent additions to an array.NeilBrown2008-11-041-1/+4
| | | | | | | In two devices are added via -I to one array at the same time, mdadm can get badly confused. Signed-off-by: NeilBrown <neilb@suse.de>
* Generate 'change' uevents when arrays change in non-obvious ways.NeilBrown2008-11-041-4/+6
| | | | | | | | | | | When a 'container' gets started, we need udev to notice, but the kernel has no way of knowing that a KOBJ_CHANGE event is needed. So send one directly via the 'uevent' sysfs attribute. Also, uevents don't get generated when md arrays are stopped (prior to 2.6.28) so send 'change' events then too. Signed-off-by: NeilBrown <neilb@suse.de>
* Always update mdadm/map when starting an array.NeilBrown2008-11-041-1/+6
| | | | | | | | We previously only updated /var/run/mdadm/map when starting an array with --incremental. However we now make more use of that file (to pass the dev name to udev) so always update it. Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: Introduce new rules for creating device name.NeilBrown2008-11-041-1/+2
| | | | MORE CONTENT HERE
* Delay creation of array devices for assemble/build/createNeilBrown2008-11-041-27/+39
| | | | | | | | | | | | | We will shortly be feeding more information into the process of creating array devices, so delay the creation. Still open them early if the device already exists. This involves making sure the autof flag is in the right place so that it can be found at creation time. Also, Assemble, Build, and Create now always close 'mdfd'. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.0NeilBrown2008-10-271-1/+1
|\ | | | | | | | | | | | | Conflicts: Create.c Manage.c
| * Allow WRITEMOSTLY to be cleared on --readd using --readwrite.NeilBrown2008-10-251-1/+1
| | | | | | | | | | | | | | | | Previously it was possible to set the WRITEMOSTLY flag when adding a device to an array, but not to clear the flag when re-adding. This is now possible with --readwrite. Signed-off-by: NeilBrown <neilb@suse.de>
* | Don't allow spares when creating 'external' arrays.NeilBrown2008-09-181-0/+7
| | | | | | | | | | | | | | | | | | | | It is meaningless when creating the container, and for subarrays, the container is responsible for assigning spares. Also, don't do the 'spare' fiddle for raid5 as we cannot set up a spare at this point yet. Later maybe just create the array degraded and let the container sort it out.
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-56/+36
| | | | | | | | | | | | | | | | | | | | When we assemble an array, there are three different approaches depending on whether metadata is internal or external, and on kernel version. Move all this to a common helper instead of duplicating in 3 places. Signed-off-by: NeilBrown <neilb@suse.de>
* | Factor out add-disk codeNeilBrown2008-09-181-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
* | Compile fixes, particularly moving more stuff under MDASSEMBLENeilBrown2008-09-181-1/+1
| | | | | | | | Now 'make everything' works again.
* | Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-151-0/+3
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Factor out test for subarray version string.NeilBrown2008-08-191-1/+1
| | | | | | | | | | | | | | We are about to change the syntax of the version string for 'subarray's. So factor out the test into a single function. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into from-stableNeilBrown2008-08-071-4/+4
|\| | | | | | | | | | | | | Conflicts: Create.c Manage.c
| * Clean up usage of open()Doug Ledford2008-07-241-2/+2
| | | | | | | | | | | | | | | | Fix on call that passed an invalid mode to open Don't pass a third arg unless we also pass O_CREAT Use symbolic args for 2nd and 3rd args Signed-off-by: Doug Ledford <dledford@redhat.com>
* | Factor common code into new "start_mdmon".NeilBrown2008-07-181-22/+4
| | | | | | | | Signed-off-by: Neil Brown <neilb@suse.de>
* | Make sure resync_start is initialised properly and maintained properlyNeil Brown2008-07-181-3/+5
| | | | | | | | Signed-off-by: Neil Brown <neilb@suse.de>
* | mdadm: add an environment variable to prevent auto-launching mdmonDan Williams2008-07-141-1/+1
| | | | | | | | | | | | Useful for attaching gdb to mdmon before any action is taken on the array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Print used message in place of "default metadata" message.Neil Brown2008-07-121-3/+21
| | | | | | | | | | | | | | 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
* | Pass 'verbose' flag to validate_geometryNeil Brown2008-07-121-4/+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.