summaryrefslogtreecommitdiff
path: root/super-intel.c
Commit message (Collapse)AuthorAge
* New function: sysfs_waitNeilBrown2013-07-01
| | | | | | | We have several places that wait for activity on a sysfs file. Combine most of these into a single 'sysfs_wait' function. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove lots of unnecessary white space.NeilBrown2013-06-19
| | | | | | | Now that I am using white-space mode in Emacs I can see all of this, and I don't like it :-) Signed-off-by: NeilBrown <neilb@suse.de>
* More conversion to pr_errNeilBrown2013-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change some fprintf(stderrs to cont_err()NeilBrown2013-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change some "fprintf(stderr,"s to pr_err.NeilBrown2013-05-21
| | | | | | They just keep slipping in.. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --dump / --restore functionality.NeilBrown2013-05-16
| | | | | | | | This allows the metadata on a device to be saved and later restored. This can be useful before experimenting on an array that is misbehaving. Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* intel,ddf: don't require partitions when ignore_hw_compat is set.NeilBrown2013-05-16
| | | | | | | | Partitions are a hw-compat issue. This allows e.g "--examine" to be used on image files. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: monitor: do not finish migration if there are no failed disksPrzemyslaw Czarnowski2013-04-22
| | | | | | | | | | | | Transition from "degraded" to "recovery" made in OROM is slightly different than the same transision in mdadm. Missing disk is not removed from list of raid devices, but just from map. Therefore mdadm should not end migration basing on existence of list of missing disks but should rely on count of failed disks. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Tested-by: Pawel Baldysiak <pawel.baldysiak@intel.com> 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>
* platform-intel - cache 'intel_devices' for a few seconds.NeilBrown2013-01-07
| | | | | | | | | find_intel_devices() has take a little while to run as it scans some directory tree, and the result isn't likely to change often. So cache the value and only discard it after 10 seconds. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Forbid spanning between multiple controllers.Marcin Tomczak2012-11-20
| | | | | | | | | | Attaching disks to multiple controllers of the same type has been allowed so far. Now spanning between multiple controllers is disallowed at all by IMSM metadata. Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com> Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM - allow assembling any imsm array even without OROM.NeilBrown2012-11-20
| | | | | | | | | | | | | | | | It is important to check for compatibility with 'platform' or Option ROM when creating or changing and array. However there is no real need when simply assembling the array. On some systems there are situations where the platform information is not available. e.g. on some UEFI systems, UEFI is not available during 'kdump' handling. This makes it impossible to assemble an IMSM array to receive the dump. So remove the requirements that the platform be visible to assemble an IMSM array. 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>
* imsm: allow --assume-clean to work.NeilBrown2012-10-04
| | | | | | | We must avoid setting IMSM_T_STATE_UNINITIALIZED if the array was declared to be clean due to --assume-clean. 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 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>
* Add data_offset arg to ->avail_sizeNeilBrown2012-10-04
| | | | | | | This is currently only useful for 1.x metadata and will allow an explicit --data-offset request on command line. 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>
* imsm: Add --export option for --detail-platformMaciej Naruszewicz2012-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This option will provide most of information we can get via mdadm --detail-platform [-e format] in the key=value format. Example output: $ 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 --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 Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: imsm: do not accept too small sizesLukasz Dorau2012-09-20
| | | | | | | | | Inappriopriate error messages (e.g. mdadm: platform does not support raid5 with 0 disk) have been displayed when too small size was given. This patch fixes it. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: imsm: re-enable size expansion to the max valueLukasz Dorau2012-09-20
| | | | | | | | | | | | | Size expansion to the 'max' value has been broken since the following patch: commit d04f65f48c93e7e57cc3c1d70dd07d094dece717 Change the values for "max size" from -1 to 1. This patch re-enables it. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> 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>
* Convert 'quiet' to 'not verbose' in various places.NeilBrown2012-07-09
| | | | | | | | If we change some functions to accept 'verbose', where <0 means to be quiet, in place of 'quiet', then we will be able to merge 'quiet' and 'verbose' together for simplicity. 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>
* imsm: fix: correct checking volume's degradationLukasz Dorau2012-05-29
| | | | | | | | | | | | | | | | | | | | We do not check the return value of sysfs_get_ll() now. It is wrong. If reading of the sysfs "degraded" key does not succeed, the "new_degraded" variable will not be initiated and accidentally it can have the value of "degraded" variable. In that case the change of degradation will not be checked. It happens if mdadm is compiled with gcc's "-fstack-protector" option when one tries to stop a volume under reshape (e.g. OLCE). Reshape seems to be finished then (metadata is in normal/clean state) but it is not finished, it is broken and data are corrupted. Now we always check the return value of sysfs_get_ll(). Even if reading of the sysfs "degraded" key does not succeed (rv == -1) the change of degradation will be checked. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: check if size of expansion is not larger than maximumLukasz Dorau2012-05-18
| | | | | | | | | | | | | We do not check if requested size of expansion is larger than maximum available size now. If it is larger the output message is a bit misleading, for example: mdadm: Cannot set size on array members. mdadm: Cannot set device size for /dev/md/vol: Device or resource busy Now we check if requested size of expansion is larger than maximum available size and the appropriate output message was added. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix a typo in fprintf messageLukasz Dorau2012-05-18
| | | | | Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Fix resource leak from opendir()Jes Sorensen2012-05-07
| | | | | | | | Use closedir() on dirp from opendir() to avoid resource leaking. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Don't try to close negative fdJes Sorensen2012-05-07
| | | | | | | | | This should be harmless, but lets be consistent and not try to close a negative file descripter. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: thunderdome may drop 2tb attributeCzarnowska, Anna2012-04-30
| | | | | | | | | | | | Spare superblock doesn't depend on other spares in container. When loading container metadata thunderdome may pick a small disk for the champion. This will result in incorrect interpretation of sizes of other disks in container when joint superblock is returned. If any disk in container has the 2TB attribute set, the result must have it set too. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: rebuild does not continue after rebootLukasz Dorau2012-04-23
| | | | | | | | | | | | | | | | | | If system is rebooted during rebuild, md driver changes sync_action from 'recover' to 'idle' (during stopping all md devices). If mdmon is still running then, it detects the change of sync_action state, finishes rebuild and writes metadata to disks. After computer's restart the RAID volume is in Normal state in OROM and rebuild seems to be finished. After system's start-up RAID volume is in auto-read-only state and metadata is in Dirty state. Rebuild seems to be finished but it is not. Data is inconsistent (out-of-sync). When mdmon detects the change of sync_action from 'recover' to 'idle', it has to check if rebuild is really finished. Appropriate test was added. Now mdmon examines each volume's member if it is being rebuilt. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: resolve make everything compilation errorLukasz Dorau2012-04-17
| | | | | | | | | | When mdadm is compiled using e.g. 'everything' option, mdassemble compilation is broken. Change code to enable mdassemble compilation. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Component size alignment checkAdam Kwolek2012-04-17
| | | | | | | | | Put currently existing code for alignment correction in to function imsm_component_size_aligment_check() and use it for align component size to chunk size during volume size expansion operation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Support setting max size for size change operationAdam Kwolek2012-04-17
| | | | | | | | Add support for setting max size for size change operation using imsm_get_free_size() function for computing maximum available space. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Add function imsm_get_free_size()Adam Kwolek2012-04-17
| | | | | | | | Add function imsm_imsm_get_free_size() using part of code from function reserve_space(). Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Support metadata changes rollbackAdam Kwolek2012-04-17
| | | | | | | | | Add metadata rollback specific code for imsm. Let reshape_super() ability to differentiate metadata apply and rollback actions. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Support metadata changes rollbackAdam Kwolek2012-04-17
| | | | | | | | | | | | | | Function reshape_super() guards metadata changes. It is used to apply changes rollback in error case also. As change (apply and rollback) can be not bi-directional reshape_super() has to know if current action is metadata change that should be guarded using metadata restrictions, or this is metadata rollback change executed due to error occurrence. In second case change has to be unconditional. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Add new metadata update for volume size expansionAdam Kwolek2012-04-17
| | | | | | | | Add new meatdata update type imsm_update_size_change, and update metadata for volume size expansion operation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Add volume size expand support to imsm_analyze_change()Adam Kwolek2012-04-17
| | | | | | | | | | Patch adds ability to function imsm_analyze_change() for: 1. Detect size change request for volume operation. 2. Check and correct size for change. 3. Set new change kind to CH_ARRAY_SIZE Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Update function imsm_num_data_members() for Raid1/10Adam Kwolek2012-04-17
| | | | | | | | | Function imsm_num_data_members() returns wrong value for raid 1 and 10. It returns all data member but it should return number of unique data members (excluding mirror devices) Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: display maximum volumes per controller and arrayLabun, Marcin2012-04-17
| | | | | | | | Display maximum volumes per array and per controller in --detail-platform command. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix two typos in fprintf messagesLukasz Dorau2012-04-10
| | | | | Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: set 2tb disk attribute for spareCzarnowska, Anna2012-04-02
| | | | | | | This patch ensures metadata attribute is set correctly also for spares. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* check that no disk over 2TB is used to create container when no supportCzarnowska, Anna2012-04-02
| | | | | | | Creation of a container using disks over 2TB should be allowed only when orom supports large disks Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* check volume size in validate_geometry_imsm_oromCzarnowska, Anna2012-04-02
| | | | | | | When orom does not support volumes over 2TB the creation should be disallowed Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* show 2TB volumes/disks support in --detail-platformCzarnowska, Anna2012-04-02
| | | | | Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* simplify calculating array_blocksCzarnowska, Anna2012-04-02
| | | | | | | | no point calling info_to_blocks_per_member when it just returns size*2 for level==1 calc_array_size can be used for all levels Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* clear hi bits if not used after loading metadata from diskCzarnowska, Anna2012-04-02
| | | | | | | | | | | | | | | | Functions retrieving sizes from metadata do not need to check 2TB attribute only when we can guarantee the hi bits are always clear when the MPB_ATTR_2TB_DISK attribute is not set. Therefore the following fields are cleared on metadata load when not in use according to attribute: struct imsm_disk.total_blocks_hi struct imsm_map.pba_of_lba0_hi struct imsm_map.blocks_per_member_hi struct imsm_map.num_data_stripes_hi Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>