|
45 | 45 | */
|
46 | 46 | #define SCSI_INLINE_PROT_SG_CNT 1
|
47 | 47 |
|
| 48 | +#define SCSI_INLINE_SG_CNT 2 |
| 49 | + |
48 | 50 | static struct kmem_cache *scsi_sdb_cache;
|
49 | 51 | static struct kmem_cache *scsi_sense_cache;
|
50 | 52 | static struct kmem_cache *scsi_sense_isadma_cache;
|
@@ -547,7 +549,8 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
|
547 | 549 | static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd)
|
548 | 550 | {
|
549 | 551 | if (cmd->sdb.table.nents)
|
550 |
| - sg_free_table_chained(&cmd->sdb.table, SG_CHUNK_SIZE); |
| 552 | + sg_free_table_chained(&cmd->sdb.table, |
| 553 | + SCSI_INLINE_SG_CNT); |
551 | 554 | if (scsi_prot_sg_count(cmd))
|
552 | 555 | sg_free_table_chained(&cmd->prot_sdb->table,
|
553 | 556 | SCSI_INLINE_PROT_SG_CNT);
|
@@ -984,7 +987,7 @@ static blk_status_t scsi_init_sgtable(struct request *req,
|
984 | 987 | */
|
985 | 988 | if (unlikely(sg_alloc_table_chained(&sdb->table,
|
986 | 989 | blk_rq_nr_phys_segments(req), sdb->table.sgl,
|
987 |
| - SG_CHUNK_SIZE))) |
| 990 | + SCSI_INLINE_SG_CNT))) |
988 | 991 | return BLK_STS_RESOURCE;
|
989 | 992 |
|
990 | 993 | /*
|
@@ -1550,9 +1553,9 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
|
1550 | 1553 | }
|
1551 | 1554 |
|
1552 | 1555 | /* Size in bytes of the sg-list stored in the scsi-mq command-private data. */
|
1553 |
| -static unsigned int scsi_mq_sgl_size(struct Scsi_Host *shost) |
| 1556 | +static unsigned int scsi_mq_inline_sgl_size(struct Scsi_Host *shost) |
1554 | 1557 | {
|
1555 |
| - return min_t(unsigned int, shost->sg_tablesize, SG_CHUNK_SIZE) * |
| 1558 | + return min_t(unsigned int, shost->sg_tablesize, SCSI_INLINE_SG_CNT) * |
1556 | 1559 | sizeof(struct scatterlist);
|
1557 | 1560 | }
|
1558 | 1561 |
|
@@ -1734,7 +1737,7 @@ static int scsi_mq_init_request(struct blk_mq_tag_set *set, struct request *rq,
|
1734 | 1737 | if (scsi_host_get_prot(shost)) {
|
1735 | 1738 | sg = (void *)cmd + sizeof(struct scsi_cmnd) +
|
1736 | 1739 | shost->hostt->cmd_size;
|
1737 |
| - cmd->prot_sdb = (void *)sg + scsi_mq_sgl_size(shost); |
| 1740 | + cmd->prot_sdb = (void *)sg + scsi_mq_inline_sgl_size(shost); |
1738 | 1741 | }
|
1739 | 1742 |
|
1740 | 1743 | return 0;
|
@@ -1828,7 +1831,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
|
1828 | 1831 | {
|
1829 | 1832 | unsigned int cmd_size, sgl_size;
|
1830 | 1833 |
|
1831 |
| - sgl_size = scsi_mq_sgl_size(shost); |
| 1834 | + sgl_size = scsi_mq_inline_sgl_size(shost); |
1832 | 1835 | cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size;
|
1833 | 1836 | if (scsi_host_get_prot(shost))
|
1834 | 1837 | cmd_size += sizeof(struct scsi_data_buffer) +
|
|
0 commit comments