md/raid5: replace sh->lock with an 'active' flag.
authorNeilBrown <neilb@suse.de>
Tue, 26 Jul 2011 01:34:20 +0000 (11:34 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 26 Jul 2011 01:34:20 +0000 (11:34 +1000)
commitc4c1663be46b2ab94e59d3e0c583a8f6b188ff0c
tree2e0b6b51c0a55c5f9edad2c832a66c9949ef496d
parentcbe47ec559c33a68b5ee002051b848d1531a8adb
md/raid5: replace sh->lock with an 'active' flag.

sh->lock is now mainly used to ensure that two threads aren't running
in the locked part of handle_stripe[56] at the same time.

That can more neatly be achieved with an 'active' flag which we set
while running handle_stripe.  If we find the flag is set, we simply
requeue the stripe for later by setting STRIPE_HANDLE.

For safety we take ->device_lock while examining the state of the
stripe and creating a summary in 'stripe_head_state / r6_state'.
This possibly isn't needed but as shared fields like ->toread,
->towrite are checked it is safer for now at least.

We leave the label after the old 'unlock' called "unlock" because it
will disappear in a few patches, so renaming seems pointless.

This leaves the stripe 'locked' for longer as we clear STRIPE_ACTIVE
later, but that is not a problem.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Namhyung Kim <namhyung@gmail.com>
drivers/md/raid5.c
drivers/md/raid5.h