diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2023-03-01 13:41:33 -0700 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-03-13 10:08:10 -0400 |
commit | 577fd10486d8d1472a6b559066f344ac30a3a391 (patch) | |
tree | 9e51a7f670c3288138d38a06c588a4d8a4e0a98d /mdadm.c | |
parent | 9364dbfb264e89ab9467dfc0d2b813033e320640 (diff) | |
download | mdadm-577fd10486d8d1472a6b559066f344ac30a3a391.tar.gz |
mdadm: Add --write-zeros option for Create
Add the --write-zeros option for Create which will send a write zeros
request to all the disks before assembling the array. After zeroing
the array, the disks will be in a known clean state and the initial
sync may be skipped.
Writing zeroes is best used when there is a hardware offload method
to zero the data. But even still, zeroing can take several minutes on
a large device. Because of this, all disks are zeroed in parallel using
their own forked process and a message is printed to the user. The main
process will proceed only after all the zeroing processes have completed
successfully.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com>
Reviewed-by: Xiao Ni <xni@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -590,6 +590,10 @@ int main(int argc, char *argv[]) s.assume_clean = 1; continue; + case O(CREATE, WriteZeroes): + s.write_zeroes = 1; + continue; + case O(GROW,'n'): case O(CREATE,'n'): case O(BUILD,'n'): /* number of raid disks */ @@ -1251,6 +1255,11 @@ int main(int argc, char *argv[]) } } + if (s.write_zeroes && !s.assume_clean) { + pr_info("Disk zeroing requested, setting --assume-clean to skip resync\n"); + s.assume_clean = 1; + } + if (!mode && devs_found) { mode = MISC; devmode = 'Q'; |