diff options
author | NeilBrown <neilb@suse.de> | 2015-05-20 22:56:41 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-05-27 21:47:02 -0400 |
commit | 787b76fa37159050f6d26aebfa6210009baed93b (patch) | |
tree | 9e54ff777051ffa494d7e34349c8a079be5052c4 /drivers/md/raid5.c | |
parent | 1b956f7a8f9aa63ea9644ab8c3374cf381993363 (diff) |
md/raid5: call break_stripe_batch_list from handle_stripe_clean_event
Now that the code in break_stripe_batch_list() is nearly identical
to the end of handle_stripe_clean_event, replace the later
with a function call.
The only remaining difference of any interest is the masking that is
applieds to dev[i].flags copied from head_sh.
R5_WriteError certainly isn't wanted as it is set per-stripe, not
per-patch. R5_Overlap isn't wanted as it is explicitly handled.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 61 |
1 files changed, 4 insertions, 57 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1141b7f62e6e..3254504b1080 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3420,6 +3420,8 @@ static void handle_stripe_fill(struct stripe_head *sh, | |||
3420 | set_bit(STRIPE_HANDLE, &sh->state); | 3420 | set_bit(STRIPE_HANDLE, &sh->state); |
3421 | } | 3421 | } |
3422 | 3422 | ||
3423 | static void break_stripe_batch_list(struct stripe_head *head_sh, | ||
3424 | unsigned long handle_flags); | ||
3423 | /* handle_stripe_clean_event | 3425 | /* handle_stripe_clean_event |
3424 | * any written block on an uptodate or failed drive can be returned. | 3426 | * any written block on an uptodate or failed drive can be returned. |
3425 | * Note that if we 'wrote' to a failed drive, it will be UPTODATE, but | 3427 | * Note that if we 'wrote' to a failed drive, it will be UPTODATE, but |
@@ -3433,7 +3435,6 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
3433 | int discard_pending = 0; | 3435 | int discard_pending = 0; |
3434 | struct stripe_head *head_sh = sh; | 3436 | struct stripe_head *head_sh = sh; |
3435 | bool do_endio = false; | 3437 | bool do_endio = false; |
3436 | int wakeup_nr = 0; | ||
3437 | 3438 | ||
3438 | for (i = disks; i--; ) | 3439 | for (i = disks; i--; ) |
3439 | if (sh->dev[i].written) { | 3440 | if (sh->dev[i].written) { |
@@ -3522,62 +3523,8 @@ unhash: | |||
3522 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 3523 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
3523 | md_wakeup_thread(conf->mddev->thread); | 3524 | md_wakeup_thread(conf->mddev->thread); |
3524 | 3525 | ||
3525 | if (!head_sh->batch_head || !do_endio) | 3526 | if (head_sh->batch_head && do_endio) |
3526 | return; | 3527 | break_stripe_batch_list(head_sh, STRIPE_EXPAND_SYNC_FLAGS); |
3527 | for (i = 0; i < head_sh->disks; i++) { | ||
3528 | if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) | ||
3529 | wakeup_nr++; | ||
3530 | } | ||
3531 | while (!list_empty(&head_sh->batch_list)) { | ||
3532 | int i; | ||
3533 | sh = list_first_entry(&head_sh->batch_list, | ||
3534 | struct stripe_head, batch_list); | ||
3535 | list_del_init(&sh->batch_list); | ||
3536 | |||
3537 | WARN_ON_ONCE(sh->state & ((1 << STRIPE_ACTIVE) | | ||
3538 | (1 << STRIPE_SYNCING) | | ||
3539 | (1 << STRIPE_REPLACED) | | ||
3540 | (1 << STRIPE_PREREAD_ACTIVE) | | ||
3541 | (1 << STRIPE_DELAYED) | | ||
3542 | (1 << STRIPE_BIT_DELAY) | | ||
3543 | (1 << STRIPE_FULL_WRITE) | | ||
3544 | (1 << STRIPE_BIOFILL_RUN) | | ||
3545 | (1 << STRIPE_COMPUTE_RUN) | | ||
3546 | (1 << STRIPE_OPS_REQ_PENDING) | | ||
3547 | (1 << STRIPE_DISCARD) | | ||
3548 | (1 << STRIPE_BATCH_READY) | | ||
3549 | (1 << STRIPE_BATCH_ERR) | | ||
3550 | (1 << STRIPE_BITMAP_PENDING))); | ||
3551 | WARN_ON_ONCE(head_sh->state & ((1 << STRIPE_DISCARD) | | ||
3552 | (1 << STRIPE_REPLACED))); | ||
3553 | |||
3554 | set_mask_bits(&sh->state, ~(STRIPE_EXPAND_SYNC_FLAGS | | ||
3555 | (1 << STRIPE_DEGRADED)), | ||
3556 | head_sh->state & (1 << STRIPE_INSYNC)); | ||
3557 | |||
3558 | sh->check_state = head_sh->check_state; | ||
3559 | sh->reconstruct_state = head_sh->reconstruct_state; | ||
3560 | for (i = 0; i < sh->disks; i++) { | ||
3561 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | ||
3562 | wakeup_nr++; | ||
3563 | sh->dev[i].flags = head_sh->dev[i].flags; | ||
3564 | } | ||
3565 | |||
3566 | spin_lock_irq(&sh->stripe_lock); | ||
3567 | sh->batch_head = NULL; | ||
3568 | spin_unlock_irq(&sh->stripe_lock); | ||
3569 | if (sh->state & STRIPE_EXPAND_SYNC_FLAGS) | ||
3570 | set_bit(STRIPE_HANDLE, &sh->state); | ||
3571 | release_stripe(sh); | ||
3572 | } | ||
3573 | |||
3574 | spin_lock_irq(&head_sh->stripe_lock); | ||
3575 | head_sh->batch_head = NULL; | ||
3576 | spin_unlock_irq(&head_sh->stripe_lock); | ||
3577 | if (wakeup_nr) | ||
3578 | wake_up(&conf->wait_for_overlap); | ||
3579 | if (head_sh->state & STRIPE_EXPAND_SYNC_FLAGS) | ||
3580 | set_bit(STRIPE_HANDLE, &head_sh->state); | ||
3581 | } | 3528 | } |
3582 | 3529 | ||
3583 | static void handle_stripe_dirtying(struct r5conf *conf, | 3530 | static void handle_stripe_dirtying(struct r5conf *conf, |