Commit 3960ce79 authored by NeilBrown's avatar NeilBrown

md/raid5: add handle_flags arg to break_stripe_batch_list.

When we break a stripe_batch_list we sometimes want to set
STRIPE_HANDLE on the individual stripes, and sometimes not.

So pass a 'handle_flags' arg.  If it is zero, always set STRIPE_HANDLE
(on non-head stripes).  If not zero, only set it if any of the given
flags are present.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent fb642b92
...@@ -4235,7 +4235,8 @@ static int clear_batch_ready(struct stripe_head *sh) ...@@ -4235,7 +4235,8 @@ static int clear_batch_ready(struct stripe_head *sh)
return 0; return 0;
} }
static void break_stripe_batch_list(struct stripe_head *head_sh) static void break_stripe_batch_list(struct stripe_head *head_sh,
unsigned long handle_flags)
{ {
struct stripe_head *sh, *next; struct stripe_head *sh, *next;
int i; int i;
...@@ -4261,8 +4262,9 @@ static void break_stripe_batch_list(struct stripe_head *head_sh) ...@@ -4261,8 +4262,9 @@ static void break_stripe_batch_list(struct stripe_head *head_sh)
spin_lock_irq(&sh->stripe_lock); spin_lock_irq(&sh->stripe_lock);
sh->batch_head = NULL; sh->batch_head = NULL;
spin_unlock_irq(&sh->stripe_lock); spin_unlock_irq(&sh->stripe_lock);
if (handle_flags == 0 ||
set_bit(STRIPE_HANDLE, &sh->state); sh->state & handle_flags)
set_bit(STRIPE_HANDLE, &sh->state);
release_stripe(sh); release_stripe(sh);
} }
spin_lock_irq(&head_sh->stripe_lock); spin_lock_irq(&head_sh->stripe_lock);
...@@ -4271,6 +4273,8 @@ static void break_stripe_batch_list(struct stripe_head *head_sh) ...@@ -4271,6 +4273,8 @@ static void break_stripe_batch_list(struct stripe_head *head_sh)
for (i = 0; i < head_sh->disks; i++) for (i = 0; i < head_sh->disks; i++)
if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags))
do_wakeup = 1; do_wakeup = 1;
if (head_sh->state & handle_flags)
set_bit(STRIPE_HANDLE, &head_sh->state);
if (do_wakeup) if (do_wakeup)
wake_up(&head_sh->raid_conf->wait_for_overlap); wake_up(&head_sh->raid_conf->wait_for_overlap);
...@@ -4299,7 +4303,7 @@ static void handle_stripe(struct stripe_head *sh) ...@@ -4299,7 +4303,7 @@ static void handle_stripe(struct stripe_head *sh)
} }
if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state)) if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state))
break_stripe_batch_list(sh); break_stripe_batch_list(sh, 0);
if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) {
spin_lock(&sh->stripe_lock); spin_lock(&sh->stripe_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment