diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.2-ac7/drivers/scsi/hosts.h linux/drivers/scsi/hosts.h --- /opt/kernel/linux-2.4.2-ac7/drivers/scsi/hosts.h Thu Mar 1 15:46:16 2001 +++ linux/drivers/scsi/hosts.h Mon Feb 26 14:22:58 2001 @@ -242,6 +242,11 @@ short unsigned int sg_tablesize; /* + * if the host adapter has limitations beside segment count + */ + short unsigned int max_sectors; + + /* * True if this host adapter can make good use of linked commands. * This will allow more than one command to be queued to a given * unit on a given host. Set this to the maximum number of command @@ -379,6 +384,7 @@ int can_queue; short cmd_per_lun; short unsigned int sg_tablesize; + short unsigned int max_sectors; unsigned in_recovery:1; unsigned unchecked_isa_dma:1; diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.2-ac7/drivers/scsi/scsi_merge.c linux/drivers/scsi/scsi_merge.c --- /opt/kernel/linux-2.4.2-ac7/drivers/scsi/scsi_merge.c Fri Feb 9 20:30:23 2001 +++ linux/drivers/scsi/scsi_merge.c Mon Feb 26 14:24:33 2001 @@ -417,6 +417,10 @@ max_segments = 64; #endif + if (SHpnt->max_sectors + && (req->nr_sectors + (bh->b_size >> 9)) > SHpnt->max_sectors) + return 0; + if (use_clustering) { /* * See if we can do this without creating another @@ -473,6 +477,10 @@ max_segments = 64; #endif + if (SHpnt->max_sectors + && (req->nr_sectors + (bh->b_size >> 9)) > SHpnt->max_sectors) + return 0; + if (use_clustering) { /* * See if we can do this without creating another @@ -624,6 +632,11 @@ return 0; } #endif + + if (SHpnt->max_sectors + && (req->nr_sectors + next->nr_sectors) > SHpnt->max_sectors) + return 0; + /* * The main question is whether the two segments at the boundaries * would be considered one or two.