summaryrefslogtreecommitdiffstats
path: root/super0.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* imsm: add verbose flag to compare_superMariusz Tkaczyk2021-03-081-1/+2
| | | | | | | | | | | IMSM does more than comparing metadata and errors reported directly from compare_super_imsm can be useful. Add verbose flag to compare_super method and make all not critical error printing configurable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: add support for RAID0 layouts.NeilBrown2019-12-021-0/+6
| | | | | | | | | | | | | | Since Linux 5.4 a layout is needed for RAID0 arrays with varying device sizes. This patch makes the layout of an array visible (via --examine) and sets the layout on newly created arrays. --layout=dangerous can be used to avoid setting a layout so that they array can be used on older kernels. Tested-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: return correct uuid for volume in detailBlazej Kucman2019-12-021-2/+2
| | | | | | | | | | | Fixes the side effect of the patch b6180160f ("imsm: save current_vol number") - wrong UUID is printed in detail for each volume. New parameter "subarray" is added to determine what info should be extracted from metadata (subarray or container). The parameter affects only IMSM metadata. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super0: Use memmove() when adjusting sparc2.2 superblock dataJes Sorensen2018-05-311-3/+4
| | | | | | memcpy() does not allow overlapping copies, switch to memmove() Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: Fixup != broken formattingJes Sorensen2017-05-161-4/+4
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Retire mdassembleJes Sorensen2017-04-111-11/+0
| | | | | | | | mdassemble doesn't handle container based arrays, no support for sysfs, etc. It has not been actively maintained for years, so time to send it off to retirement. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: show consistency policyArtur Paszkiewicz2017-03-291-2/+2
| | | | | | | | | Show the currently enabled consistency policy in the output from --detail. Add 3 spaces to all existing items in Detail output to align with "Consistency Policy : ". Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Generic support for --consistency-policy and PPLArtur Paszkiewicz2017-03-291-4/+4
| | | | | | | | | | | | | Add a new parameter to mdadm: --consistency-policy=. It determines how the array maintains consistency in case of unexpected shutdown. This maps to the md sysfs attribute 'consistency_policy'. It can be used to create a raid5 array using PPL. Add the necessary plumbing to pass this option to metadata handlers. The write journal and bitmap functionalities are treated as different policies, which are implicitly selected when using --write-journal or --bitmap options. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* mdadm: Specify enough length when write to bufferXiao Ni2017-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | In Detail.c the buffer path in function Detail is defined as path[200], in fact the max lenth of content which needs to write to the buffer is 287. Because the length of dname of struct dirent is 255. During building it reports error: error: ā€˜%sā€™ directive writing up to 255 bytes into a region of size 189 [-Werror=format-overflow=] In function examine_super0 there is a buffer nb with length 5. But it need to show a int type argument. The lenght of max number of int is 10. So the buffer length should be 11. In human_size function the length of buf is 30. During building there is a error: output between 20 and 47 bytes into a destination of size 30. Change the length to 47. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Add failfast support.NeilBrown2016-11-281-4/+8
| | | | | | | | | | | | | Allow per-device "failfast" flag to be set when creating an array or adding devices to an array. When re-adding a device which had the failfast flag, it can be removed using --nofailfast. failfast status is printed in --detail and --examine output. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* super0: Clean up formatting in examine_super0()Jes Sorensen2016-08-151-39/+62
| | | | | | No funcionality change - should be purely cosmetic Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* super0: Fix spelling of 'version' in comment and fix formattingJes Sorensen2016-08-151-8/+6
| | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* super0: Use random_uuid() in init_super0()Jes Sorensen2016-08-151-10/+6
| | | | | | This shaves another 80 bytes off the mdadm binary. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* mdadm: Make add_internal_bitmap() return 0 on successJes Sorensen2016-05-121-2/+2
| | | | | | | | add_internal_bitmap() returned 1 on success and 0 on error which is inconsistent. This changes it to return 0 on success and use more reasonable error codes on error. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Fix wrong bitmap output for cluster raidGuoqing Jiang2016-03-071-1/+1
| | | | | | | | | | | | For cluster raid, we need to displays bitmap related contents from different bitmaps which are based on node num. So bitmap_file_open and locate_bitmap are changed a little bit for the purpose. Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> Fixes: b98043a2f8 ("Show all bitmaps while examining bitmap") Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* super0: Fix reporting of devices between 2GB and 4GBNeilBrown2016-01-281-1/+2
| | | | | | | | v0.90 metadata can handle devices between 2GB and 4GB, but we need to treat the 'size' and unsigned. In a couple of places we don't. URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809447 Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: do not display bitmap info if it is clearedGuoqing Jiang2015-12-161-3/+4
| | | | | | | | | | | | "mdadm -X DISK" is used to report information about a bitmap file, it is better to not display all the related infos if bitmap is cleared with "--bitmap=none" under grow mode. To do that, the locate_bitmap is changed a little to have a return value based on MD_FEATURE_BITMAP_OFFSET. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: add the ability to change cluster nameGuoqing Jiang2015-06-171-2/+2
| | | | | | | | | | | | To support change the cluster name, the commit do the followings: 1. extend original write_bitmap function for new scenario. 2. add the scenarion to handle the modification of cluster's name in write_bitmap1. 3. let the cluster name also show in examine_super1 and detail_super1 Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't break long strings onto multiple lines.NeilBrown2015-02-121-2/+1
| | | | | | | | | | | | | | | | | It is best to keep strings all together so that they are easier to search for in the source code. If a string is so long that it looks ugly one line, them maybe it should be broken into multiple lines for display too. Only strings which contain a newline can be broken into multiple lines: "It is OK to\n" "break this string\n" Signed-off-by: NeilBrown <neilb@suse.de>
* Consistently print program Name and __func__ in debug messages.NeilBrown2015-02-121-3/+3
| | | | | | | | | | | | make dprintf() print program name and __func__, so that this messaging is consistent. Also remove all __func__ messages from pr_err(). We shouldn't leak that internal data in error message. If we really want function name there, we new pr_XXX might be wanted. Signed-off-by: NeilBrown <neilb@suse.de>
* super: make sure to ignore disk state flags that we don't understand.NeilBrown2014-08-071-4/+3
| | | | | | | This make it easier to add new flags that some super-types don't understand. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: remove call to validate_geometry.NeilBrown2013-07-301-1/+1
| | | | | | | | | | | | | | This call to validate_geometry is really rather gratuitous. It is purely about the fact that super0 cannot use more than 4TB. So just make it an explicit test - less confusing that way. With this, validate_geometry is only called from Create, which makes it easier to reason about. Also validate_geometry is now never passed NULL for the 'chunk' parameter, so we can remove those annoying tests for NULL. Signed-off-by: NeilBrown <neilb@suse.de>
* super0/1: fix typo in error messages.NeilBrown2013-07-241-1/+1
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* revert-reshape: only impose reshape_position tests on raid[456]NeilBrown2013-07-021-2/+3
| | | | | | | This test is irrelevant for RAID10, so restrict it to those levels in which it is meaningful. Signed-off-by: NeilBrown <neilb@suse.de>
* revert-reshape: make sure reshape_position is acceptable.NeilBrown2013-06-271-0/+9
| | | | | | | | | | We can only revert a reshape if the reshape_position aligns properly for the old geometry. If it doesn't we just fail for now. Also fix a +/- error with updating raid_disks for super1.c Signed-off-by: NeilBrown <neilb@suse.de>
* Remove lots of unnecessary white space.NeilBrown2013-06-191-7/+2
| | | | | | | 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>
* super0: set uninitialized variable.NeilBrown2013-06-191-1/+1
| | | | | | Reported by -O3 Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow --update=revert-reshapeNeilBrown2013-05-281-0/+22
| | | | This will cause a reshape to start going backwards.
* Assemble: --update=metadata converts v0.90 to v1.0NeilBrown2013-05-281-0/+39
| | | | | | | | | | This allows the smooth conversion of legacy 0.90 arrays to 1.0 metadata. Old metadata is likely to remain but will be ignored. It can be removed with mdadm --zero-superblock --metadata=0.90 /dev/whatever Signed-off-by: NeilBrown <neilb@suse.de>
* Change some "fprintf(stderr,"s to pr_err.NeilBrown2013-05-211-1/+1
| | | | | | They just keep slipping in.. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --dump / --restore functionality.NeilBrown2013-05-161-1/+46
| | | | | | | | 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>
* Discard devnum in favour of devnmNeilBrown2013-02-211-1/+1
| | | | | | | | | | | | | | 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>
* make --update=homehost work againNeilBrown2013-02-101-6/+12
| | | | | | | | | | Commit 1e2b276535cea41c348292a019bdda8a58cb1679 (Report error in --update string is not recognised) broke homehost updating functionality because it depended on each string comparison being done even after we already found a match. Make it work again by restructuring code. Reported-by: (and original version by) Justin Maggard <jmaggard10@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Avoid using BLKFLSBUF.NeilBrown2013-02-051-2/+0
| | | | | | | | | | | Now that we use O_DIRECT for all device IO, BLKFLSBUF is not needed to ensure we get current data, and it can impose a cost if any flush-out is needed. So remove it. To be safe, add O_DIRECT to one place where it isn't currently used: when reading a bitmap. Signed-off-by: NeilBrown <neilb@suse.de>
* super0: allow creation of array on 2TB+ devices.NeilBrown2012-10-221-2/+2
| | | | | | | | | | As 'info->size' is signed, it cannot even hold values above 2TB. But it isn't used much. sb->size is the important value and it is unsigned. So use that to check for overflow of size. Reported-by: Eugene San <eugenesan@gmail.com>
* Trivial bugfix and spelling fixes.Michael Tokarev2012-10-211-1/+1
| | | | | | | | | And here's another trivial bugfix, now for spelling mistakes in various places, authred by Sergey Kirpichev (Cc'ed) and carried in debian mdadm package. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: super0: do not override uuid with homehostMichael Tokarev2012-10-211-1/+1
| | | | | | | | | | When --uuid is specified in the command line, even for v0.90 superblock we override last portion of uuid with data from --homehost, which is wrong (and disagrees with the manpage). Only use homehost in super0 if no uuid is specified. Signed-off-By: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: NeilBrown <neilb@suse.de>
* Allow data-offset to be specified per-device for createNeilBrown2012-10-041-1/+1
| | | | | | | | | 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-041-1/+6
| | | | | | | 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-041-0/+1
| | | | | | | 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-041-1/+4
| | | | | | | 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>
* Convert 'quiet' to 'not verbose' in various places.NeilBrown2012-07-091-1/+1
| | | | | | | | 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-091-5/+3
| | | | | | | | | | | | | | 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-091-24/+20
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: fix array size calculation for RAID10.NeilBrown2012-03-221-5/+9
| | | | | | | | RAID10 arrays with an odd number of devices had the arraysize reported wrongly by --examine due to a rounding error. Reported-by: Chris Francy <zoredache@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* match_metadata_desc0(): Use calloc instead of malloc+memsetJes Sorensen2012-03-201-3/+3
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Use posix_memalign() for memory used to write bitmapsJes Sorensen2012-02-161-3/+5
| | | | | | | | | | | | This makes super[01].c properly align buffers used for the bitmap using posix_memalign() to make sure the writes don't fail in case the bitmap is opened using O_DIRECT. This is based on https://bugzilla.redhat.com/show_bug.cgi?id=789898 and an initial patch by Alexander Murashkin. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow/bitmap: support adding bitmap via sysfs.NeilBrown2011-12-231-0/+3
| | | | | | | | | | Adding a bitmap via ioctl can only add it at a fixed location. That location is not suitable for 4K-block devices. So allow setting the bitmap location via sysfs if kernel supports it and aim to always use 4K alignments. Signed-off-by: NeilBrown <neilb@suse.de>
* super0: fix overflow when checking max size.NeilBrown2011-10-201-1/+1
| | | | | | | We need to force multiplication to use ULL before they get to big, else it overflows. So move the "2ULL" to the start. Signed-off-by: NeilBrown <neilb@suse.de>
* Add recovery blocked field to mdinfoAdam Kwolek2011-10-051-0/+2
| | | | | | | | | | | | | | | | | | | 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>