I'm not that au fait with RAID and md, but looking at what you wrote,
Shailendra, and the md code, instead of your suggestions
(what I think are your suggestions:) of:
(1) subtracting parity from md.raid_disk (instead of md.nr_disks)
where we work out parity by switching on md.level
(2) using directly: (md.nr_disks - md.spares);
that instead we could use:
(3) using directly: md.active_disks
*swidth = *sunit * md.active_disks;
I presume that active is the working non spares and non-parity.
Does that make sense?