]> git.ipfire.org Git - thirdparty/mdadm.git/commit
Create: Factor out add_disks() helpers
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 1 Mar 2023 20:41:31 +0000 (13:41 -0700)
committerJes Sorensen <jes@trained-monkey.org>
Mon, 13 Mar 2023 14:08:10 +0000 (10:08 -0400)
commit8a4ce2c053866ac97feb436c4c85a54446ee0016
treebe4d1dfe99195aedbf6444e3f9c521772d426cfb
parentfb2c0f6183e29b014608e5e1aa4d53cb55887326
Create: Factor out add_disks() helpers

The Create function is massive with a very large number of variables.
Reading and understanding the function is almost impossible. To help
with this, factor out the two pass loop that adds the disks to the array.

This moves about 160 lines into three new helper functions and removes
a bunch of local variables from the main Create function. The main new
helper function add_disks() does the two pass loop and calls into
add_disk_to_super() and update_metadata(). Factoring out the
latter two helpers also helps to reduce a ton of indentation.

No functional changes intended.

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>
Create.c