From 9226ba652c753921f4cefe3dbaabfd062780ee03 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 9 Jan 2013 01:42:10 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4727 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_targ.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index fc8b2851b..dd1cfc21b 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -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);