summaryrefslogtreecommitdiffstats
path: root/Build.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mdadm: drop auto= supportMariusz Tkaczyk2024-11-051-2/+1
| | | | | | | | | | | | According to author (and what was described in man): "With mdadm 3.0, device creation is normally left up to udev so this is option is unlikely to be needed" This was a workaround for kernel 2.6 family issues (partitionable and non-partitionable arrays hell) and I believe we are far away from it now. I'm not aware of any usage of it, hence it is removed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: Build.c fix coverity issuesNigel Croxon2024-07-031-6/+6
| | | | | | | Event leaked_handle: Handle variable "bitmap_fd" going out of scope leaks the handle. Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* Remove all "if zeros" pt.2Mateusz Kusiak2024-03-221-6/+0
| | | | | | | | | | Commit e15e8b00cbce ("Remove all "if zeros"") did not remove all "if 0" code blocks. This commit is cleanup for that commit. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Replace "none" with macroMateusz Kusiak2024-01-241-2/+2
| | | | | | | | | | | String "none" is used many times throughout the code. Replace "none" strings with predefined macro. Add str_is_none() for comparing strings with "none". Replace str(n)cmp calls with function. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: set ident.devname if applicableMariusz Tkaczyk2023-10-261-12/+9
| | | | | | | | | | | | | | | This patch tries to propagate the usage of struct mddev_ident for cmdline where it is applicable. To avoid regression, this value is derived from devlist->devname for applicable modes only. As a result, the whole structure is passed to some functions. It produces some changes for Build, Create and Assemble. No functional changes intended. The goal of the change is to unify devname validation which is done in next patches. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Create, Build: use default_layout()Mariusz Tkaczyk2022-04-051-22/+1
| | | | | | | | | | | This code is duplicated for Build mode so make default_layout() extern and use it. Simplify the function structure. It introduced change for Build mode, now for raid0 RAID0_ORIG_LAYOUT will be returned same as for Create. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Error messages should end with a newline character.NeilBrown2017-08-161-2/+2
| | | | | | | | Add "\n" to the end of error messages which don't already have one. Also spell "opened" correctly. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* retire the APIs that driver no longer supportsZhilong Liu2017-05-111-4/+0
| | | | | | | | | | refer to commit: e6e5f8f1267d ("Build: Stop bothering about supporting md driver ...") continue to retire the APIs that md driver wasn't supported for very long period of time. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify stat checking blkdev into functionZhilong Liu2017-05-051-21/+4
| | | | | | | | | | | | declare function stat_is_blkdev() to integrate repeated stat checking blkdev operations, it returns 'true/1' when it is a block device, and returns 'false/0' when it isn't. The devname is necessary parameter, *rdev is optional, parse the pointer of dev_t *rdev, if valid, assigned device number to dev_t *rdev, if NULL, ignores. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify fstat checking blkdev into functionZhilong Liu2017-05-051-2/+3
| | | | | | | | | | | | declare function fstat_is_blkdev() to integrate repeated fstat checking block device operations, it returns true/1 when it is a block device, and returns false/0 when it isn't. The fd and devname are necessary parameters, *rdev is optional, parse the pointer of dev_t *rdev, if valid, assigned the device number to dev_t *rdev, if NULL, ignores. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: tell udev md device is not ready when first created.NeilBrown2017-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | When an array is created the content is not initialized, so it could have remnants of an old filesystem or md array etc on it. udev will see this and might try to activate it, which is almost certainly not what is wanted. So create a mechanism for mdadm to communicate with udev to tell it that the device isn't ready. This mechanism is the existance of a file /run/mdadm/created-mdXXX where mdXXX is the md device name. When creating an array, mdadm will create the file. A new udev rule file, 01-md-raid-creating.rules, will detect the precense of thst file and set ENV{SYSTEMD_READY}="0". This is fairly uniformly used to suppress actions based on the contents of the device. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Build: Stop bothering about supporting md driver older than 0.90.00Jes Sorensen2017-04-051-118/+69
| | | | | | | The kernel has been stuck at md driver version 0.90.03 for at least a decade. No point in continuing to support the older API. Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* util: Introduce md_set_array_info()Jes Sorensen2017-03-291-2/+2
| | | | | | Switch from using ioctl(SET_ARRAY_INFO) to using md_set_array_info() Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* mdadm/Build:check the level parameter when build new arrayZhilong Liu2017-03-281-0/+4
| | | | | | | | | check if user forgets to specify the --level when build a new array. such as: ./mdadm -B /dev/md0 -n2 /dev/loop[0-1] Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Introduce enum flag_mode for setting and clearing flags.NeilBrown2016-11-291-1/+1
| | | | | | | | | | | | | | We currently use '1' to indicate that a flag (writemostly or failfast) needs to be set, and '2' to indicate that it needs to be cleared. Using magic number like this is not a best-practice. So replaced them with values from a enum. No functional change. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* 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>
* Remove lots of unnecessary white space.NeilBrown2013-06-191-3/+3
| | | | | | | 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>
* Create: default to bitmap=internal for large arrays.NeilBrown2013-03-051-0/+2
| | | | | | | | 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-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>
* 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>
* Fix default size calculations that were recently broken.NeilBrown2012-08-131-1/+3
| | | | | | | | | | commit d04f65f48c93e7e57cc3c1d70dd07d094dece717 Change the values for "max size" from -1 to 1. Messed up 's->size' - leaving it as '1' (MAX_SIZE) in some cases and causing the array reshape to fail. Signed-off-by: NeilBrown <neilb@suse.de>
* Use new 'struct shape' to pass args to BuildNeilBrown2012-07-091-43/+41
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Fix --build on 2.2 kernels :-)NeilBrown2012-07-091-2/+3
| | | | | | | This code has clearly never been used because it isn't right. But let's fix it anyway. Signed-off-by: NeilBrown <neilb@suse.de>
* Change the values for "max size" from -1 to 1.NeilBrown2012-07-091-2/+2
| | | | | | | | 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 Build to take a struct contextNeilBrown2012-07-091-7/+7
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-091-26/+23
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: allow chunksize to be non-power-of-2.NeilBrown2011-05-101-0/+4
| | | | | | | 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>
* Improve type names for mddev_devNeilBrown2010-11-221-2/+2
| | | | | | | | | Remove the _t pointer typedef and remove the _s suffix for the structure, These things do not help readability. Signed-off-by: NeilBrown <neilb@suse.de>
* 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>
* Merge branch 'master' into devel-3.0NeilBrown2009-05-111-4/+3
|\ | | | | | | | | | | | | | | Conflicts: Build.c mdadm.c mdadm.h super1.c
| * mdadm: allow build to use --sizePaul Clements2009-04-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables the --size parameter for build operations. Without this, if you have a raid1, for instance, where the 2 disks are not the exact same size, and you need to build the array but one of the disks is not available right at the moment (maybe it's USB and it's unplugged, or maybe it's a network disk and it's unavailable), then you have to play some weird games to get the array to size correctly (that is, to the size of the smaller of the two components or less). There may be other uses for this too... -- Paul Signed-off-by: NeilBrown <neilb@suse.de>
* | wait_for improvement.NeilBrown2009-04-071-1/+1
| | | | | | | | | | | | | | | | 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>
* | Wait for name to appear after create/assemble etc.NeilBrown2008-11-041-0/+2
| | | | | | | | | | | | | | 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>
* | Incremental: lock against multiple concurrent additions to an array.NeilBrown2008-11-041-2/+7
| | | | | | | | | | | | | | 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>
* | 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-2/+2
| | | | | | | | MORE CONTENT HERE
* | Delay creation of array devices for assemble/build/createNeilBrown2008-11-041-11/+18
|/ | | | | | | | | | | | | 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>
* 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>
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-4/+3
|
* Improve error message for adding bitmap to a level that cannot support it.Neil Brown2007-05-211-0/+6
| | | | Also give error on --build if no devices given.
* Central calls to ioctl BLKGETSIZENeil Brown2006-12-141-7/+4
| | | | Instead of opencoding the same thing everywhere.
* Just updaqte copyright dates and email addressNeil Brown2006-05-191-1/+1
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Limit size of bitmap to 2million chunks.Neil Brown2006-05-151-1/+3
| | | | | | | | 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>
* Support bitmaps with raid10Neil Brown2005-11-221-1/+3
| | | | | | And a couple of other little things Signed-off-by: Neil Brown <neilb@suse.de>
* Create version-4 bitmaps if kernel supports it.Neil Brown2005-10-111-1/+9
| | | | | | | Version-3 bitmaps are host-endian. Version-4 are little-endian and so more portable. Signed-off-by: Neil Brown <neilb@suse.de>
* Assorted fixesNeil Brown2005-08-161-2/+17
| | | | | | | | | Support "--build"ing arrays with bitmaps. hot-removal of bitmaps --re-add of drives recently removed. assorted extra tests Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add 'quite' option and tidy up some tests.Neil Brown2005-08-151-7/+7
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add write-behind supportNeil Brown2005-08-091-3/+5
| | | | | | | | 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>
* Don't for a chunk-size when "build"ing a raid1Neil Brown2005-07-291-1/+1
| | | | | | as raid1 doesn't need chunksize Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* From paul.clements@steeleye.com Thu May 19 11:09:55 2005Neil Brown2005-06-141-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | X-VM-v5-Data: ([nil nil nil nil t nil nil nil nil] ["2589" "Wednesday" "18" "May" "2005" "21:09:47" "-0400" "Paul Clements" "paul.clements@steeleye.com" nil "93" "[PATCH 1/1] mdadm 2.0 devel: fix bitmap size calculation and allow \"missing\" device in Build command" "^From:" "neilb@cse.unsw.edu.au" "neilb@cse.unsw.edu.au" "5" nil nil nil nil nil nil nil nil nil] nil) Return-Path: <paul.clements@steeleye.com> Received: From smtp-dist.unsw.edu.au ([149.171.97.16] == smtp-dist-01.services.comms.unsw.EDU.AU) (for <neilb@cse.unsw.edu.au>) By note With Smtp ; Thu, 19 May 2005 11:09:55 +1000 Received: from localhost (avspam-03.services.comms.unsw.edu.au [149.171.100.18]) by smtp-dist.unsw.edu.au (8.13.1/8.13.1) with ESMTP id j4J19t05017496 for <VRT+EFNJ=JQ=cse.unsw.edu.au=neilb@cse.unsw.edu.au>; Thu, 19 May 2005 11:09:55 +1000 (EST) Received: from note.orchestra.cse.unsw.EDU.AU (note.orchestra.cse.unsw.EDU.AU [129.94.242.24]) by smtp.unsw.edu.au (8.13.1/8.13.1) with ESMTP id j4J19qEL010258 for <VRT+EFNJ=JQ=cse.unsw.edu.au=neilb@cse.unsw.edu.au>; Thu, 19 May 2005 11:09:53 +1000 (EST) Received: From hancock.sc.steeleye.com ([209.192.50.48] == stat16.steeleye.com) (for <neilb@cse.unsw.edu.au>) By note With Smtp ; Thu, 19 May 2005 11:09:52 +1000 Received: from steeleye.com (clements.sc.steeleye.com [172.17.6.4]) by hancock.sc.steeleye.com (8.11.6/8.11.6) with ESMTP id j4J19lA29968 for <neilb@cse.unsw.edu.au>; Wed, 18 May 2005 21:09:48 -0400 Message-ID: <428BE75B.20803@steeleye.com> User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <428A496D.6000303@steeleye.com> In-Reply-To: <428A496D.6000303@steeleye.com> From: Paul Clements <paul.clements@steeleye.com> To: neilb@cse.unsw.edu.au Subject: [PATCH 1/1] mdadm 2.0 devel: fix bitmap size calculation and allow "missing" device in Build command Date: Wed, 18 May 2005 21:09:47 -0400 Content-Type: multipart/mixed; boundary="------------090601020206040308050709" This is a multi-part message in MIME format. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>