md/raid5: prefer replacing failed devices over want-replacement devices.
authorNeilBrown <neilb@suse.de>
Tue, 3 Jul 2012 01:46:53 +0000 (11:46 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 3 Jul 2012 01:46:53 +0000 (11:46 +1000)
commit5cfb22a1f83e4f04c0a4df89b60053a077222e2b
tree9312c806fb3fb245beb0dd6669569f88a79a8b7d
parentfc448a18ae6219af9a73257b1fbcd009efab4a81
md/raid5: prefer replacing failed devices over want-replacement devices.

If a RAID5 has both a failed device and a device marked as
'WantReplacement', then we should preferentially replace the failed
device.
However the current code replaces whichever is found first.
So split into 2 loops, check fail failed/missing first, and only check
for WantReplacement if nothing is failed or missing.

Reported-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid5.c