aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-08-29 22:13:11 -0400
committerDan Williams <dan.j.williams@intel.com>2009-08-29 22:13:11 -0400
commit4e7d2c0aefb77f7b24942e5af042a083be4d60bb (patch)
tree59d127eac9d9c0ff5feea9d741739ccc6fae65c3 /drivers/md
parentcb3c82992f62f838e6476a0bff12909158007fc6 (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')
-rw-r--r--drivers/md/raid5.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 1f2a266f3cf7..e3a2990bdc7c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -623,18 +623,29 @@ static void ops_run_biofill(struct stripe_head *sh)
623 async_trigger_callback(&submit); 623 async_trigger_callback(&submit);
624} 624}
625 625
626static void mark_target_uptodate(struct stripe_head *sh, int target)
627{
628 struct r5dev *tgt;
629
630 if (target < 0)
631 return;
632
633 tgt = &sh->dev[target];
634 set_bit(R5_UPTODATE, &tgt->flags);
635 BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags));
636 clear_bit(R5_Wantcompute, &tgt->flags);
637}
638
626static void ops_complete_compute5(void *stripe_head_ref) 639static void ops_complete_compute5(void *stripe_head_ref)
627{ 640{
628 struct stripe_head *sh = stripe_head_ref; 641 struct stripe_head *sh = stripe_head_ref;
629 int target = sh->ops.target;
630 struct r5dev *tgt = &sh->dev[target];
631 642
632 pr_debug("%s: stripe %llu\n", __func__, 643 pr_debug("%s: stripe %llu\n", __func__,
633 (unsigned long long)sh->sector); 644 (unsigned long long)sh->sector);
634 645
635 set_bit(R5_UPTODATE, &tgt->flags); 646 /* mark the computed target as uptodate */
636 BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags)); 647 mark_target_uptodate(sh, sh->ops.target);
637 clear_bit(R5_Wantcompute, &tgt->flags); 648
638 clear_bit(STRIPE_COMPUTE_RUN, &sh->state); 649 clear_bit(STRIPE_COMPUTE_RUN, &sh->state);
639 if (sh->check_state == check_state_compute_run) 650 if (sh->check_state == check_state_compute_run)
640 sh->check_state = check_state_compute_result; 651 sh->check_state = check_state_compute_result;