From: <vl...@us...> - 2007-12-10 12:09:12
|
Revision: 230 http://scst.svn.sourceforge.net/scst/?rev=230&view=rev Author: vlnb Date: 2007-12-10 04:09:07 -0800 (Mon, 10 Dec 2007) Log Message: ----------- Post r227 fixes and cleanups. Particulary, fixes brocken by it scst_user functionality and release/perf builds Modified Paths: -------------- trunk/scst/include/scsi_tgt.h trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_changer.c trunk/scst/src/dev_handlers/scst_dev_handler.h trunk/scst/src/dev_handlers/scst_disk.c trunk/scst/src/dev_handlers/scst_modisk.c trunk/scst/src/dev_handlers/scst_processor.c trunk/scst/src/dev_handlers/scst_raid.c trunk/scst/src/dev_handlers/scst_tape.c trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_targ.c trunk/usr/fileio/fileio.c Modified: trunk/scst/include/scsi_tgt.h =================================================================== --- trunk/scst/include/scsi_tgt.h 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/include/scsi_tgt.h 2007-12-10 12:09:07 UTC (rev 230) @@ -385,7 +385,6 @@ struct scst_device; struct scst_tgt_dev; struct scst_dev_type; -struct scst_info_cdb; struct scst_acg; struct scst_acg_dev; struct scst_acn; @@ -394,6 +393,15 @@ typedef enum dma_data_direction scst_data_direction; +enum scst_cdb_flags +{ + SCST_TRANSFER_LEN_TYPE_FIXED = 0x01, /* must be equviv 1 (FIXED_BIT in cdb) */ + SCST_SMALL_TIMEOUT = 0x02, + SCST_LONG_TIMEOUT = 0x04, + SCST_UNKNOWN_LENGTH = 0x08, + SCST_INFO_INVALID = 0x10, +}; + /* * Scsi_Target_Template: defines what functions a target driver will * have to provide in order to work with the target mid-level. @@ -688,7 +696,7 @@ * * MUST HAVE */ - int (*parse) (struct scst_cmd *cmd, struct scst_info_cdb *cdb_info); + int (*parse) (struct scst_cmd *cmd); /* * Called to execute CDB. Useful, for instance, to implement @@ -1120,6 +1128,9 @@ uint8_t cdb[SCST_MAX_CDB_SIZE]; int cdb_len; + enum scst_cdb_flags op_flags; + const char *op_name; + enum scst_cmd_queue_type queue_type; int timeout; /* CDB execution timeout */ @@ -1505,24 +1516,6 @@ uint8_t UA_sense_buffer[SCST_SENSE_BUFFERSIZE]; }; -enum scst_cdb_flags -{ - SCST_TRANSFER_LEN_TYPE_FIXED = 0x01, /* must be equviv 1 (FIXED_BIT in cdb) */ - SCST_SMALL_TIMEOUT = 0x02, - SCST_LONG_TIMEOUT = 0x04, - SCST_UNKNOWN_LENGTH = 0x08, - SCST_INFO_INVALID = 0x10, -}; - -struct scst_info_cdb -{ - enum scst_cdb_flags flags; - scst_data_direction direction; - unsigned int transfer_len; - unsigned short cdb_len; - const char *op_name; -}; - #ifndef smp_mb__after_set_bit /* There is no smp_mb__after_set_bit() in the kernel */ #define smp_mb__after_set_bit() smp_mb(); @@ -1785,11 +1778,12 @@ * Parameters: * cdb_p - pointer to CDB * dev_type - SCSI device type - * info_p - the result structure (output) + * op_flags, direction, transfer_len, cdb_len, op_name - the result (output) * Returns 0 on success, -1 otherwise */ int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type, - struct scst_info_cdb *info_p); + enum scst_cdb_flags *op_flags, scst_data_direction *direction, + unsigned int *transfer_len, int *cdb_len, const char **op_name); /* * Set error SCSI status in the command and prepares it for returning it @@ -2470,37 +2464,30 @@ /* Generic parse() for SBC (disk) devices */ int scst_sbc_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)); /* Generic parse() for MMC (cdrom) devices */ int scst_cdrom_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)); /* Generic parse() for MO disk devices */ int scst_modisk_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)); /* Generic parse() for tape devices */ int scst_tape_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_size)(struct scst_cmd *cmd)); /* Generic parse() for changer devices */ int scst_changer_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)); /* Generic parse() for "processor" devices */ int scst_processor_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)); /* Generic parse() for RAID devices */ int scst_raid_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)); /** Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2007-12-10 12:09:07 UTC (rev 230) @@ -51,7 +51,7 @@ int cdrom_attach(struct scst_device *); void cdrom_detach(struct scst_device *); -int cdrom_parse(struct scst_cmd *, struct scst_info_cdb *); +int cdrom_parse(struct scst_cmd *); int cdrom_done(struct scst_cmd *); static struct scst_dev_type cdrom_devtype = CDROM_TYPE; @@ -205,21 +205,21 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int cdrom_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int cdrom_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_cdrom_generic_parse(cmd, info_cdb, cdrom_get_block_shift); + scst_cdrom_generic_parse(cmd, cdrom_get_block_shift); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_SMALL_TIMEOUT) { + if ((cmd->op_flags & (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT)) == 0) + cmd->timeout = CDROM_REG_TIMEOUT; + else if (cmd->op_flags & SCST_SMALL_TIMEOUT) cmd->timeout = CDROM_SMALL_TIMEOUT; - } else if (info_cdb->flags & SCST_LONG_TIMEOUT) { + else if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = CDROM_LONG_TIMEOUT; - } else { - cmd->timeout = CDROM_REG_TIMEOUT; - } + return res; } Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_changer.c 2007-12-10 12:09:07 UTC (rev 230) @@ -44,7 +44,7 @@ int changer_attach(struct scst_device *); void changer_detach(struct scst_device *); -int changer_parse(struct scst_cmd *, struct scst_info_cdb *); +int changer_parse(struct scst_cmd *); int changer_done(struct scst_cmd *); static struct scst_dev_type changer_devtype = CHANGER_TYPE; @@ -126,15 +126,15 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int changer_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int changer_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_changer_generic_parse(cmd, info_cdb, 0); + scst_changer_generic_parse(cmd, 0); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) { cmd->timeout = CHANGER_LONG_TIMEOUT; } else { cmd->timeout = CHANGER_TIMEOUT; Modified: trunk/scst/src/dev_handlers/scst_dev_handler.h =================================================================== --- trunk/scst/src/dev_handlers/scst_dev_handler.h 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_dev_handler.h 2007-12-10 12:09:07 UTC (rev 230) @@ -8,6 +8,7 @@ #include "scst_debug.h" #define SCST_DEV_UA_RETRIES 5 +#define SCST_PASSTHROUGH_RETRIES 0 #if defined(DEBUG) || defined(TRACING) @@ -29,8 +30,6 @@ #define trace_log_tbl NULL #endif -#define SCST_PASSTHROUGH_RETRIES 0 - static struct scst_proc_data dev_handler_log_proc_data; static int dev_handler_log_info_show(struct seq_file *seq, void *v) Modified: trunk/scst/src/dev_handlers/scst_disk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_disk.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_disk.c 2007-12-10 12:09:07 UTC (rev 230) @@ -70,7 +70,7 @@ int disk_attach(struct scst_device *dev); void disk_detach(struct scst_device *dev); -int disk_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cmd); +int disk_parse(struct scst_cmd *cmd); int disk_done(struct scst_cmd *cmd); int disk_exec(struct scst_cmd *cmd); @@ -277,21 +277,20 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int disk_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int disk_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_sbc_generic_parse(cmd, info_cdb, disk_get_block_shift); + scst_sbc_generic_parse(cmd, disk_get_block_shift); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_SMALL_TIMEOUT) { + if ((cmd->op_flags & (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT)) == 0) + cmd->timeout = DISK_REG_TIMEOUT; + else if (cmd->op_flags & SCST_SMALL_TIMEOUT) cmd->timeout = DISK_SMALL_TIMEOUT; - } else if (info_cdb->flags & SCST_LONG_TIMEOUT) { + else if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = DISK_LONG_TIMEOUT; - } else { - cmd->timeout = DISK_REG_TIMEOUT; - } return res; } Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2007-12-10 12:09:07 UTC (rev 230) @@ -70,7 +70,7 @@ int modisk_attach(struct scst_device *); void modisk_detach(struct scst_device *); -int modisk_parse(struct scst_cmd *, struct scst_info_cdb *); +int modisk_parse(struct scst_cmd *); int modisk_done(struct scst_cmd *); int modisk_exec(struct scst_cmd *); @@ -292,21 +292,21 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int modisk_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int modisk_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_modisk_generic_parse(cmd, info_cdb, modisk_get_block_shift); + scst_modisk_generic_parse(cmd, modisk_get_block_shift); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_SMALL_TIMEOUT) { + if ((cmd->op_flags & (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT)) == 0) + cmd->timeout = MODISK_REG_TIMEOUT; + else if (cmd->op_flags & SCST_SMALL_TIMEOUT) cmd->timeout = MODISK_SMALL_TIMEOUT; - } else if (info_cdb->flags & SCST_LONG_TIMEOUT) { + else if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = MODISK_LONG_TIMEOUT; - } else { - cmd->timeout = MODISK_REG_TIMEOUT; - } + return res; } Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_processor.c 2007-12-10 12:09:07 UTC (rev 230) @@ -44,7 +44,7 @@ int processor_attach(struct scst_device *); void processor_detach(struct scst_device *); -int processor_parse(struct scst_cmd *, struct scst_info_cdb *); +int processor_parse(struct scst_cmd *); int processor_done(struct scst_cmd *); static struct scst_dev_type processor_devtype = PROCESSOR_TYPE; @@ -126,15 +126,15 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int processor_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int processor_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_processor_generic_parse(cmd, info_cdb, 0); + scst_processor_generic_parse(cmd, 0); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) { cmd->timeout = PROCESSOR_LONG_TIMEOUT; } else { cmd->timeout = PROCESSOR_TIMEOUT; Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_raid.c 2007-12-10 12:09:07 UTC (rev 230) @@ -44,7 +44,7 @@ int raid_attach(struct scst_device *); void raid_detach(struct scst_device *); -int raid_parse(struct scst_cmd *, struct scst_info_cdb *); +int raid_parse(struct scst_cmd *); int raid_done(struct scst_cmd *); static struct scst_dev_type raid_devtype = RAID_TYPE; @@ -126,15 +126,15 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int raid_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int raid_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_raid_generic_parse(cmd, info_cdb, 0); + scst_raid_generic_parse(cmd, 0); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_LONG_TIMEOUT) { + if (cmd->op_flags & SCST_LONG_TIMEOUT) { cmd->timeout = RAID_LONG_TIMEOUT; } else { cmd->timeout = RAID_TIMEOUT; Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_tape.c 2007-12-10 12:09:07 UTC (rev 230) @@ -75,7 +75,7 @@ int tape_attach(struct scst_device *); void tape_detach(struct scst_device *); -int tape_parse(struct scst_cmd *, struct scst_info_cdb *); +int tape_parse(struct scst_cmd *); int tape_done(struct scst_cmd *); int tape_exec(struct scst_cmd *); @@ -280,21 +280,21 @@ * * Note: Not all states are allowed on return ********************************************************************/ -int tape_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +int tape_parse(struct scst_cmd *cmd) { int res = SCST_CMD_STATE_DEFAULT; - scst_tape_generic_parse(cmd, info_cdb, tape_get_block_size); + scst_tape_generic_parse(cmd, tape_get_block_size); cmd->retries = SCST_PASSTHROUGH_RETRIES; - if (info_cdb->flags & SCST_SMALL_TIMEOUT) { + if ((cmd->op_flags & (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT)) == 0) + cmd->timeout = TAPE_REG_TIMEOUT; + else if (cmd->op_flags & SCST_SMALL_TIMEOUT) cmd->timeout = TAPE_SMALL_TIMEOUT; - } else if (info_cdb->flags & SCST_LONG_TIMEOUT) { + else if (cmd->op_flags & SCST_LONG_TIMEOUT) cmd->timeout = TAPE_LONG_TIMEOUT; - } else { - cmd->timeout = TAPE_REG_TIMEOUT; - } + return res; } Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_user.c 2007-12-10 12:09:07 UTC (rev 230) @@ -67,7 +67,7 @@ unsigned short detach_cmd_count; - int (*generic_parse)(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb, + int (*generic_parse)(struct scst_cmd *cmd, int (*get_block)(struct scst_cmd *cmd)); int block; @@ -154,7 +154,7 @@ int gfp_mask); static void dev_user_free_ucmd(struct scst_user_cmd *ucmd); -static int dev_user_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb); +static int dev_user_parse(struct scst_cmd *cmd); static int dev_user_exec(struct scst_cmd *cmd); static void dev_user_on_free_cmd(struct scst_cmd *cmd); static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, @@ -648,7 +648,7 @@ return dev->block; } -static int dev_user_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +static int dev_user_parse(struct scst_cmd *cmd) { int rc, res = SCST_CMD_STATE_DEFAULT; struct scst_user_cmd *ucmd; @@ -684,15 +684,15 @@ switch(dev->parse_type) { case SCST_USER_PARSE_STANDARD: TRACE_DBG("PARSE STANDARD: ucmd %p", ucmd); - rc = dev->generic_parse(cmd, info_cdb, dev_user_get_block); - if ((rc != 0) || (info_cdb->flags & SCST_INFO_INVALID)) + rc = dev->generic_parse(cmd, dev_user_get_block); + if ((rc != 0) || (cmd->op_flags & SCST_INFO_INVALID)) goto out_invalid; break; case SCST_USER_PARSE_EXCEPTION: TRACE_DBG("PARSE EXCEPTION: ucmd %p", ucmd); - rc = dev->generic_parse(cmd, info_cdb, dev_user_get_block); - if ((rc == 0) && (!(info_cdb->flags & SCST_INFO_INVALID))) + rc = dev->generic_parse(cmd, dev_user_get_block); + if ((rc == 0) && (!(cmd->op_flags & SCST_INFO_INVALID))) break; else if (rc == SCST_CMD_STATE_NEED_THREAD_CTX) { TRACE_MEM("Restarting PARSE to thread context " @@ -742,7 +742,7 @@ out_invalid: PRINT_ERROR("PARSE failed (ucmd %p, rc %d, invalid %d)", ucmd, rc, - info_cdb->flags & SCST_INFO_INVALID); + cmd->op_flags & SCST_INFO_INVALID); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); out_error: @@ -2854,7 +2854,7 @@ return res; } -static int dev_usr_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +static int dev_usr_parse(struct scst_cmd *cmd) { sBUG(); return SCST_CMD_STATE_DEFAULT; Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2007-12-10 12:09:07 UTC (rev 230) @@ -219,9 +219,9 @@ static void vdisk_detach(struct scst_device *dev); static int vdisk_attach_tgt(struct scst_tgt_dev *tgt_dev); static void vdisk_detach_tgt(struct scst_tgt_dev *tgt_dev); -static int vdisk_parse(struct scst_cmd *, struct scst_info_cdb *info_cdb); +static int vdisk_parse(struct scst_cmd *); static int vdisk_do_job(struct scst_cmd *cmd); -static int vcdrom_parse(struct scst_cmd *, struct scst_info_cdb *info_cdb); +static int vcdrom_parse(struct scst_cmd *); static int vcdrom_exec(struct scst_cmd *cmd); static void vdisk_exec_read(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, loff_t loff); @@ -971,10 +971,9 @@ * * Note: Not all states are allowed on return ********************************************************************/ -static int vdisk_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb) +static int vdisk_parse(struct scst_cmd *cmd) { - scst_sbc_generic_parse(cmd, info_cdb, vdisk_get_block_shift); + scst_sbc_generic_parse(cmd, vdisk_get_block_shift); return SCST_CMD_STATE_DEFAULT; } @@ -989,10 +988,9 @@ * * Note: Not all states are allowed on return ********************************************************************/ -static int vcdrom_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb) +static int vcdrom_parse(struct scst_cmd *cmd) { - scst_cdrom_generic_parse(cmd, info_cdb, vdisk_get_block_shift); + scst_cdrom_generic_parse(cmd, vdisk_get_block_shift); return SCST_CMD_STATE_DEFAULT; } Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/scst_lib.c 2007-12-10 12:09:07 UTC (rev 230) @@ -1681,7 +1681,8 @@ } int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type, - struct scst_info_cdb *info_p) + enum scst_cdb_flags *op_flags, scst_data_direction *direction, + unsigned int *transfer_len, int *cdb_len, const char **op_name) { int i, res = 0; uint8_t op; @@ -1725,24 +1726,23 @@ TRACE(TRACE_SCSI, "Unknown opcode 0x%x for type %d", op, dev_type); res = -1; - memset(info_p, 0, sizeof(*info_p)); - info_p->flags = SCST_INFO_INVALID; + *op_flags = SCST_INFO_INVALID; goto out; } - info_p->cdb_len = SCST_GET_CDB_LEN(op); - info_p->op_name = ptr->op_name; - info_p->direction = ptr->direction; - info_p->flags = ptr->flags; - info_p->transfer_len = (*ptr->get_trans_len)(cdb_p, ptr->off); + *cdb_len = SCST_GET_CDB_LEN(op); + *op_name = ptr->op_name; + *direction = ptr->direction; + *op_flags = ptr->flags; + *transfer_len = (*ptr->get_trans_len)(cdb_p, ptr->off); #ifdef EXTRACHECKS - if (unlikely((info_p->transfer_len == 0) && - (info_p->direction != SCST_DATA_NONE) && - ((info_p->flags & SCST_UNKNOWN_LENGTH) == 0))) { + if (unlikely((*transfer_len == 0) && + (*direction != SCST_DATA_NONE) && + ((*op_flags & SCST_UNKNOWN_LENGTH) == 0))) { PRINT_ERROR("transfer_len 0, direction %d, flags %x, changing " - "direction on NONE", info_p->direction, info_p->flags); - info_p->direction = SCST_DATA_NONE; + "direction on NONE", *direction, *op_flags); + *direction = SCST_DATA_NONE; } #endif @@ -1871,7 +1871,6 @@ } int scst_sbc_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)) { int res = 0; @@ -1879,13 +1878,12 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->data_direction and cmd->bufflen - * based on info_cdb, therefore change them only if necessary + * SCST sets good defaults for cmd->data_direction and cmd->bufflen, + * therefore change them only if necessary */ TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d", - info_cdb->op_name, - info_cdb->direction, info_cdb->flags, info_cdb->transfer_len); + cmd->op_name, cmd->data_direction, cmd->op_flags, cmd->bufflen); switch (cmd->cdb[0]) { case SERVICE_ACTION_IN: @@ -1899,11 +1897,10 @@ case VERIFY_12: case VERIFY_16: if ((cmd->cdb[1] & BYTCHK) == 0) { - cmd->data_len = - info_cdb->transfer_len << get_block_shift(cmd); + cmd->data_len = cmd->bufflen << get_block_shift(cmd); cmd->bufflen = 0; cmd->data_direction = SCST_DATA_NONE; - info_cdb->flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; + cmd->op_flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; } else cmd->data_len = 0; break; @@ -1912,12 +1909,12 @@ break; } - if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED) { + if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED) { /* * No need for locks here, since *_detach() can not be * called, when there are existing commands. */ - cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd); + cmd->bufflen = cmd->bufflen << get_block_shift(cmd); } TRACE_DBG("res %d, bufflen %d, data_len %d, direct %d", @@ -1928,7 +1925,6 @@ } int scst_cdrom_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)) { int res = 0; @@ -1936,15 +1932,12 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->data_direction and cmd->bufflen - * based on info_cdb, therefore change them only if necessary + * SCST sets good defaults for cmd->data_direction and cmd->bufflen, + * therefore change them only if necessary */ - TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d lun %Ld(%d)", - info_cdb->op_name, - info_cdb->direction, - info_cdb->flags, - info_cdb->transfer_len, cmd->lun, (cmd->cdb[1] >> 5) & 7); + TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d", + cmd->op_name, cmd->data_direction, cmd->op_flags, cmd->bufflen); cmd->cdb[1] &= 0x1f; @@ -1954,11 +1947,10 @@ case VERIFY_12: case VERIFY_16: if ((cmd->cdb[1] & BYTCHK) == 0) { - cmd->data_len = - info_cdb->transfer_len << get_block_shift(cmd); + cmd->data_len = cmd->bufflen << get_block_shift(cmd); cmd->bufflen = 0; cmd->data_direction = SCST_DATA_NONE; - info_cdb->flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; + cmd->op_flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; } break; default: @@ -1966,8 +1958,8 @@ break; } - if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED) - cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd); + if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED) + cmd->bufflen = cmd->bufflen << get_block_shift(cmd); TRACE_DBG("res %d bufflen %d direct %d", res, cmd->bufflen, cmd->data_direction); @@ -1977,7 +1969,6 @@ } int scst_modisk_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_shift)(struct scst_cmd *cmd)) { int res = 0; @@ -1985,15 +1976,12 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->data_direction and cmd->bufflen - * based on info_cdb, therefore change them only if necessary + * SCST sets good defaults for cmd->data_direction and cmd->bufflen, + * therefore change them only if necessary */ - TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d lun %Ld(%d)", - info_cdb->op_name, - info_cdb->direction, - info_cdb->flags, - info_cdb->transfer_len, cmd->lun, (cmd->cdb[1] >> 5) & 7); + TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d", + cmd->op_name, cmd->data_direction, cmd->op_flags, cmd->bufflen); cmd->cdb[1] &= 0x1f; @@ -2003,11 +1991,10 @@ case VERIFY_12: case VERIFY_16: if ((cmd->cdb[1] & BYTCHK) == 0) { - cmd->data_len = - info_cdb->transfer_len << get_block_shift(cmd); + cmd->data_len = cmd->bufflen << get_block_shift(cmd); cmd->bufflen = 0; cmd->data_direction = SCST_DATA_NONE; - info_cdb->flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; + cmd->op_flags &= ~SCST_TRANSFER_LEN_TYPE_FIXED; } break; default: @@ -2015,8 +2002,8 @@ break; } - if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED) - cmd->bufflen = info_cdb->transfer_len << get_block_shift(cmd); + if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED) + cmd->bufflen = cmd->bufflen << get_block_shift(cmd); TRACE_DBG("res %d bufflen %d direct %d", res, cmd->bufflen, cmd->data_direction); @@ -2026,7 +2013,6 @@ } int scst_tape_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*get_block_size)(struct scst_cmd *cmd)) { int res = 0; @@ -2034,13 +2020,12 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->data_direction and cmd->bufflen - * based on info_cdb, therefore change them only if necessary + * SCST sets good defaults for cmd->data_direction and cmd->bufflen, + * therefore change them only if necessary */ TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d", - info_cdb->op_name, - info_cdb->direction, info_cdb->flags, info_cdb->transfer_len); + cmd->op_name, cmd->data_direction, cmd->op_flags, cmd->bufflen); if (cmd->cdb[0] == READ_POSITION) { int tclp = cmd->cdb[1] & TCLP_BIT; @@ -2057,27 +2042,26 @@ } } - if (info_cdb->flags & SCST_TRANSFER_LEN_TYPE_FIXED & cmd->cdb[1]) - cmd->bufflen = info_cdb->transfer_len * get_block_size(cmd); + if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED & cmd->cdb[1]) + cmd->bufflen = cmd->bufflen * get_block_size(cmd); TRACE_EXIT_RES(res); return res; } -static int scst_null_parse(struct scst_cmd *cmd, struct scst_info_cdb *info_cdb) +static int scst_null_parse(struct scst_cmd *cmd) { int res = 0; TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->data_direction and cmd->bufflen - * based on info_cdb, therefore change them only if necessary + * SCST sets good defaults for cmd->data_direction and cmd->bufflen, + * therefore change them only if necessary */ TRACE_DBG("op_name <%s> direct %d flags %d transfer_len %d", - info_cdb->op_name, - info_cdb->direction, info_cdb->flags, info_cdb->transfer_len); + cmd->op_name, cmd->data_direction, cmd->op_flags, cmd->bufflen); #if 0 switch (cmd->cdb[0]) { default: @@ -2093,24 +2077,21 @@ } int scst_changer_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)) { - return scst_null_parse(cmd, info_cdb); + return scst_null_parse(cmd); } int scst_processor_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)) { - return scst_null_parse(cmd, info_cdb); + return scst_null_parse(cmd); } int scst_raid_generic_parse(struct scst_cmd *cmd, - struct scst_info_cdb *info_cdb, int (*nothing)(struct scst_cmd *cmd)) { - return scst_null_parse(cmd, info_cdb); + return scst_null_parse(cmd); } int scst_block_generic_dev_done(struct scst_cmd *cmd, @@ -3020,7 +3001,12 @@ if (cmd->dev->tas) { scst_set_cmd_error_status(cmd, SAM_STAT_TASK_ABORTED); } else { - /* Abort without delivery or notification */ + /* + * Abort without delivery or notification. + * There is no need to check/requeue possible UA, + * because, if it exists, it will be delivered + * by the "completed" branch. + */ clear_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags); } Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/scst_main.c 2007-12-10 12:09:07 UTC (rev 230) @@ -135,7 +135,7 @@ module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, long, 0); MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by " - "the SCST commands at any given time in Mb"); + "the SCST commands at any given time in MB"); struct scst_dev_type scst_null_devtype = { @@ -1768,7 +1768,7 @@ module_init(init_scst); module_exit(exit_scst); -MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); +MODULE_AUTHOR("Vladislav Bolkhovitin"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI target core"); MODULE_VERSION(SCST_VERSION_STRING); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/scst/src/scst_targ.c 2007-12-10 12:09:07 UTC (rev 230) @@ -284,7 +284,6 @@ { int res = SCST_CMD_STATE_RES_CONT_SAME; struct scst_device *dev = cmd->dev; - struct scst_info_cdb cdb_info; TRACE_ENTRY(); @@ -300,7 +299,8 @@ */ if (unlikely(scst_get_cdb_info(cmd->cdb, dev->handler->type, - &cdb_info) != 0)) { + &cmd->op_flags, &cmd->data_direction, + &cmd->bufflen, &cmd->cdb_len, &cmd->op_name) != 0)) { PRINT_ERROR("Unknown opcode 0x%02x for %s. " "Should you update scst_scsi_op_table?", cmd->cdb[0], dev->handler->name); @@ -339,15 +339,12 @@ } else { TRACE(TRACE_SCSI, "op_name <%s>, direction=%d (expected %d, " "set %s), transfer_len=%d (expected len %d), flags=%d", - cdb_info.op_name, cdb_info.direction, + cmd->op_name, cmd->data_direction, cmd->expected_data_direction, scst_cmd_is_expected_set(cmd) ? "yes" : "no", - cdb_info.transfer_len, cmd->expected_transfer_len, - cdb_info.flags); + cmd->bufflen, cmd->expected_transfer_len, cmd->op_flags); - cmd->data_direction = cdb_info.direction; - - if (unlikely((cdb_info.flags & SCST_UNKNOWN_LENGTH) != 0)) { + if (unlikely((cmd->op_flags & SCST_UNKNOWN_LENGTH) != 0)) { if (scst_cmd_is_expected_set(cmd)) { /* * Command data length can't be easily @@ -360,11 +357,7 @@ 15*1024*1024); } else cmd->bufflen = 0; - } else - cmd->bufflen = cdb_info.transfer_len; - - /* Restore (likely) lost CDB length */ - cmd->cdb_len = cdb_info.cdb_len; + } } if (unlikely(cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_NACA_BIT)) { @@ -400,9 +393,9 @@ int res = SCST_CMD_STATE_RES_CONT_SAME; int state; struct scst_device *dev = cmd->dev; - struct scst_info_cdb cdb_info; int atomic = scst_cmd_atomic(cmd); - int orig_bufflen; + int orig_bufflen = cmd->bufflen; + scst_data_direction orig_data_direction = cmd->data_direction; TRACE_ENTRY(); @@ -414,13 +407,11 @@ goto out; } - orig_bufflen = cmd->bufflen; - if (likely(!scst_is_cmd_local(cmd))) { TRACE_DBG("Calling dev handler %s parse(%p)", dev->handler->name, cmd); TRACE_BUFF_FLAG(TRACE_SEND_BOT, "Parsing: ", cmd->cdb, cmd->cdb_len); - state = dev->handler->parse(cmd, &cdb_info); + state = dev->handler->parse(cmd); /* Caution: cmd can be already dead here */ TRACE_DBG("Dev handler %s parse() returned %d", dev->handler->name, state); @@ -485,12 +476,12 @@ cmd->data_direction = cmd->expected_data_direction; cmd->bufflen = cmd->expected_transfer_len; #else - if (unlikely(cmd->data_direction != cdb_info.direction)) { + if (unlikely(cmd->data_direction != orig_data_direction)) { PRINT_ERROR("Expected data direction %d for opcode " "0x%02x (handler %s, target %s) doesn't match " "decoded value %d", cmd->data_direction, cmd->cdb[0], dev->handler->name, - cmd->tgtt->name, cdb_info.direction); + cmd->tgtt->name, orig_data_direction); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_message)); goto out_dev_done; Modified: trunk/usr/fileio/fileio.c =================================================================== --- trunk/usr/fileio/fileio.c 2007-12-10 11:53:05 UTC (rev 229) +++ trunk/usr/fileio/fileio.c 2007-12-10 12:09:07 UTC (rev 230) @@ -53,7 +53,7 @@ #else /* DEBUG */ # ifdef TRACING -#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_MGMT \ +#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_MGMT | \ TRACE_TIME | TRACE_SPECIAL) # else #define DEFAULT_LOG_FLAGS 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |