Re: [PATCH mdadm v3 5/7] mdadm: Add --write-zeros option for Create
From: Mariusz Tkaczyk <hidden>
Date: 2022-09-23 11:20:20
Hi Logan, One comment from my side. Thanks, Mariusz On Wed, 21 Sep 2022 14:43:54 -0600 Logan Gunthorpe [off-list ref] wrote:
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> fixup! mdadm: Add --write-zeros option for Create ---
quoted hunk ↗ jump to hunk
diff --git a/mdadm.h b/mdadm.h index 1ab31564efef..c7e00195d8c8 100644 --- a/mdadm.h +++ b/mdadm.h@@ -273,6 +273,9 @@ static inline void __put_unaligned32(__u32 val, void *p) #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#define KIB_TO_BYTES(x) ((x) << 10) +#define SEC_TO_BYTES(x) ((x) << 9) + extern const char Name[]; struct md_bb_entry {@@ -387,6 +390,8 @@ struct mdinfo { ARRAY_UNKNOWN_STATE, } array_state; struct md_bb bb; + + pid_t zero_pid; };
mdinfo is used for raid properties. It is used for both system (sysfs_read()) and metadata(getinfo_super()). zero_pid property doesn't fit well there, it is used once during creation. Could you please add it to mddev_dev struct or add it to local array /list?