Share code between init_request_from_bio and blk_rq_bio_prep
authorNeilBrown <neilb@suse.de>
Thu, 16 Aug 2007 11:31:30 +0000 (13:31 +0200)
committerJens Axboe <axboe@carl.home.kernel.dk>
Wed, 10 Oct 2007 07:25:56 +0000 (09:25 +0200)
These have very similar functions and should share code where
possible.

Signed-off-by: Neil Brown <neilb@suse.de>
diff .prev/block/ll_rw_blk.c ./block/ll_rw_blk.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/ll_rw_blk.c

index eb27b335d238173faa459077bb609878596fde79..e0608c4ecc23dd5a63fe193615a79643dadfd1ad 100644 (file)
@@ -2941,15 +2941,9 @@ static void init_request_from_bio(struct request *req, struct bio *bio)
 
        req->errors = 0;
        req->hard_sector = req->sector = bio->bi_sector;
-       req->hard_nr_sectors = req->nr_sectors = bio_sectors(bio);
-       req->current_nr_sectors = req->hard_cur_sectors = bio_cur_sectors(bio);
-       req->nr_phys_segments = bio_phys_segments(req->q, bio);
-       req->nr_hw_segments = bio_hw_segments(req->q, bio);
-       req->buffer = bio_data(bio);    /* see ->buffer comment above */
-       req->bio = req->biotail = bio;
        req->ioprio = bio_prio(bio);
-       req->rq_disk = bio->bi_bdev->bd_disk;
        req->start_time = jiffies;
+       blk_rq_bio_prep(req->q, req, bio);
 }
 
 static int __make_request(struct request_queue *q, struct bio *bio)