diff options
| author | NeilBrown <neilb@suse.de> | 2012-11-21 17:13:36 -0500 |
|---|---|---|
| committer | NeilBrown <neilb@suse.de> | 2012-11-21 17:14:09 -0500 |
| commit | ef5b7c69b7a1b8b8744a6168b6ff02900f81b6ca (patch) | |
| tree | e1be4e404f7a60002ed447cf017f90c3e23b4565 | |
| parent | 4ac6875eeb97a49bad7bc8d56b5ec935904fc6e7 (diff) | |
md/raid5: move resolving of reconstruct_state earlier in
stripe_handle.
The chunk of code in stripe_handle which responds to a
*_result value in reconstruct_state is really the completion
of some processing that happened outside of handle_stripe
(possibly asynchronously) and so should be one of the first
things done in handle_stripe().
After the next patch it will be important that it happens before
handle_stripe_clean_event(), as that will clear some dev->flags
bit that this code tests.
Signed-off-by: NeilBrown <neilb@suse.de>
| -rw-r--r-- | drivers/md/raid5.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index baea94f0670a..0fb988556eea 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -3490,40 +3490,6 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 3490 | handle_failed_sync(conf, sh, &s); | 3490 | handle_failed_sync(conf, sh, &s); |
| 3491 | } | 3491 | } |
| 3492 | 3492 | ||
| 3493 | /* | ||
| 3494 | * might be able to return some write requests if the parity blocks | ||
| 3495 | * are safe, or on a failed drive | ||
| 3496 | */ | ||
| 3497 | pdev = &sh->dev[sh->pd_idx]; | ||
| 3498 | s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx) | ||
| 3499 | || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx); | ||
| 3500 | qdev = &sh->dev[sh->qd_idx]; | ||
| 3501 | s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx) | ||
| 3502 | || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx) | ||
| 3503 | || conf->level < 6; | ||
| 3504 | |||
| 3505 | if (s.written && | ||
| 3506 | (s.p_failed || ((test_bit(R5_Insync, &pdev->flags) | ||
| 3507 | && !test_bit(R5_LOCKED, &pdev->flags) | ||
| 3508 | && (test_bit(R5_UPTODATE, &pdev->flags) || | ||
| 3509 | test_bit(R5_Discard, &pdev->flags))))) && | ||
| 3510 | (s.q_failed || ((test_bit(R5_Insync, &qdev->flags) | ||
| 3511 | && !test_bit(R5_LOCKED, &qdev->flags) | ||
| 3512 | && (test_bit(R5_UPTODATE, &qdev->flags) || | ||
| 3513 | test_bit(R5_Discard, &qdev->flags)))))) | ||
| 3514 | handle_stripe_clean_event(conf, sh, disks, &s.return_bi); | ||
| 3515 | |||
| 3516 | /* Now we might consider reading some blocks, either to check/generate | ||
| 3517 | * parity, or to satisfy requests | ||
| 3518 | * or to load a block that is being partially written. | ||
| 3519 | */ | ||
| 3520 | if (s.to_read || s.non_overwrite | ||
| 3521 | || (conf->level == 6 && s.to_write && s.failed) | ||
| 3522 | || (s.syncing && (s.uptodate + s.compute < disks)) | ||
| 3523 | || s.replacing | ||
| 3524 | || s.expanding) | ||
| 3525 | handle_stripe_fill(sh, &s, disks); | ||
| 3526 | |||
| 3527 | /* Now we check to see if any write operations have recently | 3493 | /* Now we check to see if any write operations have recently |
| 3528 | * completed | 3494 | * completed |
| 3529 | */ | 3495 | */ |
| @@ -3561,6 +3527,40 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 3561 | s.dec_preread_active = 1; | 3527 | s.dec_preread_active = 1; |
| 3562 | } | 3528 | } |
| 3563 | 3529 | ||
| 3530 | /* | ||
| 3531 | * might be able to return some write requests if the parity blocks | ||
| 3532 | * are safe, or on a failed drive | ||
| 3533 | */ | ||
| 3534 | pdev = &sh->dev[sh->pd_idx]; | ||
| 3535 | s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx) | ||
| 3536 | || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx); | ||
| 3537 | qdev = &sh->dev[sh->qd_idx]; | ||
| 3538 | s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx) | ||
| 3539 | || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx) | ||
| 3540 | || conf->level < 6; | ||
| 3541 | |||
| 3542 | if (s.written && | ||
| 3543 | (s.p_failed || ((test_bit(R5_Insync, &pdev->flags) | ||
| 3544 | && !test_bit(R5_LOCKED, &pdev->flags) | ||
| 3545 | && (test_bit(R5_UPTODATE, &pdev->flags) || | ||
| 3546 | test_bit(R5_Discard, &pdev->flags))))) && | ||
| 3547 | (s.q_failed || ((test_bit(R5_Insync, &qdev->flags) | ||
| 3548 | && !test_bit(R5_LOCKED, &qdev->flags) | ||
| 3549 | && (test_bit(R5_UPTODATE, &qdev->flags) || | ||
| 3550 | test_bit(R5_Discard, &qdev->flags)))))) | ||
| 3551 | handle_stripe_clean_event(conf, sh, disks, &s.return_bi); | ||
| 3552 | |||
| 3553 | /* Now we might consider reading some blocks, either to check/generate | ||
| 3554 | * parity, or to satisfy requests | ||
| 3555 | * or to load a block that is being partially written. | ||
| 3556 | */ | ||
| 3557 | if (s.to_read || s.non_overwrite | ||
| 3558 | || (conf->level == 6 && s.to_write && s.failed) | ||
| 3559 | || (s.syncing && (s.uptodate + s.compute < disks)) | ||
| 3560 | || s.replacing | ||
| 3561 | || s.expanding) | ||
| 3562 | handle_stripe_fill(sh, &s, disks); | ||
| 3563 | |||
| 3564 | /* Now to consider new write requests and what else, if anything | 3564 | /* Now to consider new write requests and what else, if anything |
| 3565 | * should be read. We do not handle new writes when: | 3565 | * should be read. We do not handle new writes when: |
| 3566 | * 1/ A 'write' operation (copy+xor) is already in flight. | 3566 | * 1/ A 'write' operation (copy+xor) is already in flight. |
