[PATCH 014 of 35] Change blk_phys/hw_contig_segment to take requests, not bios.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These functions are always passed the last bio of one request
and the first of the next.  So it can work to just pass the
two requests and let them pick off the bios.  This makes life
easier for a future patch.

Signed-off-by: Neil Brown <[email protected]>

### Diffstat output
 ./block/ll_rw_blk.c |   36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff .prev/block/ll_rw_blk.c ./block/ll_rw_blk.c
--- .prev/block/ll_rw_blk.c	2007-07-31 11:20:58.000000000 +1000
+++ ./block/ll_rw_blk.c	2007-07-31 11:20:59.000000000 +1000
@@ -1271,38 +1271,42 @@ new_hw_segment:
 	rq->nr_hw_segments = nr_hw_segs;
 }
 
-static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
-				   struct bio *nxt)
+static int blk_phys_contig_segment(struct request_queue *q, struct request *req,
+				   struct request *nxt)
 {
 	if (!(q->queue_flags & (1 << QUEUE_FLAG_CLUSTER)))
 		return 0;
 
-	if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)))
+	if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(req->biotail),
+				   __BVEC_START(nxt->bio)))
 		return 0;
-	if (bio->bi_size + nxt->bi_size > q->max_segment_size)
+	if (req->biotail->bi_size + nxt->bio->bi_size > q->max_segment_size)
 		return 0;
 
 	/*
 	 * bio and nxt are contigous in memory, check if the queue allows
 	 * these two to be merged into one
 	 */
-	if (BIO_SEG_BOUNDARY(q, bio, nxt))
+	if (BIO_SEG_BOUNDARY(q, req->biotail, nxt->bio))
 		return 1;
 
 	return 0;
 }
 
-static int blk_hw_contig_segment(struct request_queue *q, struct bio *bio,
-				 struct bio *nxt)
+static int blk_hw_contig_segment(struct request_queue *q, struct request *req,
+				 struct request *nxt)
 {
-	if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
-		blk_recount_segments(q, bio);
-	if (unlikely(!bio_flagged(nxt, BIO_SEG_VALID)))
-		blk_recount_segments(q, nxt);
-	if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)) ||
-	    BIOVEC_VIRT_OVERSIZE(bio->bi_hw_back_size + nxt->bi_hw_front_size))
+	if (unlikely(!bio_flagged(req->biotail, BIO_SEG_VALID)))
+		blk_recount_segments(q, req->biotail);
+	if (unlikely(!bio_flagged(nxt->bio, BIO_SEG_VALID)))
+		blk_recount_segments(q, nxt->bio);
+	if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail),
+				   __BVEC_START(nxt->bio)) ||
+	    BIOVEC_VIRT_OVERSIZE(req->biotail->bi_hw_back_size +
+				 nxt->bio->bi_hw_front_size))
 		return 0;
-	if (bio->bi_hw_back_size + nxt->bi_hw_front_size > q->max_segment_size)
+	if (req->biotail->bi_hw_back_size + nxt->bio->bi_hw_front_size
+	    > q->max_segment_size)
 		return 0;
 
 	return 1;
@@ -1504,14 +1508,14 @@ static int ll_merge_requests_fn(struct r
 		return 0;
 
 	total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
-	if (blk_phys_contig_segment(q, req->biotail, next->bio))
+	if (blk_phys_contig_segment(q, req, next))
 		total_phys_segments--;
 
 	if (total_phys_segments > q->max_phys_segments)
 		return 0;
 
 	total_hw_segments = req->nr_hw_segments + next->nr_hw_segments;
-	if (blk_hw_contig_segment(q, req->biotail, next->bio)) {
+	if (blk_hw_contig_segment(q, req, next)) {
 		int len = req->biotail->bi_hw_back_size + next->bio->bi_hw_front_size;
 		/*
 		 * propagate the combined length to the end of the requests
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux