diff options
author | NeilBrown <neilb@suse.de> | 2007-09-27 06:47:43 -0400 |
---|---|---|
committer | Jens Axboe <axboe@carl.home.kernel.dk> | 2007-10-10 03:25:57 -0400 |
commit | 6712ecf8f648118c3363c142196418f89a510b90 (patch) | |
tree | 347d39a7d5a7ed96d3b1afecd28de2a0f98b98c9 /drivers/md/raid5.c | |
parent | 5bb23a688b2de23d7765a1dd439d89c038378978 (diff) |
Drop 'size' argument from bio_endio and bi_end_io
As bi_end_io is only called once when the reqeust is complete,
the 'size' argument is now redundant. Remove it.
Now there is no need for bio_endio to subtract the size completed
from bi_size. So don't do that either.
While we are at it, change bi_end_io to return void.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f96dea975fa5..caaca9e178bc 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -108,12 +108,11 @@ static void return_io(struct bio *return_bi) | |||
108 | { | 108 | { |
109 | struct bio *bi = return_bi; | 109 | struct bio *bi = return_bi; |
110 | while (bi) { | 110 | while (bi) { |
111 | int bytes = bi->bi_size; | ||
112 | 111 | ||
113 | return_bi = bi->bi_next; | 112 | return_bi = bi->bi_next; |
114 | bi->bi_next = NULL; | 113 | bi->bi_next = NULL; |
115 | bi->bi_size = 0; | 114 | bi->bi_size = 0; |
116 | bi->bi_end_io(bi, bytes, | 115 | bi->bi_end_io(bi, |
117 | test_bit(BIO_UPTODATE, &bi->bi_flags) | 116 | test_bit(BIO_UPTODATE, &bi->bi_flags) |
118 | ? 0 : -EIO); | 117 | ? 0 : -EIO); |
119 | bi = return_bi; | 118 | bi = return_bi; |
@@ -382,10 +381,10 @@ static unsigned long get_stripe_work(struct stripe_head *sh) | |||
382 | return pending; | 381 | return pending; |
383 | } | 382 | } |
384 | 383 | ||
385 | static int | 384 | static void |
386 | raid5_end_read_request(struct bio *bi, unsigned int bytes_done, int error); | 385 | raid5_end_read_request(struct bio *bi, int error); |
387 | static int | 386 | static void |
388 | raid5_end_write_request (struct bio *bi, unsigned int bytes_done, int error); | 387 | raid5_end_write_request(struct bio *bi, int error); |
389 | 388 | ||
390 | static void ops_run_io(struct stripe_head *sh) | 389 | static void ops_run_io(struct stripe_head *sh) |
391 | { | 390 | { |
@@ -1110,8 +1109,7 @@ static void shrink_stripes(raid5_conf_t *conf) | |||
1110 | conf->slab_cache = NULL; | 1109 | conf->slab_cache = NULL; |
1111 | } | 1110 | } |
1112 | 1111 | ||
1113 | static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | 1112 | static void raid5_end_read_request(struct bio * bi, int error) |
1114 | int error) | ||
1115 | { | 1113 | { |
1116 | struct stripe_head *sh = bi->bi_private; | 1114 | struct stripe_head *sh = bi->bi_private; |
1117 | raid5_conf_t *conf = sh->raid_conf; | 1115 | raid5_conf_t *conf = sh->raid_conf; |
@@ -1120,8 +1118,6 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
1120 | char b[BDEVNAME_SIZE]; | 1118 | char b[BDEVNAME_SIZE]; |
1121 | mdk_rdev_t *rdev; | 1119 | mdk_rdev_t *rdev; |
1122 | 1120 | ||
1123 | if (bi->bi_size) | ||
1124 | return 1; | ||
1125 | 1121 | ||
1126 | for (i=0 ; i<disks; i++) | 1122 | for (i=0 ; i<disks; i++) |
1127 | if (bi == &sh->dev[i].req) | 1123 | if (bi == &sh->dev[i].req) |
@@ -1132,7 +1128,7 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
1132 | uptodate); | 1128 | uptodate); |
1133 | if (i == disks) { | 1129 | if (i == disks) { |
1134 | BUG(); | 1130 | BUG(); |
1135 | return 0; | 1131 | return; |
1136 | } | 1132 | } |
1137 | 1133 | ||
1138 | if (uptodate) { | 1134 | if (uptodate) { |
@@ -1185,20 +1181,15 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
1185 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 1181 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
1186 | set_bit(STRIPE_HANDLE, &sh->state); | 1182 | set_bit(STRIPE_HANDLE, &sh->state); |
1187 | release_stripe(sh); | 1183 | release_stripe(sh); |
1188 | return 0; | ||
1189 | } | 1184 | } |
1190 | 1185 | ||
1191 | static int raid5_end_write_request (struct bio *bi, unsigned int bytes_done, | 1186 | static void raid5_end_write_request (struct bio *bi, int error) |
1192 | int error) | ||
1193 | { | 1187 | { |
1194 | struct stripe_head *sh = bi->bi_private; | 1188 | struct stripe_head *sh = bi->bi_private; |
1195 | raid5_conf_t *conf = sh->raid_conf; | 1189 | raid5_conf_t *conf = sh->raid_conf; |
1196 | int disks = sh->disks, i; | 1190 | int disks = sh->disks, i; |
1197 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); | 1191 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); |
1198 | 1192 | ||
1199 | if (bi->bi_size) | ||
1200 | return 1; | ||
1201 | |||
1202 | for (i=0 ; i<disks; i++) | 1193 | for (i=0 ; i<disks; i++) |
1203 | if (bi == &sh->dev[i].req) | 1194 | if (bi == &sh->dev[i].req) |
1204 | break; | 1195 | break; |
@@ -1208,7 +1199,7 @@ static int raid5_end_write_request (struct bio *bi, unsigned int bytes_done, | |||
1208 | uptodate); | 1199 | uptodate); |
1209 | if (i == disks) { | 1200 | if (i == disks) { |
1210 | BUG(); | 1201 | BUG(); |
1211 | return 0; | 1202 | return; |
1212 | } | 1203 | } |
1213 | 1204 | ||
1214 | if (!uptodate) | 1205 | if (!uptodate) |
@@ -1219,7 +1210,6 @@ static int raid5_end_write_request (struct bio *bi, unsigned int bytes_done, | |||
1219 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 1210 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
1220 | set_bit(STRIPE_HANDLE, &sh->state); | 1211 | set_bit(STRIPE_HANDLE, &sh->state); |
1221 | release_stripe(sh); | 1212 | release_stripe(sh); |
1222 | return 0; | ||
1223 | } | 1213 | } |
1224 | 1214 | ||
1225 | 1215 | ||
@@ -3340,7 +3330,7 @@ static struct bio *remove_bio_from_retry(raid5_conf_t *conf) | |||
3340 | * first). | 3330 | * first). |
3341 | * If the read failed.. | 3331 | * If the read failed.. |
3342 | */ | 3332 | */ |
3343 | static int raid5_align_endio(struct bio *bi, unsigned int bytes, int error) | 3333 | static void raid5_align_endio(struct bio *bi, int error) |
3344 | { | 3334 | { |
3345 | struct bio* raid_bi = bi->bi_private; | 3335 | struct bio* raid_bi = bi->bi_private; |
3346 | mddev_t *mddev; | 3336 | mddev_t *mddev; |
@@ -3348,8 +3338,6 @@ static int raid5_align_endio(struct bio *bi, unsigned int bytes, int error) | |||
3348 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); | 3338 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); |
3349 | mdk_rdev_t *rdev; | 3339 | mdk_rdev_t *rdev; |
3350 | 3340 | ||
3351 | if (bi->bi_size) | ||
3352 | return 1; | ||
3353 | bio_put(bi); | 3341 | bio_put(bi); |
3354 | 3342 | ||
3355 | mddev = raid_bi->bi_bdev->bd_disk->queue->queuedata; | 3343 | mddev = raid_bi->bi_bdev->bd_disk->queue->queuedata; |
@@ -3360,17 +3348,16 @@ static int raid5_align_endio(struct bio *bi, unsigned int bytes, int error) | |||
3360 | rdev_dec_pending(rdev, conf->mddev); | 3348 | rdev_dec_pending(rdev, conf->mddev); |
3361 | 3349 | ||
3362 | if (!error && uptodate) { | 3350 | if (!error && uptodate) { |
3363 | bio_endio(raid_bi, bytes, 0); | 3351 | bio_endio(raid_bi, 0); |
3364 | if (atomic_dec_and_test(&conf->active_aligned_reads)) | 3352 | if (atomic_dec_and_test(&conf->active_aligned_reads)) |
3365 | wake_up(&conf->wait_for_stripe); | 3353 | wake_up(&conf->wait_for_stripe); |
3366 | return 0; | 3354 | return; |
3367 | } | 3355 | } |
3368 | 3356 | ||
3369 | 3357 | ||
3370 | pr_debug("raid5_align_endio : io error...handing IO for a retry\n"); | 3358 | pr_debug("raid5_align_endio : io error...handing IO for a retry\n"); |
3371 | 3359 | ||
3372 | add_bio_to_retry(raid_bi, conf); | 3360 | add_bio_to_retry(raid_bi, conf); |
3373 | return 0; | ||
3374 | } | 3361 | } |
3375 | 3362 | ||
3376 | static int bio_fits_rdev(struct bio *bi) | 3363 | static int bio_fits_rdev(struct bio *bi) |
@@ -3476,7 +3463,7 @@ static int make_request(struct request_queue *q, struct bio * bi) | |||
3476 | int remaining; | 3463 | int remaining; |
3477 | 3464 | ||
3478 | if (unlikely(bio_barrier(bi))) { | 3465 | if (unlikely(bio_barrier(bi))) { |
3479 | bio_endio(bi, bi->bi_size, -EOPNOTSUPP); | 3466 | bio_endio(bi, -EOPNOTSUPP); |
3480 | return 0; | 3467 | return 0; |
3481 | } | 3468 | } |
3482 | 3469 | ||
@@ -3592,12 +3579,11 @@ static int make_request(struct request_queue *q, struct bio * bi) | |||
3592 | remaining = --bi->bi_phys_segments; | 3579 | remaining = --bi->bi_phys_segments; |
3593 | spin_unlock_irq(&conf->device_lock); | 3580 | spin_unlock_irq(&conf->device_lock); |
3594 | if (remaining == 0) { | 3581 | if (remaining == 0) { |
3595 | int bytes = bi->bi_size; | ||
3596 | 3582 | ||
3597 | if ( rw == WRITE ) | 3583 | if ( rw == WRITE ) |
3598 | md_write_end(mddev); | 3584 | md_write_end(mddev); |
3599 | bi->bi_size = 0; | 3585 | |
3600 | bi->bi_end_io(bi, bytes, | 3586 | bi->bi_end_io(bi, |
3601 | test_bit(BIO_UPTODATE, &bi->bi_flags) | 3587 | test_bit(BIO_UPTODATE, &bi->bi_flags) |
3602 | ? 0 : -EIO); | 3588 | ? 0 : -EIO); |
3603 | } | 3589 | } |
@@ -3875,10 +3861,8 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio) | |||
3875 | remaining = --raid_bio->bi_phys_segments; | 3861 | remaining = --raid_bio->bi_phys_segments; |
3876 | spin_unlock_irq(&conf->device_lock); | 3862 | spin_unlock_irq(&conf->device_lock); |
3877 | if (remaining == 0) { | 3863 | if (remaining == 0) { |
3878 | int bytes = raid_bio->bi_size; | ||
3879 | 3864 | ||
3880 | raid_bio->bi_size = 0; | 3865 | raid_bio->bi_end_io(raid_bio, |
3881 | raid_bio->bi_end_io(raid_bio, bytes, | ||
3882 | test_bit(BIO_UPTODATE, &raid_bio->bi_flags) | 3866 | test_bit(BIO_UPTODATE, &raid_bio->bi_flags) |
3883 | ? 0 : -EIO); | 3867 | ? 0 : -EIO); |
3884 | } | 3868 | } |