aboutsummaryrefslogtreecommitdiffstats
path: root/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-19 03:18:13 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-07-10 02:03:33 -0400
commitf4b09303d00212ead0619db58d8ec8a0a7a94882 (patch)
tree43f37ba1c6afe058eac7cdd345cea04ff7b1a851 /block/ll_rw_blk.c
parent554988d6fe369719ae5b41255c577569ecf47c30 (diff)
[BLOCK] drop unnecessary bvec rewinding from flush_dry_bio_endio
Barrier bios are completed twice - once after the barrier write itself is done and again after the whole sequence is complete. flush_dry_bio_endio() is for the first completion. It doesn't really complete the bio. It rewinds bvec and resets bio so that it can be completed again when the whole barrier sequence is complete. The bvec rewinding code has the following problems. 1. The rewinding code is wrong because filesystems may pass bvec with non zero bv_offset. 2. The block layer doesn't guarantee anything about the state of bvec array on request completion. bv_offset and len are updated iff __end_that_request_first() completes the bvec partially. Because of #2, #1 doesn't really matter (nobody cares whether bvec is re-wound correctly or not) but then again by not doing unwinding at all, we'll always give back the same bvec to the caller as full bvec completion doesn't alter bvecs and the final completion is always full completion. Drop unnecessary rewinding code. This is spotted by Neil Brown. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Neil Brown <neilb@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3e7801e49033..ef42bb2b12b6 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -527,8 +527,6 @@ int blk_do_ordered(request_queue_t *q, struct request **rqp)
527static int flush_dry_bio_endio(struct bio *bio, unsigned int bytes, int error) 527static int flush_dry_bio_endio(struct bio *bio, unsigned int bytes, int error)
528{ 528{
529 request_queue_t *q = bio->bi_private; 529 request_queue_t *q = bio->bi_private;
530 struct bio_vec *bvec;
531 int i;
532 530
533 /* 531 /*
534 * This is dry run, restore bio_sector and size. We'll finish 532 * This is dry run, restore bio_sector and size. We'll finish
@@ -540,13 +538,6 @@ static int flush_dry_bio_endio(struct bio *bio, unsigned int bytes, int error)
540 if (bio->bi_size) 538 if (bio->bi_size)
541 return 1; 539 return 1;
542 540
543 /* Rewind bvec's */
544 bio->bi_idx = 0;
545 bio_for_each_segment(bvec, bio, i) {
546 bvec->bv_len += bvec->bv_offset;
547 bvec->bv_offset = 0;
548 }
549
550 /* Reset bio */ 541 /* Reset bio */
551 set_bit(BIO_UPTODATE, &bio->bi_flags); 542 set_bit(BIO_UPTODATE, &bio->bi_flags);
552 bio->bi_size = q->bi_size; 543 bio->bi_size = q->bi_size;