diff options
author | NeilBrown <neilb@suse.de> | 2015-05-20 22:20:36 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-05-27 21:39:30 -0400 |
commit | 3960ce796198254b7a1b420dc9a26d80928523bd (patch) | |
tree | 7b82e757c74b17eb638cff9723b2a6ae68e831b7 | |
parent | fb642b92c267beeefd352af9bc461eac93a7552c (diff) |
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: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/raid5.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6de2e1edd492..0b65eb51e562 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4235,7 +4235,8 @@ static int clear_batch_ready(struct stripe_head *sh) | |||
4235 | return 0; | 4235 | return 0; |
4236 | } | 4236 | } |
4237 | 4237 | ||
4238 | static void break_stripe_batch_list(struct stripe_head *head_sh) | 4238 | static void break_stripe_batch_list(struct stripe_head *head_sh, |
4239 | unsigned long handle_flags) | ||
4239 | { | 4240 | { |
4240 | struct stripe_head *sh, *next; | 4241 | struct stripe_head *sh, *next; |
4241 | int i; | 4242 | int i; |
@@ -4261,8 +4262,9 @@ static void break_stripe_batch_list(struct stripe_head *head_sh) | |||
4261 | spin_lock_irq(&sh->stripe_lock); | 4262 | spin_lock_irq(&sh->stripe_lock); |
4262 | sh->batch_head = NULL; | 4263 | sh->batch_head = NULL; |
4263 | spin_unlock_irq(&sh->stripe_lock); | 4264 | spin_unlock_irq(&sh->stripe_lock); |
4264 | 4265 | if (handle_flags == 0 || | |
4265 | set_bit(STRIPE_HANDLE, &sh->state); | 4266 | sh->state & handle_flags) |
4267 | set_bit(STRIPE_HANDLE, &sh->state); | ||
4266 | release_stripe(sh); | 4268 | release_stripe(sh); |
4267 | } | 4269 | } |
4268 | spin_lock_irq(&head_sh->stripe_lock); | 4270 | spin_lock_irq(&head_sh->stripe_lock); |
@@ -4271,6 +4273,8 @@ static void break_stripe_batch_list(struct stripe_head *head_sh) | |||
4271 | for (i = 0; i < head_sh->disks; i++) | 4273 | for (i = 0; i < head_sh->disks; i++) |
4272 | if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) | 4274 | if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) |
4273 | do_wakeup = 1; | 4275 | do_wakeup = 1; |
4276 | if (head_sh->state & handle_flags) | ||
4277 | set_bit(STRIPE_HANDLE, &head_sh->state); | ||
4274 | 4278 | ||
4275 | if (do_wakeup) | 4279 | if (do_wakeup) |
4276 | wake_up(&head_sh->raid_conf->wait_for_overlap); | 4280 | wake_up(&head_sh->raid_conf->wait_for_overlap); |
@@ -4299,7 +4303,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
4299 | } | 4303 | } |
4300 | 4304 | ||
4301 | if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state)) | 4305 | if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state)) |
4302 | break_stripe_batch_list(sh); | 4306 | break_stripe_batch_list(sh, 0); |
4303 | 4307 | ||
4304 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { | 4308 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { |
4305 | spin_lock(&sh->stripe_lock); | 4309 | spin_lock(&sh->stripe_lock); |