aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-15 12:11:46 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-30 14:14:02 -0500
commitd3f46f39b7092594b498abc12f0c73b0b9913bde (patch)
tree6d595bdecbdd41a958e05e425664209f5d71ecf1 /drivers/scsi
parentb8de16318410f6f8611a879678a531237e4aadc9 (diff)
[SCSI] remove use_sg_chaining
With the sg table code, every SCSI driver is now either chain capable or broken (or has sg_tablesize set so chaining is never activated), so there's no need to have a check in the host template. Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-9xxx.c1
-rw-r--r--drivers/scsi/3w-xxxx.c1
-rw-r--r--drivers/scsi/BusLogic.c1
-rw-r--r--drivers/scsi/NCR53c406a.c1
-rw-r--r--drivers/scsi/a100u2w.c1
-rw-r--r--drivers/scsi/aacraid/linit.c1
-rw-r--r--drivers/scsi/aha1740.c1
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c1
-rw-r--r--drivers/scsi/aic7xxx_old.c1
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c1
-rw-r--r--drivers/scsi/dc395x.c1
-rw-r--r--drivers/scsi/dpt_i2o.c1
-rw-r--r--drivers/scsi/eata.c1
-rw-r--r--drivers/scsi/hosts.c1
-rw-r--r--drivers/scsi/hptiop.c1
-rw-r--r--drivers/scsi/ibmmca.c1
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c1
-rw-r--r--drivers/scsi/initio.c1
-rw-r--r--drivers/scsi/iscsi_tcp.c1
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c2
-rw-r--r--drivers/scsi/mac53c94.c1
-rw-r--r--drivers/scsi/megaraid.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c1
-rw-r--r--drivers/scsi/mesh.c1
-rw-r--r--drivers/scsi/nsp32.c1
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c1
-rw-r--r--drivers/scsi/qla1280.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c1
-rw-r--r--drivers/scsi/qlogicfas.c1
-rw-r--r--drivers/scsi/scsi_lib.c74
-rw-r--r--drivers/scsi/stex.c1
-rw-r--r--drivers/scsi/sym53c416.c1
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c1
-rw-r--r--drivers/scsi/u14-34f.c1
-rw-r--r--drivers/scsi/ultrastor.c1
-rw-r--r--drivers/scsi/wd7000.c1
39 files changed, 18 insertions, 96 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 1c244832c6c..b4912d1cee2 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1990,7 +1990,6 @@ static struct scsi_host_template driver_template = {
1990 .max_sectors = TW_MAX_SECTORS, 1990 .max_sectors = TW_MAX_SECTORS,
1991 .cmd_per_lun = TW_MAX_CMDS_PER_LUN, 1991 .cmd_per_lun = TW_MAX_CMDS_PER_LUN,
1992 .use_clustering = ENABLE_CLUSTERING, 1992 .use_clustering = ENABLE_CLUSTERING,
1993 .use_sg_chaining = ENABLE_SG_CHAINING,
1994 .shost_attrs = twa_host_attrs, 1993 .shost_attrs = twa_host_attrs,
1995 .emulated = 1 1994 .emulated = 1
1996}; 1995};
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 59716ebeb10..d0953216221 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -2261,7 +2261,6 @@ static struct scsi_host_template driver_template = {
2261 .max_sectors = TW_MAX_SECTORS, 2261 .max_sectors = TW_MAX_SECTORS,
2262 .cmd_per_lun = TW_MAX_CMDS_PER_LUN, 2262 .cmd_per_lun = TW_MAX_CMDS_PER_LUN,
2263 .use_clustering = ENABLE_CLUSTERING, 2263 .use_clustering = ENABLE_CLUSTERING,
2264 .use_sg_chaining = ENABLE_SG_CHAINING,
2265 .shost_attrs = tw_host_attrs, 2264 .shost_attrs = tw_host_attrs,
2266 .emulated = 1 2265 .emulated = 1
2267}; 2266};
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index ead47c143ce..4d3ebb1af49 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3575,7 +3575,6 @@ static struct scsi_host_template Bus_Logic_template = {
3575 .unchecked_isa_dma = 1, 3575 .unchecked_isa_dma = 1,
3576 .max_sectors = 128, 3576 .max_sectors = 128,
3577 .use_clustering = ENABLE_CLUSTERING, 3577 .use_clustering = ENABLE_CLUSTERING,
3578 .use_sg_chaining = ENABLE_SG_CHAINING,
3579}; 3578};
3580 3579
3581/* 3580/*
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index 137d065db3d..6961f78742a 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -1065,7 +1065,6 @@ static struct scsi_host_template driver_template =
1065 .cmd_per_lun = 1 /* commands per lun */, 1065 .cmd_per_lun = 1 /* commands per lun */,
1066 .unchecked_isa_dma = 1 /* unchecked_isa_dma */, 1066 .unchecked_isa_dma = 1 /* unchecked_isa_dma */,
1067 .use_clustering = ENABLE_CLUSTERING, 1067 .use_clustering = ENABLE_CLUSTERING,
1068 .use_sg_chaining = ENABLE_SG_CHAINING,
1069}; 1068};
1070 1069
1071#include "scsi_module.c" 1070#include "scsi_module.c"
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index d3a6d15fb77..f608d4a1d6d 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1071,7 +1071,6 @@ static struct scsi_host_template inia100_template = {
1071 .sg_tablesize = SG_ALL, 1071 .sg_tablesize = SG_ALL,
1072 .cmd_per_lun = 1, 1072 .cmd_per_lun = 1,
1073 .use_clustering = ENABLE_CLUSTERING, 1073 .use_clustering = ENABLE_CLUSTERING,
1074 .use_sg_chaining = ENABLE_SG_CHAINING,
1075}; 1074};
1076 1075
1077static int __devinit inia100_probe_one(struct pci_dev *pdev, 1076static int __devinit inia100_probe_one(struct pci_dev *pdev,
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 61be22774e9..0e8267c1e91 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1032,7 +1032,6 @@ static struct scsi_host_template aac_driver_template = {
1032 .cmd_per_lun = AAC_NUM_IO_FIB, 1032 .cmd_per_lun = AAC_NUM_IO_FIB,
1033#endif 1033#endif
1034 .use_clustering = ENABLE_CLUSTERING, 1034 .use_clustering = ENABLE_CLUSTERING,
1035 .use_sg_chaining = ENABLE_SG_CHAINING,
1036 .emulated = 1, 1035 .emulated = 1,
1037}; 1036};
1038 1037
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index be58a0b097c..7c45d88a205 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -563,7 +563,6 @@ static struct scsi_host_template aha1740_template = {
563 .sg_tablesize = AHA1740_SCATTER, 563 .sg_tablesize = AHA1740_SCATTER,
564 .cmd_per_lun = AHA1740_CMDLUN, 564 .cmd_per_lun = AHA1740_CMDLUN,
565 .use_clustering = ENABLE_CLUSTERING, 565 .use_clustering = ENABLE_CLUSTERING,
566 .use_sg_chaining = ENABLE_SG_CHAINING,
567 .eh_abort_handler = aha1740_eh_abort_handler, 566 .eh_abort_handler = aha1740_eh_abort_handler,
568}; 567};
569 568
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 3c4efa4ae54..01465479290 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -766,7 +766,6 @@ struct scsi_host_template aic79xx_driver_template = {
766 .max_sectors = 8192, 766 .max_sectors = 8192,
767 .cmd_per_lun = 2, 767 .cmd_per_lun = 2,
768 .use_clustering = ENABLE_CLUSTERING, 768 .use_clustering = ENABLE_CLUSTERING,
769 .use_sg_chaining = ENABLE_SG_CHAINING,
770 .slave_alloc = ahd_linux_slave_alloc, 769 .slave_alloc = ahd_linux_slave_alloc,
771 .slave_configure = ahd_linux_slave_configure, 770 .slave_configure = ahd_linux_slave_configure,
772 .target_alloc = ahd_linux_target_alloc, 771 .target_alloc = ahd_linux_target_alloc,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index bff7f8c5985..99a3b33a323 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -747,7 +747,6 @@ struct scsi_host_template aic7xxx_driver_template = {
747 .max_sectors = 8192, 747 .max_sectors = 8192,
748 .cmd_per_lun = 2, 748 .cmd_per_lun = 2,
749 .use_clustering = ENABLE_CLUSTERING, 749 .use_clustering = ENABLE_CLUSTERING,
750 .use_sg_chaining = ENABLE_SG_CHAINING,
751 .slave_alloc = ahc_linux_slave_alloc, 750 .slave_alloc = ahc_linux_slave_alloc,
752 .slave_configure = ahc_linux_slave_configure, 751 .slave_configure = ahc_linux_slave_configure,
753 .target_alloc = ahc_linux_target_alloc, 752 .target_alloc = ahc_linux_target_alloc,
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index bcb0b870320..3bfd9296bbf 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -11141,7 +11141,6 @@ static struct scsi_host_template driver_template = {
11141 .max_sectors = 2048, 11141 .max_sectors = 2048,
11142 .cmd_per_lun = 3, 11142 .cmd_per_lun = 3,
11143 .use_clustering = ENABLE_CLUSTERING, 11143 .use_clustering = ENABLE_CLUSTERING,
11144 .use_sg_chaining = ENABLE_SG_CHAINING,
11145}; 11144};
11146 11145
11147#include "scsi_module.c" 11146#include "scsi_module.c"
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index d80dba913a7..f4a202e8df2 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -122,7 +122,6 @@ static struct scsi_host_template arcmsr_scsi_host_template = {
122 .max_sectors = ARCMSR_MAX_XFER_SECTORS, 122 .max_sectors = ARCMSR_MAX_XFER_SECTORS,
123 .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, 123 .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN,
124 .use_clustering = ENABLE_CLUSTERING, 124 .use_clustering = ENABLE_CLUSTERING,
125 .use_sg_chaining = ENABLE_SG_CHAINING,
126 .shost_attrs = arcmsr_host_attrs, 125 .shost_attrs = arcmsr_host_attrs,
127}; 126};
128#ifdef CONFIG_SCSI_ARCMSR_AER 127#ifdef CONFIG_SCSI_ARCMSR_AER
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index f93c73c0ba5..22ef3716e78 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4763,7 +4763,6 @@ static struct scsi_host_template dc395x_driver_template = {
4763 .eh_bus_reset_handler = dc395x_eh_bus_reset, 4763 .eh_bus_reset_handler = dc395x_eh_bus_reset,
4764 .unchecked_isa_dma = 0, 4764 .unchecked_isa_dma = 0,
4765 .use_clustering = DISABLE_CLUSTERING, 4765 .use_clustering = DISABLE_CLUSTERING,
4766 .use_sg_chaining = ENABLE_SG_CHAINING,
4767}; 4766};
4768 4767
4769 4768
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 19cce125124..c9dd8392aab 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -3340,7 +3340,6 @@ static struct scsi_host_template driver_template = {
3340 .this_id = 7, 3340 .this_id = 7,
3341 .cmd_per_lun = 1, 3341 .cmd_per_lun = 1,
3342 .use_clustering = ENABLE_CLUSTERING, 3342 .use_clustering = ENABLE_CLUSTERING,
3343 .use_sg_chaining = ENABLE_SG_CHAINING,
3344}; 3343};
3345#include "scsi_module.c" 3344#include "scsi_module.c"
3346MODULE_LICENSE("GPL"); 3345MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 05163cefec1..8be3d76656f 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -524,7 +524,6 @@ static struct scsi_host_template driver_template = {
524 .this_id = 7, 524 .this_id = 7,
525 .unchecked_isa_dma = 1, 525 .unchecked_isa_dma = 1,
526 .use_clustering = ENABLE_CLUSTERING, 526 .use_clustering = ENABLE_CLUSTERING,
527 .use_sg_chaining = ENABLE_SG_CHAINING,
528}; 527};
529 528
530#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) 529#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 5ea1f986220..880c78bff0e 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -342,7 +342,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
342 shost->use_clustering = sht->use_clustering; 342 shost->use_clustering = sht->use_clustering;
343 shost->ordered_tag = sht->ordered_tag; 343 shost->ordered_tag = sht->ordered_tag;
344 shost->active_mode = sht->supported_mode; 344 shost->active_mode = sht->supported_mode;
345 shost->use_sg_chaining = sht->use_sg_chaining;
346 345
347 if (sht->supported_mode == MODE_UNKNOWN) 346 if (sht->supported_mode == MODE_UNKNOWN)
348 /* means we didn't set it ... default to INITIATOR */ 347 /* means we didn't set it ... default to INITIATOR */
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 890f44fa0e1..ff149ad6bc4 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -906,7 +906,6 @@ static struct scsi_host_template driver_template = {
906 .unchecked_isa_dma = 0, 906 .unchecked_isa_dma = 0,
907 .emulated = 0, 907 .emulated = 0,
908 .use_clustering = ENABLE_CLUSTERING, 908 .use_clustering = ENABLE_CLUSTERING,
909 .use_sg_chaining = ENABLE_SG_CHAINING,
910 .proc_name = driver_name, 909 .proc_name = driver_name,
911 .shost_attrs = hptiop_attrs, 910 .shost_attrs = hptiop_attrs,
912 .this_id = -1, 911 .this_id = -1,
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index db004a45073..4d15a62914e 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -1501,7 +1501,6 @@ static struct scsi_host_template ibmmca_driver_template = {
1501 .sg_tablesize = 16, 1501 .sg_tablesize = 16,
1502 .cmd_per_lun = 1, 1502 .cmd_per_lun = 1,
1503 .use_clustering = ENABLE_CLUSTERING, 1503 .use_clustering = ENABLE_CLUSTERING,
1504 .use_sg_chaining = ENABLE_SG_CHAINING,
1505}; 1504};
1506 1505
1507static int ibmmca_probe(struct device *dev) 1506static int ibmmca_probe(struct device *dev)
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 30819012898..78d46a900bb 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1600,7 +1600,6 @@ static struct scsi_host_template driver_template = {
1600 .this_id = -1, 1600 .this_id = -1,
1601 .sg_tablesize = SG_ALL, 1601 .sg_tablesize = SG_ALL,
1602 .use_clustering = ENABLE_CLUSTERING, 1602 .use_clustering = ENABLE_CLUSTERING,
1603 .use_sg_chaining = ENABLE_SG_CHAINING,
1604 .shost_attrs = ibmvscsi_attrs, 1603 .shost_attrs = ibmvscsi_attrs,
1605}; 1604};
1606 1605
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index a10a5c74b48..0cc8868ea35 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2833,7 +2833,6 @@ static struct scsi_host_template initio_template = {
2833 .sg_tablesize = SG_ALL, 2833 .sg_tablesize = SG_ALL,
2834 .cmd_per_lun = 1, 2834 .cmd_per_lun = 1,
2835 .use_clustering = ENABLE_CLUSTERING, 2835 .use_clustering = ENABLE_CLUSTERING,
2836 .use_sg_chaining = ENABLE_SG_CHAINING,
2837}; 2836};
2838 2837
2839static int initio_probe_one(struct pci_dev *pdev, 2838static int initio_probe_one(struct pci_dev *pdev,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index e5be5fd4ef5..b6f99dfbb03 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1933,7 +1933,6 @@ static struct scsi_host_template iscsi_sht = {
1933 .eh_device_reset_handler= iscsi_eh_device_reset, 1933 .eh_device_reset_handler= iscsi_eh_device_reset,
1934 .eh_host_reset_handler = iscsi_eh_host_reset, 1934 .eh_host_reset_handler = iscsi_eh_host_reset,
1935 .use_clustering = DISABLE_CLUSTERING, 1935 .use_clustering = DISABLE_CLUSTERING,
1936 .use_sg_chaining = ENABLE_SG_CHAINING,
1937 .slave_configure = iscsi_tcp_slave_configure, 1936 .slave_configure = iscsi_tcp_slave_configure,
1938 .proc_name = "iscsi_tcp", 1937 .proc_name = "iscsi_tcp",
1939 .this_id = -1, 1938 .this_id = -1,
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 6483c62730b..fc5c3a42b05 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1459,7 +1459,6 @@ struct scsi_host_template lpfc_template = {
1459 .scan_finished = lpfc_scan_finished, 1459 .scan_finished = lpfc_scan_finished,
1460 .this_id = -1, 1460 .this_id = -1,
1461 .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, 1461 .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT,
1462 .use_sg_chaining = ENABLE_SG_CHAINING,
1463 .cmd_per_lun = LPFC_CMD_PER_LUN, 1462 .cmd_per_lun = LPFC_CMD_PER_LUN,
1464 .use_clustering = ENABLE_CLUSTERING, 1463 .use_clustering = ENABLE_CLUSTERING,
1465 .shost_attrs = lpfc_hba_attrs, 1464 .shost_attrs = lpfc_hba_attrs,
@@ -1482,7 +1481,6 @@ struct scsi_host_template lpfc_vport_template = {
1482 .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, 1481 .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT,
1483 .cmd_per_lun = LPFC_CMD_PER_LUN, 1482 .cmd_per_lun = LPFC_CMD_PER_LUN,
1484 .use_clustering = ENABLE_CLUSTERING, 1483 .use_clustering = ENABLE_CLUSTERING,
1485 .use_sg_chaining = ENABLE_SG_CHAINING,
1486 .shost_attrs = lpfc_vport_attrs, 1484 .shost_attrs = lpfc_vport_attrs,
1487 .max_sectors = 0xFFFF, 1485 .max_sectors = 0xFFFF,
1488}; 1486};
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index a035001f443..b12ad7c7c67 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -402,7 +402,6 @@ static struct scsi_host_template mac53c94_template = {
402 .sg_tablesize = SG_ALL, 402 .sg_tablesize = SG_ALL,
403 .cmd_per_lun = 1, 403 .cmd_per_lun = 1,
404 .use_clustering = DISABLE_CLUSTERING, 404 .use_clustering = DISABLE_CLUSTERING,
405 .use_sg_chaining = ENABLE_SG_CHAINING,
406}; 405};
407 406
408static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match) 407static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 765c24d2bc3..4d59ae8491a 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4490,7 +4490,6 @@ static struct scsi_host_template megaraid_template = {
4490 .sg_tablesize = MAX_SGLIST, 4490 .sg_tablesize = MAX_SGLIST,
4491 .cmd_per_lun = DEF_CMD_PER_LUN, 4491 .cmd_per_lun = DEF_CMD_PER_LUN,
4492 .use_clustering = ENABLE_CLUSTERING, 4492 .use_clustering = ENABLE_CLUSTERING,
4493 .use_sg_chaining = ENABLE_SG_CHAINING,
4494 .eh_abort_handler = megaraid_abort, 4493 .eh_abort_handler = megaraid_abort,
4495 .eh_device_reset_handler = megaraid_reset, 4494 .eh_device_reset_handler = megaraid_reset,
4496 .eh_bus_reset_handler = megaraid_reset, 4495 .eh_bus_reset_handler = megaraid_reset,
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 24e32e446e7..6db77c00e3e 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -361,7 +361,6 @@ static struct scsi_host_template megaraid_template_g = {
361 .eh_host_reset_handler = megaraid_reset_handler, 361 .eh_host_reset_handler = megaraid_reset_handler,
362 .change_queue_depth = megaraid_change_queue_depth, 362 .change_queue_depth = megaraid_change_queue_depth,
363 .use_clustering = ENABLE_CLUSTERING, 363 .use_clustering = ENABLE_CLUSTERING,
364 .use_sg_chaining = ENABLE_SG_CHAINING,
365 .sdev_attrs = megaraid_sdev_attrs, 364 .sdev_attrs = megaraid_sdev_attrs,
366 .shost_attrs = megaraid_shost_attrs, 365 .shost_attrs = megaraid_shost_attrs,
367}; 366};
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index d7ec921865c..672c759ac24 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -1192,7 +1192,6 @@ static struct scsi_host_template megasas_template = {
1192 .eh_timed_out = megasas_reset_timer, 1192 .eh_timed_out = megasas_reset_timer,
1193 .bios_param = megasas_bios_param, 1193 .bios_param = megasas_bios_param,
1194 .use_clustering = ENABLE_CLUSTERING, 1194 .use_clustering = ENABLE_CLUSTERING,
1195 .use_sg_chaining = ENABLE_SG_CHAINING,
1196}; 1195};
1197 1196
1198/** 1197/**
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 7470ff39ab2..651d09b08f2 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1843,7 +1843,6 @@ static struct scsi_host_template mesh_template = {
1843 .sg_tablesize = SG_ALL, 1843 .sg_tablesize = SG_ALL,
1844 .cmd_per_lun = 2, 1844 .cmd_per_lun = 2,
1845 .use_clustering = DISABLE_CLUSTERING, 1845 .use_clustering = DISABLE_CLUSTERING,
1846 .use_sg_chaining = ENABLE_SG_CHAINING,
1847}; 1846};
1848 1847
1849static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) 1848static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 28161dc95e0..7fed3537215 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -281,7 +281,6 @@ static struct scsi_host_template nsp32_template = {
281 .cmd_per_lun = 1, 281 .cmd_per_lun = 1,
282 .this_id = NSP32_HOST_SCSIID, 282 .this_id = NSP32_HOST_SCSIID,
283 .use_clustering = DISABLE_CLUSTERING, 283 .use_clustering = DISABLE_CLUSTERING,
284 .use_sg_chaining = ENABLE_SG_CHAINING,
285 .eh_abort_handler = nsp32_eh_abort, 284 .eh_abort_handler = nsp32_eh_abort,
286 .eh_bus_reset_handler = nsp32_eh_bus_reset, 285 .eh_bus_reset_handler = nsp32_eh_bus_reset,
287 .eh_host_reset_handler = nsp32_eh_host_reset, 286 .eh_host_reset_handler = nsp32_eh_host_reset,
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 969b9387a0c..3454a571474 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -692,7 +692,6 @@ static struct scsi_host_template sym53c500_driver_template = {
692 .sg_tablesize = 32, 692 .sg_tablesize = 32,
693 .cmd_per_lun = 1, 693 .cmd_per_lun = 1,
694 .use_clustering = ENABLE_CLUSTERING, 694 .use_clustering = ENABLE_CLUSTERING,
695 .use_sg_chaining = ENABLE_SG_CHAINING,
696 .shost_attrs = SYM53C500_shost_attrs 695 .shost_attrs = SYM53C500_shost_attrs
697}; 696};
698 697
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index c94906abfee..68c0d09ffe7 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -4204,7 +4204,6 @@ static struct scsi_host_template qla1280_driver_template = {
4204 .sg_tablesize = SG_ALL, 4204 .sg_tablesize = SG_ALL,
4205 .cmd_per_lun = 1, 4205 .cmd_per_lun = 1,
4206 .use_clustering = ENABLE_CLUSTERING, 4206 .use_clustering = ENABLE_CLUSTERING,
4207 .use_sg_chaining = ENABLE_SG_CHAINING,
4208}; 4207};
4209 4208
4210 4209
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index aba1e6d4806..3954ed2d7b5 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -131,7 +131,6 @@ static struct scsi_host_template qla2x00_driver_template = {
131 .this_id = -1, 131 .this_id = -1,
132 .cmd_per_lun = 3, 132 .cmd_per_lun = 3,
133 .use_clustering = ENABLE_CLUSTERING, 133 .use_clustering = ENABLE_CLUSTERING,
134 .use_sg_chaining = ENABLE_SG_CHAINING,
135 .sg_tablesize = SG_ALL, 134 .sg_tablesize = SG_ALL,
136 135
137 /* 136 /*
@@ -163,7 +162,6 @@ struct scsi_host_template qla24xx_driver_template = {
163 .this_id = -1, 162 .this_id = -1,
164 .cmd_per_lun = 3, 163 .cmd_per_lun = 3,
165 .use_clustering = ENABLE_CLUSTERING, 164 .use_clustering = ENABLE_CLUSTERING,
166 .use_sg_chaining = ENABLE_SG_CHAINING,
167 .sg_tablesize = SG_ALL, 165 .sg_tablesize = SG_ALL,
168 166
169 .max_sectors = 0xFFFF, 167 .max_sectors = 0xFFFF,
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index d3f86646cb0..2e2b9fedffc 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -94,7 +94,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
94 .this_id = -1, 94 .this_id = -1,
95 .cmd_per_lun = 3, 95 .cmd_per_lun = 3,
96 .use_clustering = ENABLE_CLUSTERING, 96 .use_clustering = ENABLE_CLUSTERING,
97 .use_sg_chaining = ENABLE_SG_CHAINING,
98 .sg_tablesize = SG_ALL, 97 .sg_tablesize = SG_ALL,
99 98
100 .max_sectors = 0xFFFF, 99 .max_sectors = 0xFFFF,
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
index 1769f965eed..1e874f1fb5c 100644
--- a/drivers/scsi/qlogicfas.c
+++ b/drivers/scsi/qlogicfas.c
@@ -197,7 +197,6 @@ static struct scsi_host_template qlogicfas_driver_template = {
197 .sg_tablesize = SG_ALL, 197 .sg_tablesize = SG_ALL,
198 .cmd_per_lun = 1, 198 .cmd_per_lun = 1,
199 .use_clustering = DISABLE_CLUSTERING, 199 .use_clustering = DISABLE_CLUSTERING,
200 .use_sg_chaining = ENABLE_SG_CHAINING,
201}; 200};
202 201
203static __init int qlogicfas_init(void) 202static __init int qlogicfas_init(void)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 4560713ecb1..e1c7eebfe90 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/bio.h> 10#include <linux/bio.h>
11#include <linux/bitops.h>
11#include <linux/blkdev.h> 12#include <linux/blkdev.h>
12#include <linux/completion.h> 13#include <linux/completion.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
@@ -34,13 +35,6 @@
34#define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools) 35#define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools)
35#define SG_MEMPOOL_SIZE 2 36#define SG_MEMPOOL_SIZE 2
36 37
37/*
38 * The maximum number of SG segments that we will put inside a scatterlist
39 * (unless chaining is used). Should ideally fit inside a single page, to
40 * avoid a higher order allocation.
41 */
42#define SCSI_MAX_SG_SEGMENTS 128
43
44struct scsi_host_sg_pool { 38struct scsi_host_sg_pool {
45 size_t size; 39 size_t size;
46 char *name; 40 char *name;
@@ -48,19 +42,26 @@ struct scsi_host_sg_pool {
48 mempool_t *pool; 42 mempool_t *pool;
49}; 43};
50 44
51#define SP(x) { x, "sgpool-" #x } 45#define SP(x) { x, "sgpool-" __stringify(x) }
46#if (SCSI_MAX_SG_SEGMENTS < 32)
47#error SCSI_MAX_SG_SEGMENTS is too small (must be 32 or greater)
48#endif
52static struct scsi_host_sg_pool scsi_sg_pools[] = { 49static struct scsi_host_sg_pool scsi_sg_pools[] = {
53 SP(8), 50 SP(8),
54 SP(16), 51 SP(16),
55#if (SCSI_MAX_SG_SEGMENTS > 16)
56 SP(32),
57#if (SCSI_MAX_SG_SEGMENTS > 32) 52#if (SCSI_MAX_SG_SEGMENTS > 32)
58 SP(64), 53 SP(32),
59#if (SCSI_MAX_SG_SEGMENTS > 64) 54#if (SCSI_MAX_SG_SEGMENTS > 64)
55 SP(64),
56#if (SCSI_MAX_SG_SEGMENTS > 128)
60 SP(128), 57 SP(128),
58#if (SCSI_MAX_SG_SEGMENTS > 256)
59#error SCSI_MAX_SG_SEGMENTS is too large (256 MAX)
61#endif 60#endif
62#endif 61#endif
63#endif 62#endif
63#endif
64 SP(SCSI_MAX_SG_SEGMENTS)
64}; 65};
65#undef SP 66#undef SP
66 67
@@ -692,42 +693,16 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,
692 return NULL; 693 return NULL;
693} 694}
694 695
695/*
696 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
697 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
698 */
699#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048
700
701static inline unsigned int scsi_sgtable_index(unsigned short nents) 696static inline unsigned int scsi_sgtable_index(unsigned short nents)
702{ 697{
703 unsigned int index; 698 unsigned int index;
704 699
705 switch (nents) { 700 BUG_ON(nents > SCSI_MAX_SG_SEGMENTS);
706 case 1 ... 8: 701
702 if (nents <= 8)
707 index = 0; 703 index = 0;
708 break; 704 else
709 case 9 ... 16: 705 index = get_count_order(nents) - 3;
710 index = 1;
711 break;
712#if (SCSI_MAX_SG_SEGMENTS > 16)
713 case 17 ... 32:
714 index = 2;
715 break;
716#if (SCSI_MAX_SG_SEGMENTS > 32)
717 case 33 ... 64:
718 index = 3;
719 break;
720#if (SCSI_MAX_SG_SEGMENTS > 64)
721 case 65 ... 128:
722 index = 4;
723 break;
724#endif
725#endif
726#endif
727 default:
728 printk(KERN_ERR "scsi: bad segment count=%d\n", nents);
729 BUG();
730 }
731 706
732 return index; 707 return index;
733} 708}
@@ -1603,20 +1578,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
1603 * this limit is imposed by hardware restrictions 1578 * this limit is imposed by hardware restrictions
1604 */ 1579 */
1605 blk_queue_max_hw_segments(q, shost->sg_tablesize); 1580 blk_queue_max_hw_segments(q, shost->sg_tablesize);
1606 1581 blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS);
1607 /*
1608 * In the future, sg chaining support will be mandatory and this
1609 * ifdef can then go away. Right now we don't have all archs
1610 * converted, so better keep it safe.
1611 */
1612#ifdef ARCH_HAS_SG_CHAIN
1613 if (shost->use_sg_chaining)
1614 blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS);
1615 else
1616 blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS);
1617#else
1618 blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS);
1619#endif
1620 1582
1621 blk_queue_max_sectors(q, shost->max_sectors); 1583 blk_queue_max_sectors(q, shost->max_sectors);
1622 blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); 1584 blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index e3fab3a6aed..72f6d801535 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1123,7 +1123,6 @@ static struct scsi_host_template driver_template = {
1123 .this_id = -1, 1123 .this_id = -1,
1124 .sg_tablesize = ST_MAX_SG, 1124 .sg_tablesize = ST_MAX_SG,
1125 .cmd_per_lun = ST_CMD_PER_LUN, 1125 .cmd_per_lun = ST_CMD_PER_LUN,
1126 .use_sg_chaining = ENABLE_SG_CHAINING,
1127}; 1126};
1128 1127
1129static int stex_set_dma_mask(struct pci_dev * pdev) 1128static int stex_set_dma_mask(struct pci_dev * pdev)
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index 1f6fd168033..6325901e509 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -840,6 +840,5 @@ static struct scsi_host_template driver_template = {
840 .cmd_per_lun = 1, 840 .cmd_per_lun = 1,
841 .unchecked_isa_dma = 1, 841 .unchecked_isa_dma = 1,
842 .use_clustering = ENABLE_CLUSTERING, 842 .use_clustering = ENABLE_CLUSTERING,
843 .use_sg_chaining = ENABLE_SG_CHAINING,
844}; 843};
845#include "scsi_module.c" 844#include "scsi_module.c"
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e939f381323..d39107b7669 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1681,7 +1681,6 @@ static struct scsi_host_template sym2_template = {
1681 .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, 1681 .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler,
1682 .this_id = 7, 1682 .this_id = 7,
1683 .use_clustering = ENABLE_CLUSTERING, 1683 .use_clustering = ENABLE_CLUSTERING,
1684 .use_sg_chaining = ENABLE_SG_CHAINING,
1685 .max_sectors = 0xFFFF, 1684 .max_sectors = 0xFFFF,
1686#ifdef SYM_LINUX_PROC_INFO_SUPPORT 1685#ifdef SYM_LINUX_PROC_INFO_SUPPORT
1687 .proc_info = sym53c8xx_proc_info, 1686 .proc_info = sym53c8xx_proc_info,
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 4bc5407f969..662c00451be 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -451,7 +451,6 @@ static struct scsi_host_template driver_template = {
451 .this_id = 7, 451 .this_id = 7,
452 .unchecked_isa_dma = 1, 452 .unchecked_isa_dma = 1,
453 .use_clustering = ENABLE_CLUSTERING, 453 .use_clustering = ENABLE_CLUSTERING,
454 .use_sg_chaining = ENABLE_SG_CHAINING,
455 }; 454 };
456 455
457#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) 456#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 75eca6b22db..f385dce8dfb 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -1204,6 +1204,5 @@ static struct scsi_host_template driver_template = {
1204 .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN, 1204 .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN,
1205 .unchecked_isa_dma = 1, 1205 .unchecked_isa_dma = 1,
1206 .use_clustering = ENABLE_CLUSTERING, 1206 .use_clustering = ENABLE_CLUSTERING,
1207 .use_sg_chaining = ENABLE_SG_CHAINING,
1208}; 1207};
1209#include "scsi_module.c" 1208#include "scsi_module.c"
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index b4304ae7852..c975c01b3a0 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1671,7 +1671,6 @@ static struct scsi_host_template driver_template = {
1671 .cmd_per_lun = 1, 1671 .cmd_per_lun = 1,
1672 .unchecked_isa_dma = 1, 1672 .unchecked_isa_dma = 1,
1673 .use_clustering = ENABLE_CLUSTERING, 1673 .use_clustering = ENABLE_CLUSTERING,
1674 .use_sg_chaining = ENABLE_SG_CHAINING,
1675}; 1674};
1676 1675
1677#include "scsi_module.c" 1676#include "scsi_module.c"