scst, SCSI pass-through: Do not complain unnecessarily about max_hw_sectors

cmd->bufflen is in bytes so it has to be divided by the sector size before
being compared with queue_max_hw_sectors(). Other changes included in this
patch:
* Print the "rc" error code as a signed integer instead of as an unsigned
  hex number.
* Change "(int)rc" into "rc". The cast isn't necessary because rc has type
  int.
* Insert a "0x" prefix in front of the SCSI CDB opcode.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4727 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2013-01-09 01:42:10 +00:00
parent ae6485796d
commit 9226ba652c

View File

@@ -2612,11 +2612,12 @@ static int scst_do_real_exec(struct scst_cmd *cmd)
rc = scst_scsi_exec_async(cmd, cmd, scst_pass_through_cmd_done);
#endif
if (unlikely(rc != 0)) {
PRINT_ERROR("scst pass-through exec failed: %x", rc);
if (((int)rc == -EINVAL) &&
(cmd->bufflen > queue_max_hw_sectors(scsi_dev->request_queue)))
PRINT_ERROR("scst pass-through exec failed: %d", rc);
/* "Sectors" are hardcoded as 512 bytes in the kernel */
if (rc == -EINVAL &&
(cmd->bufflen >> 9) > queue_max_hw_sectors(scsi_dev->request_queue))
PRINT_ERROR("Too low max_hw_sectors %d sectors on %s "
"to serve command %x with bufflen %db."
"to serve command %#x with bufflen %d bytes."
"See README for more details.",
queue_max_hw_sectors(scsi_dev->request_queue),
dev->virt_name, cmd->cdb[0], cmd->bufflen);