Turn calls to bi->bi_end_io() into bio_endio(). Apparently bio_endio does exactly the same error processing as is hardcoded at these places. bio_endio() avoids recursion, so it should be used. Signed-off-by: Mikulas Patocka --- drivers/md/raid5.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) Index: linux-2.6.26-devel/drivers/md/raid5.c =================================================================== --- linux-2.6.26-devel.orig/drivers/md/raid5.c 2008-07-14 19:07:52.000000000 +0200 +++ linux-2.6.26-devel/drivers/md/raid5.c 2008-07-14 19:15:42.000000000 +0200 @@ -115,9 +115,7 @@ static void return_io(struct bio *return return_bi = bi->bi_next; bi->bi_next = NULL; bi->bi_size = 0; - bi->bi_end_io(bi, - test_bit(BIO_UPTODATE, &bi->bi_flags) - ? 0 : -EIO); + bio_endio(bi, 0); bi = return_bi; } } @@ -3695,9 +3693,7 @@ static int make_request(struct request_q if ( rw == WRITE ) md_write_end(mddev); - bi->bi_end_io(bi, - test_bit(BIO_UPTODATE, &bi->bi_flags) - ? 0 : -EIO); + bio_endio(bi, 0); } return 0; } @@ -4000,12 +3996,8 @@ static int retry_aligned_read(raid5_con spin_lock_irq(&conf->device_lock); remaining = --raid_bio->bi_phys_segments; spin_unlock_irq(&conf->device_lock); - if (remaining == 0) { - - raid_bio->bi_end_io(raid_bio, - test_bit(BIO_UPTODATE, &raid_bio->bi_flags) - ? 0 : -EIO); - } + if (remaining == 0) + bio_endio(raid_bio, 0); if (atomic_dec_and_test(&conf->active_aligned_reads)) wake_up(&conf->wait_for_stripe); return handled;