[SCSI] Set max_phys_segments to sg_tablesize
diff mbox series

Message ID 20031015115740.GA23469@gondor.apana.org.au
State New, archived
Headers show
Series
  • [SCSI] Set max_phys_segments to sg_tablesize
Related show

Commit Message

Herbert Xu Oct. 15, 2003, 11:57 a.m. UTC
Hi:

Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
Hence they may break under 2.6 as the number of physical segments
is not limited by sg_tablesize.  This patch fixes that.

Cheers,

Comments

Jens Axboe Oct. 15, 2003, 12:02 p.m. UTC | #1
On Wed, Oct 15 2003, Herbert Xu wrote:
> Hi:
> 
> Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
> Hence they may break under 2.6 as the number of physical segments
> is not limited by sg_tablesize.  This patch fixes that.

Is sg_tablesize guarenteed to be set? Looks like you need a

===== drivers/scsi/hosts.c 1.94 vs edited =====
--- 1.94/drivers/scsi/hosts.c   Sun Sep 21 19:52:38 2003
+++ edited/drivers/scsi/hosts.c Wed Oct 15 14:02:14 2003
@@ -234,7 +234,11 @@
        shost->hostt = sht;
        shost->this_id = sht->this_id;
        shost->can_queue = sht->can_queue;
+
        shost->sg_tablesize = sht->sg_tablesize;
+       if (!shost->sg_tablesize)
+               shost->sg_tablesize = MAX_PHYS_SEGMENTS;
+
        shost->cmd_per_lun = sht->cmd_per_lun;
        shost->unchecked_isa_dma = sht->unchecked_isa_dma;
        shost->use_clustering = sht->use_clustering;

additionally.
Herbert Xu Oct. 15, 2003, 12:06 p.m. UTC | #2
On Wed, Oct 15, 2003 at 02:02:59PM +0200, Jens Axboe wrote:
> 
> Is sg_tablesize guarenteed to be set? Looks like you need a

This doesn't hurt of course.

However, 2.4's merging code assumed that sg_tablesize is always set.

Cheers,

Patch
diff mbox series

Index: kernel-source-2.5/drivers/scsi/scsi_lib.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/scsi/scsi_lib.c,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 scsi_lib.c
--- kernel-source-2.5/drivers/scsi/scsi_lib.c	28 Sep 2003 04:44:15 -0000	1.1.1.16
+++ kernel-source-2.5/drivers/scsi/scsi_lib.c	15 Oct 2003 11:32:20 -0000
@@ -1243,7 +1243,7 @@ 
 	blk_queue_prep_rq(q, scsi_prep_fn);
 
 	blk_queue_max_hw_segments(q, shost->sg_tablesize);
-	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
+	blk_queue_max_phys_segments(q, shost->sg_tablesize);
 	blk_queue_max_sectors(q, shost->max_sectors);
 	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 	blk_queue_segment_boundary(q, shost->dma_boundary);