Re: [BUG] 2.6.29-rc6-2450cf in scsi_lib.c (was: Large amount ofscsi-sgpool)objects

From: James Bottomley
Date: Wed Mar 04 2009 - 17:56:47 EST


On Wed, 2009-03-04 at 22:45 +0100, Thomas Gleixner wrote:
> On Wed, 4 Mar 2009, Thomas Gleixner wrote:
>
> Instrumented the code and the result of the failing request is
> below. Looks like the function which sets up the request gets
> nr_phys_segments wrong by one.
>
> If you need further trace data feel free to ask.

OK, the mapping all checks out correctly ... there must be something
wrong with the way we count before mapping.

If you're tracing everything, could you add these static prints to the
trace ... they'll trigger a lot, but capturing how they applied to the
failing request might tell us why the count is wrong.

Thanks,

James

---

diff --git a/block/blk-merge.c b/block/blk-merge.c
index a104593..a529cba 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -127,21 +127,29 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
return 0;

if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
- q->max_segment_size)
+ q->max_segment_size) {
+ printk("Refusing contig merge, over segment size\n");
return 0;
+ }

- if (!bio_has_data(bio))
+ if (!bio_has_data(bio)) {
+ printk("Allowing contig merge, bio has no data\n");
return 1;
+ }

- if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)))
+ if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt))) {
+ printk("Refusing contig merge, bio not phys mergeable\n");
return 0;
+ }

/*
* bio and nxt are contiguous 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, bio, nxt)) {
+ printk("Allowing contig merge, not across segment boundary\n");
return 1;
+ }

return 0;
}
@@ -325,6 +333,12 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
if ((req->nr_sectors + next->nr_sectors) > q->max_sectors)
return 0;

+ printk("Merging end %lx (segs %d) with beginning %lx (segs %d)\n",
+ bvec_to_phys(__BVEC_END(req->biotail)), req->nr_phys_segments,
+ bvec_to_phys(__BVEC_START(next->bio)), next->nr_phys_segments);
+ printk("Front size is %d, back size is %d\n",
+ next->bio->bi_seg_front_size, req->biotail->bi_seg_back_size);
+
total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
if (req->nr_phys_segments == 1)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/