diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 19:13:11 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 19:13:11 -0700 |
commit | 4e7d2c0aefb77f7b24942e5af042a083be4d60bb (patch) | |
tree | 59d127eac9d9c0ff5feea9d741739ccc6fae65c3 /drivers/md/raid5.c | |
parent | cb3c82992f62f838e6476a0bff12909158007fc6 (diff) |
md/raid5: factor out mark_uptodate from ops_complete_compute5
ops_complete_compute5 can be reused in the raid6 path if it is updated to
generically handle a second target.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1f2a266f3cf..e3a2990bdc7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -623,18 +623,29 @@ static void ops_run_biofill(struct stripe_head *sh) async_trigger_callback(&submit); } +static void mark_target_uptodate(struct stripe_head *sh, int target) +{ + struct r5dev *tgt; + + if (target < 0) + return; + + tgt = &sh->dev[target]; + set_bit(R5_UPTODATE, &tgt->flags); + BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags)); + clear_bit(R5_Wantcompute, &tgt->flags); +} + static void ops_complete_compute5(void *stripe_head_ref) { struct stripe_head *sh = stripe_head_ref; - int target = sh->ops.target; - struct r5dev *tgt = &sh->dev[target]; pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); - set_bit(R5_UPTODATE, &tgt->flags); - BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags)); - clear_bit(R5_Wantcompute, &tgt->flags); + /* mark the computed target as uptodate */ + mark_target_uptodate(sh, sh->ops.target); + clear_bit(STRIPE_COMPUTE_RUN, &sh->state); if (sh->check_state == check_state_compute_run) sh->check_state = check_state_compute_result; |