mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-20 15:04:19 +00:00
Minor max_transfer fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1741 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1363,16 +1363,18 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
|||||||
} else if ((0xB0 == cmd->cdb[2]) &&
|
} else if ((0xB0 == cmd->cdb[2]) &&
|
||||||
(virt_dev->dev->type == TYPE_DISK)) {
|
(virt_dev->dev->type == TYPE_DISK)) {
|
||||||
/* block limits */
|
/* block limits */
|
||||||
|
int max_transfer;
|
||||||
buf[1] = 0xB0;
|
buf[1] = 0xB0;
|
||||||
buf[3] = 0x1C;
|
buf[3] = 0x1C;
|
||||||
/* Optimal transfer granuality is PAGE_SIZE */
|
/* Optimal transfer granuality is PAGE_SIZE */
|
||||||
put_unaligned(cpu_to_be16(max_t(int,
|
put_unaligned(cpu_to_be16(max_t(int,
|
||||||
PAGE_SIZE/virt_dev->block_size, 1)),
|
PAGE_SIZE/virt_dev->block_size, 1)),
|
||||||
(uint16_t *)&buf[6]);
|
(uint16_t *)&buf[6]);
|
||||||
/* Max transfer len is min of sg limit and 8M */
|
/* Max transfer len is min of sg limit and 8M */
|
||||||
put_unaligned(cpu_to_be32(min_t(int,
|
max_transfer = min_t(int,
|
||||||
cmd->tgt_dev->max_sg_cnt << PAGE_SHIFT,
|
cmd->tgt_dev->max_sg_cnt << PAGE_SHIFT,
|
||||||
8*1024*1024) / virt_dev->block_size),
|
8*1024*1024) / virt_dev->block_size;
|
||||||
|
put_unaligned(cpu_to_be32(max_transfer),
|
||||||
(uint32_t *)&buf[8]);
|
(uint32_t *)&buf[8]);
|
||||||
/*
|
/*
|
||||||
* Let's have optimal transfer len 1MB. Better to not
|
* Let's have optimal transfer len 1MB. Better to not
|
||||||
@@ -1381,9 +1383,10 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
|||||||
* From other side, too big transfers are not optimal,
|
* From other side, too big transfers are not optimal,
|
||||||
* because SGV cache supports only <4M buffers.
|
* because SGV cache supports only <4M buffers.
|
||||||
*/
|
*/
|
||||||
put_unaligned(cpu_to_be32(
|
put_unaligned(cpu_to_be32(min_t(int,
|
||||||
1*1024*1024 / virt_dev->block_size),
|
max_transfer,
|
||||||
(uint32_t *)&buf[12]);
|
1*1024*1024 / virt_dev->block_size)),
|
||||||
|
(uint32_t *)&buf[12]);
|
||||||
resp_len = buf[3] + 4;
|
resp_len = buf[3] + 4;
|
||||||
} else {
|
} else {
|
||||||
TRACE_DBG("INQUIRY: Unsupported EVPD page %x",
|
TRACE_DBG("INQUIRY: Unsupported EVPD page %x",
|
||||||
|
|||||||
Reference in New Issue
Block a user