md/raid10: Allow replacement device to be replace old drive.
authorNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:55 +0000 (10:17 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:55 +0000 (10:17 +1100)
commit4ca40c2ce099e4f1ce35445994f49836662596c8
tree7d6f2187e8d6aaab0cdcf4924017aeb9725d87b0
parent24afd80d99f80a79d8824d2805114b8b067e9823
md/raid10: Allow replacement device to be replace old drive.

When recovery finish and spare_active is called, check for a
replace that might have just become fully synced and mark it
as such, marking the original as failed.

Then when the original is removed, move the replacement into
its position.

This means that 'replacement' and spontaneously become NULL in some
situations.  Make sure we check for those.
It also means that 'rdev' and 'replacement' could appear to be
identical - check for that too.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid10.c