diff options
-rw-r--r-- | drivers/md/raid5.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4d63773ee73a..f96dea975fa5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -514,7 +514,7 @@ static void ops_complete_biofill(void *stripe_head_ref) | |||
514 | struct stripe_head *sh = stripe_head_ref; | 514 | struct stripe_head *sh = stripe_head_ref; |
515 | struct bio *return_bi = NULL; | 515 | struct bio *return_bi = NULL; |
516 | raid5_conf_t *conf = sh->raid_conf; | 516 | raid5_conf_t *conf = sh->raid_conf; |
517 | int i, more_to_read = 0; | 517 | int i; |
518 | 518 | ||
519 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 519 | pr_debug("%s: stripe %llu\n", __FUNCTION__, |
520 | (unsigned long long)sh->sector); | 520 | (unsigned long long)sh->sector); |
@@ -522,16 +522,14 @@ static void ops_complete_biofill(void *stripe_head_ref) | |||
522 | /* clear completed biofills */ | 522 | /* clear completed biofills */ |
523 | for (i = sh->disks; i--; ) { | 523 | for (i = sh->disks; i--; ) { |
524 | struct r5dev *dev = &sh->dev[i]; | 524 | struct r5dev *dev = &sh->dev[i]; |
525 | /* check if this stripe has new incoming reads */ | ||
526 | if (dev->toread) | ||
527 | more_to_read++; | ||
528 | 525 | ||
529 | /* acknowledge completion of a biofill operation */ | 526 | /* acknowledge completion of a biofill operation */ |
530 | /* and check if we need to reply to a read request | 527 | /* and check if we need to reply to a read request, |
531 | */ | 528 | * new R5_Wantfill requests are held off until |
532 | if (test_bit(R5_Wantfill, &dev->flags) && !dev->toread) { | 529 | * !test_bit(STRIPE_OP_BIOFILL, &sh->ops.pending) |
530 | */ | ||
531 | if (test_and_clear_bit(R5_Wantfill, &dev->flags)) { | ||
533 | struct bio *rbi, *rbi2; | 532 | struct bio *rbi, *rbi2; |
534 | clear_bit(R5_Wantfill, &dev->flags); | ||
535 | 533 | ||
536 | /* The access to dev->read is outside of the | 534 | /* The access to dev->read is outside of the |
537 | * spin_lock_irq(&conf->device_lock), but is protected | 535 | * spin_lock_irq(&conf->device_lock), but is protected |
@@ -558,8 +556,7 @@ static void ops_complete_biofill(void *stripe_head_ref) | |||
558 | 556 | ||
559 | return_io(return_bi); | 557 | return_io(return_bi); |
560 | 558 | ||
561 | if (more_to_read) | 559 | set_bit(STRIPE_HANDLE, &sh->state); |
562 | set_bit(STRIPE_HANDLE, &sh->state); | ||
563 | release_stripe(sh); | 560 | release_stripe(sh); |
564 | } | 561 | } |
565 | 562 | ||