Lines Matching refs:req

85 static int dump_stats(struct request *req,  in dump_stats()  argument
96 printk("nr_segments is %x\n", req->nr_segments); in dump_stats()
99 for (bh = req->bh; bh->b_reqnext != NULL; bh = bh->b_reqnext) in dump_stats()
115 #define SANITY_CHECK(req, _CLUSTER, _DMA) \ argument
116 if( req->nr_segments != __count_segments(req, _CLUSTER, _DMA, NULL) ) \
119 dump_stats(req, _CLUSTER, _DMA, __count_segments(req, _CLUSTER, _DMA, NULL)); \
122 #define SANITY_CHECK(req, _CLUSTER, _DMA) argument
186 __inline static int __count_segments(struct request *req, in __count_segments() argument
203 bh = req->bh; in __count_segments()
215 for (bh = req->bh, bhnext = bh->b_reqnext; in __count_segments()
290 struct request *req; in recount_segments() local
294 req = &SCpnt->request; in recount_segments()
298 req->nr_segments = __count_segments(req, in recount_segments()
309 struct request * req, in scsi_new_mergeable() argument
320 if (req->nr_segments >= max_segments || in scsi_new_mergeable()
321 req->nr_segments >= SHpnt->sg_tablesize) in scsi_new_mergeable()
323 req->nr_segments++; in scsi_new_mergeable()
328 struct request * req, in scsi_new_segment() argument
337 if (req->nr_hw_segments >= SHpnt->sg_tablesize || in scsi_new_segment()
338 req->nr_segments >= SHpnt->sg_tablesize) in scsi_new_segment()
340 req->nr_hw_segments++; in scsi_new_segment()
341 req->nr_segments++; in scsi_new_segment()
346 struct request * req, in scsi_new_segment() argument
350 if (req->nr_segments < SHpnt->sg_tablesize && in scsi_new_segment()
351 req->nr_segments < max_segments) { in scsi_new_segment()
356 req->nr_segments++; in scsi_new_segment()
398 struct request *req, in __scsi_back_merge_fn() argument
417 if ((req->nr_sectors + (bh->b_size >> 9)) > SHpnt->max_sectors) in __scsi_back_merge_fn()
420 if (!BH_PHYS_4G(req->bhtail, bh)) in __scsi_back_merge_fn()
430 if (dma_host && bh_phys(req->bhtail) - 1 == ISA_DMA_THRESHOLD) in __scsi_back_merge_fn()
432 if (BH_CONTIG(req->bhtail, bh)) { in __scsi_back_merge_fn()
436 count = __count_segments(req, use_clustering, dma_host, &segment_size); in __scsi_back_merge_fn()
450 if (MERGEABLE_BUFFERS(req->bhtail, bh)) in __scsi_back_merge_fn()
451 return scsi_new_mergeable(q, req, SHpnt, max_segments); in __scsi_back_merge_fn()
453 return scsi_new_segment(q, req, SHpnt, max_segments); in __scsi_back_merge_fn()
457 struct request *req, in __scsi_front_merge_fn() argument
476 if ((req->nr_sectors + (bh->b_size >> 9)) > SHpnt->max_sectors) in __scsi_front_merge_fn()
479 if (!BH_PHYS_4G(bh, req->bh)) in __scsi_front_merge_fn()
492 if (BH_CONTIG(bh, req->bh)) { in __scsi_front_merge_fn()
496 count = __count_segments(req, use_clustering, dma_host, &segment_size); in __scsi_front_merge_fn()
497 if( count != req->nr_segments ) { in __scsi_front_merge_fn()
510 if (MERGEABLE_BUFFERS(bh, req->bh)) in __scsi_front_merge_fn()
511 return scsi_new_mergeable(q, req, SHpnt, max_segments); in __scsi_front_merge_fn()
513 return scsi_new_segment(q, req, SHpnt, max_segments); in __scsi_front_merge_fn()
535 struct request * req, \
540 SANITY_CHECK(req, _CLUSTER, _DMA); \
542 req, \
595 struct request *req, in __scsi_merge_requests_fn() argument
608 if (req->special || next->special) in __scsi_merge_requests_fn()
621 if (req->nr_segments + next->nr_segments - 1 > max_segments || in __scsi_merge_requests_fn()
622 req->nr_segments + next->nr_segments - 1 > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
625 if (req->nr_hw_segments + next->nr_hw_segments - 1 > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
634 if (req->nr_segments + next->nr_segments - 1 > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
639 if ((req->nr_sectors + next->nr_sectors) > SHpnt->max_sectors) in __scsi_merge_requests_fn()
642 if (!BH_PHYS_4G(req->bhtail, next->bh)) in __scsi_merge_requests_fn()
656 if (dma_host && bh_phys(req->bhtail) - 1 == ISA_DMA_THRESHOLD) in __scsi_merge_requests_fn()
663 if (dma_host && BH_CONTIG(req->bhtail, next->bh) in __scsi_merge_requests_fn()
664 && bh_phys(req->bhtail) - 1 >= ISA_DMA_THRESHOLD) in __scsi_merge_requests_fn()
669 count = __count_segments(req, use_clustering, dma_host, &segment_size); in __scsi_merge_requests_fn()
671 if( count != req->nr_segments + next->nr_segments ) { in __scsi_merge_requests_fn()
676 if (BH_CONTIG(req->bhtail, next->bh)) { in __scsi_merge_requests_fn()
680 req->nr_segments += next->nr_segments - 1; in __scsi_merge_requests_fn()
682 req->nr_hw_segments += next->nr_hw_segments - 1; in __scsi_merge_requests_fn()
689 if (req->nr_segments + next->nr_segments > max_segments || in __scsi_merge_requests_fn()
690 req->nr_segments + next->nr_segments > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
697 if (MERGEABLE_BUFFERS (req->bhtail, next->bh)) { in __scsi_merge_requests_fn()
698 req->nr_hw_segments += next->nr_hw_segments - 1; in __scsi_merge_requests_fn()
699 } else if (req->nr_hw_segments + next->nr_hw_segments > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
702 req->nr_hw_segments += next->nr_hw_segments; in __scsi_merge_requests_fn()
704 req->nr_segments += next->nr_segments; in __scsi_merge_requests_fn()
712 if (req->nr_segments + next->nr_segments > max_segments || in __scsi_merge_requests_fn()
713 req->nr_segments + next->nr_segments > SHpnt->sg_tablesize) { in __scsi_merge_requests_fn()
720 req->nr_segments += next->nr_segments; in __scsi_merge_requests_fn()
745 struct request * req, \
750 SANITY_CHECK(req, _CLUSTER, _DMA); \
751 ret = __scsi_merge_requests_fn(q, req, next, max_segments, _CLUSTER, _DMA); \
804 struct request * req = &SCpnt->request; in __init_io() local
814 count = __count_segments(req, use_clustering, dma_host, NULL); in __init_io()
816 count = req->nr_segments; in __init_io()
825 this_count = req->current_nr_sectors; in __init_io()
838 this_count = req->nr_sectors; in __init_io()
871 this_count = req->current_nr_sectors; in __init_io()
900 for (count = 0, bh = req->bh; bh; bh = bh->b_reqnext) { in __init_io()
960 dump_stats(req, use_clustering, dma_host, count); in __init_io()
1012 if (req->cmd == WRITE) { in __init_io()
1057 for (this_count = 0, bh = req->bh; bh; bh = bh->b_reqnext) { in __init_io()
1070 this_count = req->current_nr_sectors; in __init_io()
1091 bh = req->bh; in __init_io()
1092 buff = req->buffer = bh->b_data; in __init_io()
1107 this_count = req->current_nr_sectors; in __init_io()
1113 if (req->cmd == WRITE) in __init_io()
1114 memcpy(buff, (char *) req->buffer, this_count << 9); in __init_io()