summaryrefslogtreecommitdiff
path: root/Create.c
Commit message (Collapse)AuthorAge
* DDF: add support of --data-offset when creating array.NeilBrown2014-05-21
| | | | | | | | | Infrastructure is there, so use it. This requires making sure that ->data_offset is correctly set, even for containers. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: don't default to bitmap=internal when it is not supportedArtur Paszkiewicz2014-05-01
| | | | | | | | | | | | For large arrays (component size > 100GB) if write-intent bitmap is not enabled, then it is set by default to "internal", even if the metadata format does support internal bitmaps, which causes Create to fail. This patch adds checking if add_internal_bitmap is set in the superswitch before setting bitmap_file to "internal". Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix race between --create and --incrementalArtur Paszkiewicz2014-05-01
| | | | | | | | | | | | This modifies locking in Create to eliminate a situation where --incremental can assemble a device between write_init_super() and add_disk(), which causes Create to fail. It sporadically occurs e.g. when metadata is written on a device, causing an udev change event which triggers mdadm --incremental. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Release mdadm-3.3NeilBrown2013-09-03
| | | | | | (and various cosmetic fixes) Signed-off-by: NeilBrown <neilb@suse.de>
* Make sure NOFILE resource limit is big enough.NeilBrown2013-05-30
| | | | | | | | | | Some people want to create truely enormous arrays. As we sometimes need to hold one file descriptor for each device, this can hit the NOFILE limit. So raise the limit if it ever looks like it might be a problem. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: over-ride "start_ro" setting when creating an array.NeilBrown2013-05-15
| | | | | | | | | | If module parameter start_ro is set, arrays start readonly. This is OK when assembling, but is very surprising when creating an array as the resync won't start. So over-ride the setting (unless --read-only was given) make arrays RW when created. Signed-off-by: NeilBrown <neilb@suse.de>
* create_mddev: add support for /dev/md_XXX non-numeric names.NeilBrown2013-05-15
| | | | | | | | | | With the 'devnm' infrastructure fixed, it is quite easy to support names like "md_home" for md arrays. The currently defaults to "off" and can be enabled in mdadm.conf with CREATE names=yes This is incase other tools get confused by the new names. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: fix bug with --data-offset.NeilBrown2013-05-13
| | | | | | Test for VARIABLE_OFFSET was wrong. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: default to bitmap=internal for large arrays.NeilBrown2013-03-05
| | | | | | | | Here, "large" means components are 100G or more. It is usually beneficial to have write-intent bitmaps on such arrays. They can be suppressed with --bitmap=none Signed-off-by: NeilBrown <neilb@suse.de>
* Discard devnum in favour of devnmNeilBrown2013-02-21
| | | | | | | | | | | | | | We widely use a "devnum" which is 0 or +ve for md%d devices and -ve for md_d%d devices. But I want to be able to use md_%s device names. So get rid of devnum (a number) and use devnm (a 32char string). eg. md0 md_d2 md_home Signed-off-by: NeilBrown <neilb@suse.de>
* Create.c: check if freesize is equal 0Lukasz Dorau2012-11-20
| | | | | | | | "freesize" can be equal 0, particularly after rounding to the chunk's size. Creating should be aborted in such case. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Replace a lot of leading spaces with tabs.NeilBrown2012-10-10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Allow data-offset to be specified per-device for createNeilBrown2012-10-04
| | | | | | | | | mdadm --create /dev/md0 .... /dev/sda1:1024 /dev/sdb1:2048 ... The size is in K unless a suffix: K M G is given. The suffix 's' means sectors. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --data-offset flag for Create and GrowNeilBrown2012-10-04
| | | | | | | | | | This can be used to over-ride the automatic assignment of data offset. For --create, it is useful to re-create old arrays where different defaults applied. For --grow it may be able to force a reshape in the reverse direction. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->init_super and use it in super1.cNeilBrown2012-10-04
| | | | | | | So if ->data_offset is already set, use that rather than computing one. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->validate_geometry.NeilBrown2012-10-04
| | | | | | | This is needed to return correct available size. It isn't really used yet. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Allow to specify controller for --detail-platform.Maciej Naruszewicz2012-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, 'mdadm --detail-platform -e imsm' scans all the controllers looking for IMSM capabilities. This patch provides the possibility to specify a controller to scan, enabling custom usage by other processes - especially with the --export switch. $ mdadm --detail-platform Platform : Intel(R) Matrix Storage Manager Version : 9.5.0.1037 RAID Levels : raid0 raid1 raid10 raid5 Chunk Sizes : 4k 8k 16k 32k 64k 128k 2TB volumes : supported 2TB disks : not supported Max Disks : 7 Max Volumes : 2 per array, 4 per controller I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA) $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.2 Platform : Intel(R) Matrix Storage Manager Version : 9.5.0.1037 RAID Levels : raid0 raid1 raid10 raid5 Chunk Sizes : 4k 8k 16k 32k 64k 128k 2TB volumes : supported 2TB disks : not supported Max Disks : 7 Max Volumes : 2 per array, 4 per controller I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA) $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.2 --export MD_FIRMWARE_TYPE=imsm IMSM_VERSION=9.5.0.1037 IMSM_SUPPORTED_RAID_LEVELS=raid0 raid1 raid10 raid5 IMSM_SUPPORTED_CHUNK_SIZES=4k 8k 16k 32k 64k 128k IMSM_2TB_VOLUMES=yes IMSM_2TB_DISKS=no IMSM_MAX_DISKS=7 IMSM_MAX_VOLUMES_PER_ARRAY=2 IMSM_MAX_VOLUMES_PER_CONTROLLER=4 $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.0 # This isn't an IMSM-capable controller mdadm: no active Intel(R) RAID controller found under /sys/devices/pci0000:00/0000:00:1f.0 Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Minor cosmetic fixes in various files.NeilBrown2012-08-13
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use new 'struct shape' to pass args to CreateNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Create: Remove unnecessary cast from 'size'.NeilBrown2012-07-09
| | | | | | 'size' is already unsigned long long, so no need to cast it. Signed-off-by: NeilBrown <neilb@suse.de>
* Change the values for "max size" from -1 to 1.NeilBrown2012-07-09
| | | | | | | | Both are impossible, and '1' allows size to be unsigned, which is neater. Also #define MAX_SIZE to be '1' to make it all more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Change Create to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Create: support --readonly flag.NeilBrown2012-07-09
| | | | | | Allow array to be created read-only Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: round off size for RAID1 arrays.NeilBrown2012-03-22
| | | | | | | | | | | RAID1 arrays don't have a chunk size, but if you ever convert one to RAID5 you will need at least a small one >= 4K. So round of size to a multiple of 64K. This only affect Create, not "--grow --size=max". The latter is too hard and with smaller returns. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: reduce the verbosity of 'default_layout'.NeilBrown2012-03-08
| | | | | | | We only need this the first couple of times. Reporting it for every device is not necessary. Signed-off-by: NeilBrown <neilb@suse.de>
* Print error message if failing to write super for 1.x metadataJes Sorensen2012-02-23
| | | | | | | | | | | | In addition remove attempt to print an error message if write_init_super() fails, as this is handled in the various write_init_super() functions. This avoids a segfault on error. Reported by Jim Meyering in https://bugzilla.redhat.com/show_bug.cgi?id=795461 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Verify if array name doesn't exist alreadyAdam Kwolek2011-12-23
| | | | | | | | | | | | | | | | When e.g. array name (an) is correct and it is the same as container name (cn), file element creation /dev/md/an will replace /dev/md/cn. This can cause that user cannot access container using /dev/md/cn. Verify during array creation if chosen name is not already existing one. [Changed to use map_by_name() rather than stat() to determine prior existence - NeilBrown] Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create() check malloc() return valueJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create() don't leave the lock hanging on errorJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: improve messages from validate_geometry.NeilBrown2011-09-21
| | | | | | | | | | | | | When validate_geometry finds that we haven't committed to a metadata yet and that the subdev is a member of 'our' container, it needs to report any errors it finds as Create() cannot report them effectively. So make a slight change to the semantics of the 'verbose' flag and allow validate_geometry to report if it printed any error messages. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: getinfo_super_imsm_volume() doesn't fill all disk informationNeilBrown2011-07-14
| | | | | | | | | | | | | getinfo_super_imsm_volume doesn't correctly set info.disk fields because it doesn't know which disk to set them from. It should be the last disk passed to add_to_super. So add a field 'current_disk' to record this disk in add_to_super, and use it in getinfo_super. This allows us to remove a hack in Create.c Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Cannot create volumeAdam Kwolek2011-06-14
| | | | | | | | | | getinfo_super() can clear entire 'inf' structure before filling with new information. Disk number required later is lost. Restore disk number information after getinfo_super() call. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* getinfo_super now clears the 'info' structure before filling it in.NeilBrown2011-06-08
| | | | | | | | | | | | | | 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>
* Restore ability to create imsm array from specific devices.NeilBrown2011-05-23
| | | | | | | | | | | A recent change to improve error messages make it not possible to create an array from devices that are 'busy'. However if they are made busy by a container, then the create should be allowed. So move one of the error messages later. Reported-by: "Wojcik, Krzysztof" <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: add error checking for 'write_init_super'.NeilBrown2011-05-11
| | | | | | If this fails, we really must fail the whole 'create'. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: give better error message if member device unusable.NeilBrown2011-05-10
| | | | | | | Rather than just saying "unusable", report if device is busy or is no a block device. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: allow chunksize to be non-power-of-2.NeilBrown2011-05-10
| | | | | | | RAID0 has accepted chunksizes that are not a power of 2 since 2.6.30. So it time mdadm allowed that to be used. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: fix size after setting default chunkCzarnowska, Anna2011-04-05
| | | | | | | | | | | | | | When -e option is given then the first validate_geometry sets default chunk. Size must be rounded there and do_default_chunk needs to be set to 0 so that we don't repeat the message below. If we start without st then what we find on the the first disk determines the st and sets chunk. So after running validate_geometry on the first disk we need to fix the size too. At this point chunk should always be set but it is safer to keep the check. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: check for UnSet when looking at chunkCzarnowska, Anna2011-04-05
| | | | | | | | | A default chunk size of 0 gets modified to UnSet, so any location that checks for !chunk really needs to check for !(chunk || chunk == UnSet). Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: ping_monitor() usage causes memory leaksAdam Kwolek2011-03-18
| | | | | | | | | | When for ping_monitor() input devnum2devname() is used, received string pointer should be passed to free() for memory release. It is not made in several places. This use case should have function to avoid memory leak. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Warn the user about too small array sizeKrzysztof Wojcik2011-03-14
| | | | | | | | | | | | If single-disk RAID0 or RAID1 array is created, user may preserve data on disk. If array given size covers all partitions on disk, all data will be available on created array. If array size is too small (not covers all partitions), data will be not accessible. This patch introduces warning message during array creation if given size is too small. User may interrupt creation process to avoid data loss. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix chunksize defaulting.NeilBrown2011-03-09
| | | | | | | | | 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>
* Partitions could be meaningful on single-drive RAID0Krzysztof Wojcik2011-02-27
| | | | | | | | | | | | | | | | If we create a single-drive RAID0 array on partitioned drive, we do not lose information about disk structure after operation (partitions are visible on created array) Warning message: mdadm: partition table exists on /dev/sdX but will be lost or meaningless after creating array" is not necessary during creation single-drive RAID0 array. This patch removes the message. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* set default chunk in validate_geometryCzarnowska, Anna2011-02-22
| | | | | | | | | | | | | | | | | | | | | | 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>
* fix: memory leak in CreateCzarnowska, Anna2011-02-21
| | | | | | | | match_metadata_desc allocates memory for st which is not needed after validate_geometry fails Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Call free_super earlier when creating an array.NeilBrown2011-01-31
| | | | | | | | | | | As free_super now closes fds for member devices, rather than write_init_super doing it, we need to call free_super earlier, so that the device (on which we hold an O_EXCL open) is closed before it is added to the array. So close at the end of pass-1 rather than after pass-2. Signed-off-by: NeilBrown <neilb@suse.de>
* Create/grow: improve checks on number of devices.NeilBrown2010-12-01
| | | | | | | | | | Check on upper limit of number of devices was in the wrong place. Result was could not create array with more than 27 devices without explicitly setting metadata, even though default metadata allows more. Fixed, and also perform check when growing an array. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: report failure if array cannot be started.NeilBrown2010-12-01
| | | | | | We weren't checking the result of writing 'active' to array_state Signed-off-by: NeilBrown <neilb@suse.de>