From: <vl...@us...> - 2008-10-30 20:17:53
|
Revision: 555 http://scst.svn.sourceforge.net/scst/?rev=555&view=rev Author: vlnb Date: 2008-10-30 20:17:42 +0000 (Thu, 30 Oct 2008) Log Message: ----------- The patch below fixes the following: * Lots of checkpatch warnings about lines over 80 characters. * Checkpatch errors about code indent should use tabs where possible (same issues as reported by Dotan Barak). * One checkpatch warning about braces {} are not necessary for single statement blocks. * Sparse warnings about missing declarations. * Sparse warnings about using 0 instead of NULL. This patch has been verified by reviewing it carefully and by verifying the output files of the command scripts/run-regression-tests -k 2.6.27.3. Signed-off-by: Bart Van Assche <bar...@gm...> With changes Modified Paths: -------------- trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_debug.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_mem.h trunk/scst/src/scst_priv.h trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_cdbprobe.h 2008-10-30 20:17:42 UTC (rev 555) @@ -82,7 +82,8 @@ */ uint8_t flags; /* opcode -- various flags */ uint8_t off; /* length offset in cdb */ - int (*get_trans_len)(struct scst_cmd *cmd, uint8_t off) __attribute__ ((aligned)); + int (*get_trans_len)(struct scst_cmd *cmd, uint8_t off) + __attribute__ ((aligned)); } __attribute__((packed)); static int scst_scsi_op_list[256]; @@ -120,7 +121,8 @@ {0x03, "MMMMMMMMMMMMMMMM", "REQUEST SENSE", SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1}, {0x04, "M O O ", "FORMAT UNIT", - SCST_DATA_WRITE, SCST_LONG_TIMEOUT|SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, + SCST_DATA_WRITE, SCST_LONG_TIMEOUT|SCST_UNKNOWN_LENGTH, + 0, get_trans_len_none}, {0x04, " O ", "FORMAT", SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x05, "VMVVVV V ", "READ BLOCK LIMITS", @@ -175,7 +177,7 @@ SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1}, {0x13, "VOVVVV ", "VERIFY(6)", SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED| - SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, + SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, 2, get_trans_len_3}, {0x14, "VOOVVV ", "RECOVER BUFFERED DATA", SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, @@ -253,7 +255,7 @@ SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2}, {0x2F, "O OO O ", "VERIFY(10)", SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED| - SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, + SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, 7, get_trans_len_2}, {0x33, "O OO O ", "SET LIMITS(10)", SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, @@ -280,7 +282,8 @@ {0x3C, "OOOOOOOOOOOOOOOO", "READ BUFFER", SCST_DATA_READ, SCST_SMALL_TIMEOUT, 6, get_trans_len_3}, {0x3D, " O O ", "UPDATE BLOCK", - SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, + 0, get_trans_len_single}, {0x3E, "O OO O ", "READ LONG", SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x3F, "O O O ", "WRITE LONG", @@ -288,7 +291,8 @@ {0x40, "OOOOOOOOOO ", "CHANGE DEFINITION", SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 8, get_trans_len_1}, {0x41, "O O ", "WRITE SAME", - SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, + 0, get_trans_len_single}, {0x42, " O ", "READ SUB-CHANNEL", SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x43, " O ", "READ TOC/PMA/ATIP", @@ -383,7 +387,7 @@ SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x8F, "O OO O ", "VERIFY(16)", SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED| - SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, + SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, 10, get_trans_len_4}, {0x90, "O OO O ", "PRE-FETCH(16)", SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, @@ -449,7 +453,7 @@ SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4}, {0xAF, "O OO O ", "VERIFY(12)", SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED| - SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, + SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED, 6, get_trans_len_4}, /* No need to support at all. {0xB0, " OO O ", "SEARCH DATA HIGH(12)", @@ -509,6 +513,7 @@ #define WRITE_LONG_2 0xea */ -#define SCST_CDB_TBL_SIZE ((int)(sizeof(scst_scsi_op_table)/sizeof(struct scst_sdbops))) +#define SCST_CDB_TBL_SIZE \ + ((int)(sizeof(scst_scsi_op_table)/sizeof(struct scst_sdbops))) #endif /* __SCST_CDBPROBE_H */ Modified: trunk/scst/src/scst_debug.c =================================================================== --- trunk/scst/src/scst_debug.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_debug.c 2008-10-30 20:17:42 UTC (rev 555) @@ -58,7 +58,8 @@ i += snprintf(&trace_buf[i], TRACE_BUF_SIZE, "[%d]: ", get_current_tid()); if (prefix != NULL) - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", prefix); + i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", + prefix); if (trace_flag & TRACE_FUNCTION) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s:", func); if (trace_flag & TRACE_LINE) Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_lib.c 2008-10-30 20:17:42 UTC (rev 555) @@ -342,7 +342,7 @@ } EXPORT_SYMBOL(scst_init_mem_lim); -struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, +static struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, struct scst_device *dev, uint64_t lun) { struct scst_acg_dev *res; @@ -355,7 +355,8 @@ res = kmem_cache_zalloc(scst_acgd_cachep, GFP_KERNEL); #endif if (res == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_acg_dev failed"); + TRACE(TRACE_OUT_OF_MEM, + "%s", "Allocation of scst_acg_dev failed"); goto out; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) @@ -372,7 +373,7 @@ } /* The activity supposed to be suspended and scst_mutex held */ -void scst_free_acg_dev(struct scst_acg_dev *acg_dev) +static void scst_free_acg_dev(struct scst_acg_dev *acg_dev) { TRACE_ENTRY(); @@ -459,7 +460,10 @@ return res; } -/* scst_mutex supposed to be held, there must not be parallel activity in this sess */ +/* + * scst_mutex supposed to be held, there must not be parallel activity in this + * session. + */ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess, struct scst_acg_dev *acg_dev) { @@ -510,9 +514,8 @@ !sess->tgt->tgtt->no_clustering) scst_sgv_pool_use_norm_clust(tgt_dev); - if (sess->tgt->tgtt->unchecked_isa_dma || ini_unchecked_isa_dma) { + if (sess->tgt->tgtt->unchecked_isa_dma || ini_unchecked_isa_dma) scst_sgv_pool_use_dma(tgt_dev); - } if (dev->scsi_dev != NULL) { TRACE_MGMT_DBG("host=%d, channel=%d, id=%d, lun=%d, " @@ -601,7 +604,8 @@ sess_tgt_dev_list_head = &sess->sess_tgt_dev_list_hash[HASH_VAL(tgt_dev->lun)]; - list_add_tail(&tgt_dev->sess_tgt_dev_list_entry, sess_tgt_dev_list_head); + list_add_tail(&tgt_dev->sess_tgt_dev_list_entry, + sess_tgt_dev_list_head); out: TRACE_EXIT(); @@ -645,7 +649,10 @@ return; } -/* scst_mutex supposed to be held, there must not be parallel activity in this sess */ +/* + * scst_mutex supposed to be held, there must not be parallel activity in this + * session. + */ static void scst_free_tgt_dev(struct scst_tgt_dev *tgt_dev) { struct scst_device *dev = tgt_dev->dev; @@ -711,7 +718,10 @@ goto out; } -/* scst_mutex supposed to be held, there must not be parallel activity in this sess */ +/* + * scst_mutex supposed to be held, there must not be parallel activity in this + * session. + */ void scst_sess_free_tgt_devs(struct scst_session *sess) { int i; @@ -791,7 +801,8 @@ read_only); } else { PRINT_INFO("Added device %d:%d:%d:%d to group %s (LUN " - "%lld, rd_only %d)", dev->scsi_dev->host->host_no, + "%lld, rd_only %d)", + dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun, acg->acg_name, (long long unsigned int)lun, @@ -1383,11 +1394,13 @@ return cmd; } -void scst_destroy_put_cmd(struct scst_cmd *cmd) +static void scst_destroy_put_cmd(struct scst_cmd *cmd) { scst_sess_put(cmd->sess); - /* At this point tgt_dev can be dead, but the pointer remains not-NULL */ + /* + * At this point tgt_dev can be dead, but the pointer remains non-NULL + */ if (likely(cmd->tgt_dev != NULL)) __scst_put(); @@ -1461,10 +1474,10 @@ #ifdef CONFIG_SCST_EXTRACHECKS if (unlikely(!cmd->sent_for_exec)) { PRINT_ERROR("Finishing not executed cmd %p (opcode " - "%d, target %s, lun %lld, sn %ld, expected_sn %ld)", - cmd, cmd->cdb[0], cmd->tgtt->name, - (long long unsigned int)cmd->lun, - cmd->sn, cmd->tgt_dev->expected_sn); + "%d, target %s, lun %lld, sn %ld, expected_sn %ld)", + cmd, cmd->cdb[0], cmd->tgtt->name, + (long long unsigned int)cmd->lun, + cmd->sn, cmd->tgt_dev->expected_sn); scst_unblock_deferred(cmd->tgt_dev, cmd); } #endif @@ -1514,9 +1527,11 @@ tgt->retry_cmds--; TRACE_RETRY("Moving retry cmd %p to head of active " - "cmd list (retry_cmds left %d)", c, tgt->retry_cmds); + "cmd list (retry_cmds left %d)", + c, tgt->retry_cmds); spin_lock(&c->cmd_lists->cmd_list_lock); - list_move(&c->cmd_list_entry, &c->cmd_lists->active_cmd_list); + list_move(&c->cmd_list_entry, + &c->cmd_lists->active_cmd_list); wake_up(&c->cmd_lists->cmd_list_waitQ); spin_unlock(&c->cmd_lists->cmd_list_lock); @@ -1952,7 +1967,7 @@ address_method = (*lun) >> 6; /* high 2 bits of byte 0 */ switch (address_method) { case 0: /* peripheral device addressing method */ -#if 0 /* Looks like it's legal to use it as flat space addressing method as well */ +#if 0 if (*lun) { PRINT_ERROR("Illegal BUS INDENTIFIER in LUN " "peripheral device addressing method 0x%02x, " @@ -1962,6 +1977,11 @@ res = *(lun + 1); break; #else + /* + * Looks like it's legal to use it as flat space addressing + * method as well + */ + /* go through */ #endif @@ -2316,9 +2336,9 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->is_send_status and cmd->resp_data_len - * based on cmd->status and cmd->data_direction, therefore change - * them only if necessary + * SCST sets good defaults for cmd->is_send_status and + * cmd->resp_data_len based on cmd->status and cmd->data_direction, + * therefore change them only if necessary */ if ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET)) { @@ -2332,8 +2352,8 @@ buffer_size = scst_get_buf_first(cmd, &buffer); if (unlikely(buffer_size <= 0)) { if (buffer_size < 0) { - PRINT_ERROR("%s: Unable to get the buffer " - "(%d)", __func__, buffer_size); + PRINT_ERROR("%s: Unable to get the" + " buffer (%d)", __func__, buffer_size); } goto out; } @@ -2376,9 +2396,9 @@ TRACE_ENTRY(); /* - * SCST sets good defaults for cmd->is_send_status and cmd->resp_data_len - * based on cmd->status and cmd->data_direction, therefore change - * them only if necessary + * SCST sets good defaults for cmd->is_send_status and + * cmd->resp_data_len based on cmd->status and cmd->data_direction, + * therefore change them only if necessary */ switch (opcode) { @@ -2483,7 +2503,8 @@ if (scsi_status_is_good(res)) { int q; - PRINT_BUFF_FLAG(TRACE_SCSI, "Returned control mode page data", + PRINT_BUFF_FLAG(TRACE_SCSI, + "Returned control mode page data", buffer, sizeof(buffer)); dev->tst = buffer[4+2] >> 5; @@ -2491,7 +2512,8 @@ if (q > SCST_CONTR_MODE_QUEUE_ALG_UNRESTRICTED_REORDER) { PRINT_ERROR("Too big QUEUE ALG %x, dev " "%d:%d:%d:%d", dev->queue_alg, - dev->scsi_dev->host->host_no, dev->scsi_dev->channel, + dev->scsi_dev->host->host_no, + dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun); } dev->queue_alg = q; @@ -2505,49 +2527,66 @@ */ dev->has_own_order_mgmt = !dev->queue_alg; - TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, "Device %d:%d:%d:%d: TST %x, " - "QUEUE ALG %x, SWP %x, TAS %x, has_own_order_mgmt " - "%d", dev->scsi_dev->host->host_no, + TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, + "Device %d:%d:%d:%d: TST %x, " + "QUEUE ALG %x, SWP %x, TAS %x, " + "has_own_order_mgmt %d", + dev->scsi_dev->host->host_no, dev->scsi_dev->channel, dev->scsi_dev->id, dev->scsi_dev->lun, dev->tst, dev->queue_alg, dev->swp, dev->tas, dev->has_own_order_mgmt); goto out; } else { -#if 0 /* 3ware controller is buggy and returns CONDITION_GOOD instead of CHECK_CONDITION */ +#if 0 if ((status_byte(res) == CHECK_CONDITION) && #else + /* + * 3ware controller is buggy and returns CONDITION_GOOD + * instead of CHECK_CONDITION + */ if ( #endif SCST_SENSE_VALID(sense_buffer)) { if (sense_buffer[2] == ILLEGAL_REQUEST) { - TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, "Device " - "%d:%d:%d:%d doesn't support control " - "mode page, using defaults: TST " - "%x, QUEUE ALG %x, SWP %x, TAS %x, " - "has_own_order_mgmt %d", + TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, + "Device %d:%d:%d:%d doesn't" + " support control mode page," + " using defaults: TST %x," + " QUEUE ALG %x, SWP %x, TAS %x," + " has_own_order_mgmt %d", dev->scsi_dev->host->host_no, - dev->scsi_dev->channel, dev->scsi_dev->id, - dev->scsi_dev->lun, dev->tst, dev->queue_alg, - dev->swp, dev->tas, dev->has_own_order_mgmt); + dev->scsi_dev->channel, + dev->scsi_dev->id, + dev->scsi_dev->lun, + dev->tst, + dev->queue_alg, + dev->swp, + dev->tas, + dev->has_own_order_mgmt); res = 0; goto out; } else if (sense_buffer[2] == NOT_READY) { - TRACE(TRACE_SCSI, "Device %d:%d:%d:%d not ready", + TRACE(TRACE_SCSI, + "Device %d:%d:%d:%d not ready", dev->scsi_dev->host->host_no, - dev->scsi_dev->channel, dev->scsi_dev->id, + dev->scsi_dev->channel, + dev->scsi_dev->id, dev->scsi_dev->lun); res = 0; goto out; } } else { - TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, "Internal MODE SENSE to " + TRACE(TRACE_SCSI|TRACE_MGMT_MINOR, + "Internal MODE SENSE to " "device %d:%d:%d:%d failed: %x", dev->scsi_dev->host->host_no, - dev->scsi_dev->channel, dev->scsi_dev->id, + dev->scsi_dev->channel, + dev->scsi_dev->id, dev->scsi_dev->lun, res); - PRINT_BUFF_FLAG(TRACE_SCSI|TRACE_MGMT_MINOR, "MODE SENSE " - "sense", sense_buffer, sizeof(sense_buffer)); + PRINT_BUFF_FLAG(TRACE_SCSI|TRACE_MGMT_MINOR, + "MODE SENSE sense", + sense_buffer, sizeof(sense_buffer)); } scst_check_internal_sense(dev, res, sense_buffer, sizeof(sense_buffer)); @@ -2743,7 +2782,8 @@ list_for_each_entry(UA_entry_tmp, &tgt_dev->UA_list, UA_list_entry) { - if (memcmp(sense, UA_entry_tmp->UA_sense_buffer, sense_len) == 0) { + if (memcmp(sense, UA_entry_tmp->UA_sense_buffer, + sense_len) == 0) { TRACE_MGMT_DBG("%s", "UA already exists"); skip_UA = 1; break; @@ -2790,8 +2830,9 @@ /* Check for reset UA */ if (sense[12] == SCST_SENSE_ASC_UA_RESET) - scst_process_reset(dev, (exclude != NULL) ? exclude->sess : NULL, - exclude, NULL, false); + scst_process_reset(dev, + (exclude != NULL) ? exclude->sess : NULL, + exclude, NULL, false); scst_dev_check_set_local_UA(dev, exclude, sense, sense_len); @@ -2806,7 +2847,8 @@ TRACE_ENTRY(); - list_for_each_entry_safe(UA_entry, t, &tgt_dev->UA_list, UA_list_entry) { + list_for_each_entry_safe(UA_entry, t, + &tgt_dev->UA_list, UA_list_entry) { TRACE_MGMT_DBG("Clearing UA for tgt_dev lun %lld", (long long unsigned int)tgt_dev->lun); list_del(&UA_entry->UA_list_entry); @@ -3137,7 +3179,8 @@ list_del(&cmd->blocked_cmd_list_entry); TRACE_MGMT_DBG("Adding cmd %p to head of active cmd list", cmd); spin_lock(&cmd->cmd_lists->cmd_list_lock); - list_add(&cmd->cmd_list_entry, &cmd->cmd_lists->active_cmd_list); + list_add(&cmd->cmd_list_entry, + &cmd->cmd_lists->active_cmd_list); wake_up(&cmd->cmd_lists->cmd_list_waitQ); spin_unlock(&cmd->cmd_lists->cmd_list_lock); if (brk) @@ -3186,8 +3229,8 @@ tgt_dev->def_cmd_count++; list_add_tail(&out_of_sn_cmd->sn_cmd_list_entry, &tgt_dev->skipped_sn_list); - TRACE_SN("out_of_sn_cmd %p with sn %ld added to skipped_sn_list " - "(expected_sn %ld)", out_of_sn_cmd, out_of_sn_cmd->sn, + TRACE_SN("out_of_sn_cmd %p with sn %ld added to skipped_sn_list" + " (expected_sn %ld)", out_of_sn_cmd, out_of_sn_cmd->sn, tgt_dev->expected_sn); spin_unlock_irq(&tgt_dev->sn_lock); } @@ -3345,7 +3388,7 @@ static DEFINE_SPINLOCK(scst_tm_dbg_lock); /* All serialized by scst_tm_dbg_lock */ -struct { +static struct { unsigned int tm_dbg_release:1; unsigned int tm_dbg_blocked:1; } tm_dbg_flags; @@ -3404,8 +3447,8 @@ case TM_DBG_STATE_ABORT: if (tm_dbg_delayed_cmds_count == 0) { unsigned long d = 58*HZ + (scst_random() % (4*HZ)); - TRACE_MGMT_DBG("STATE ABORT: delaying cmd %p (tag %llu) " - "for %ld.%ld seconds (%ld HZ), " + TRACE_MGMT_DBG("STATE ABORT: delaying cmd %p (tag %llu)" + " for %ld.%ld seconds (%ld HZ), " "tm_dbg_on_state_passes=%d", cmd, cmd->tag, d/HZ, (d%HZ)*100/HZ, d, tm_dbg_on_state_passes); mod_timer(&tm_dbg_timer, jiffies + d); @@ -3556,11 +3599,13 @@ "active cmd list (delayed_cmds_count=%d)", c, c->tag, tm_dbg_delayed_cmds_count); - if (!test_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags)) { + if (!test_bit(SCST_CMD_ABORTED_OTHER, + &cmd->cmd_flags)) { /* Test how completed commands handled */ if (((scst_random() % 10) == 5)) { scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_hardw_error)); + SCST_LOAD_SENSE( + scst_sense_hardw_error)); /* It's completed now */ } } Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_main.c 2008-10-30 20:17:42 UTC (rev 555) @@ -40,10 +40,11 @@ details." #endif -#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && !defined(CONFIG_SCST_STRICT_SERIALIZING) +#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && \ + !defined(CONFIG_SCST_STRICT_SERIALIZING) #warning "Patch scst_exec_req_fifo-<kernel-version>.patch was not applied on \ - your kernel and CONFIG_SCST_STRICT_SERIALIZING isn't defined. Pass-through dev \ - handlers will not be supported." + your kernel and CONFIG_SCST_STRICT_SERIALIZING isn't defined. \ + Pass-through dev handlers will not be supported." #endif /** @@ -68,13 +69,13 @@ spinlock_t scst_main_lock; -struct kmem_cache *scst_mgmt_cachep; +static struct kmem_cache *scst_mgmt_cachep; mempool_t *scst_mgmt_mempool; -struct kmem_cache *scst_mgmt_stub_cachep; +static struct kmem_cache *scst_mgmt_stub_cachep; mempool_t *scst_mgmt_stub_mempool; -struct kmem_cache *scst_ua_cachep; +static struct kmem_cache *scst_ua_cachep; mempool_t *scst_ua_mempool; -struct kmem_cache *scst_sense_cachep; +static struct kmem_cache *scst_sense_cachep; mempool_t *scst_sense_mempool; struct kmem_cache *scst_tgtd_cachep; struct kmem_cache *scst_sess_cachep; @@ -454,7 +455,8 @@ } else res = 0; } else - wait_event(scst_dev_cmd_waitQ, atomic_read(&scst_cmd_count) == 0); + wait_event(scst_dev_cmd_waitQ, + atomic_read(&scst_cmd_count) == 0); TRACE_MGMT_DBG("wait_event() returned %d", res); @@ -881,7 +883,8 @@ if (res != 0) goto out_error; -#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && !defined(CONFIG_SCST_STRICT_SERIALIZING) +#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && \ + !defined(CONFIG_SCST_STRICT_SERIALIZING) if (dev_type->exec == NULL) { PRINT_ERROR("Pass-through dev handlers (handler \"%s\") not " "supported. Consider applying on your kernel patch " @@ -920,7 +923,7 @@ list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { - if ((dev->scsi_dev == NULL) || (dev->handler != &scst_null_devtype)) + if (dev->scsi_dev == NULL || dev->handler != &scst_null_devtype) continue; if (dev->scsi_dev->type == dev_type->type) scst_assign_dev_handler(dev, dev_type); @@ -1280,7 +1283,9 @@ { int i; - /* Just to lower the race window, when user can get just changed value */ + /* + * Just to lower the race window, when user can get just changed value + */ mutex_lock(&scst_threads_info.cmd_threads_mutex); i = scst_threads_info.nr_cmd_threads; mutex_unlock(&scst_threads_info.cmd_threads_mutex); @@ -1583,7 +1588,8 @@ #endif #ifdef CONFIG_SCST_ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ - i += snprintf(&buf[i], sizeof(buf) - i, "%sALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ", + i += snprintf(&buf[i], sizeof(buf) - i, + "%sALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ", (j == i) ? "" : ", "); #endif @@ -1691,7 +1697,8 @@ out_destroy_mgmt_stub_cache); { struct scst_sense { uint8_t s[SCST_SENSE_BUFFERSIZE]; }; - INIT_CACHEP(scst_sense_cachep, scst_sense, out_destroy_ua_cache); + INIT_CACHEP(scst_sense_cachep, scst_sense, + out_destroy_ua_cache); } INIT_CACHEP(scst_cmd_cachep, scst_cmd, out_destroy_sense_cache); INIT_CACHEP(scst_sess_cachep, scst_session, out_destroy_cmd_cache); @@ -1719,7 +1726,9 @@ goto out_destroy_mgmt_stub_mempool; } - /* Loosing sense may have fatal consequences, so let's have a big pool */ + /* + * Loosing sense may have fatal consequences, so let's have a big pool + */ scst_sense_mempool = mempool_create(128, mempool_alloc_slab, mempool_free_slab, scst_sense_cachep); if (scst_sense_mempool == NULL) { @@ -1770,8 +1779,9 @@ for (i = 0; i < (int)ARRAY_SIZE(scst_tasklets); i++) { spin_lock_init(&scst_tasklets[i].tasklet_lock); INIT_LIST_HEAD(&scst_tasklets[i].tasklet_cmd_list); - tasklet_init(&scst_tasklets[i].tasklet, (void *)scst_cmd_tasklet, - (unsigned long)&scst_tasklets[i]); + tasklet_init(&scst_tasklets[i].tasklet, + (void *)scst_cmd_tasklet, + (unsigned long)&scst_tasklets[i]); } TRACE_DBG("%d CPUs found, starting %d threads", scst_num_cpus, Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_mem.c 2008-10-30 20:17:42 UTC (rev 555) @@ -256,7 +256,8 @@ if (obj->owner_pool->clustered) { if (order <= sgv_pools_mgr.sgv_max_trans_order) { - obj->trans_tbl = (struct trans_tbl_ent *)obj->sg_entries_data; + obj->trans_tbl = + (struct trans_tbl_ent *)obj->sg_entries_data; /* * No need to clear trans_tbl, if needed, it will be * fully rewritten in scst_alloc_sg_entries() @@ -265,8 +266,8 @@ tsz = pages_to_alloc * sizeof(obj->trans_tbl[0]); obj->trans_tbl = kzalloc(tsz, gfp_mask); if (unlikely(obj->trans_tbl == NULL)) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of trans_tbl " - "failed (size %d)", tsz); + TRACE(TRACE_OUT_OF_MEM, "Allocation of " + "trans_tbl failed (size %d)", tsz); res = -ENOMEM; goto out_free; } @@ -294,7 +295,8 @@ obj->sg_count, obj->allocator_priv); } if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { + if (obj->trans_tbl != + (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; @@ -434,6 +436,8 @@ /* Called under pool_mgr_lock held, but drops/reaquires it inside */ static int sgv_pool_oom_free_objs(int pgs) + __releases(sgv_pools_mgr.mgr.pool_mgr_lock) + __acquires(sgv_pools_mgr.mgr.pool_mgr_lock) { TRACE_MEM("Shrinking pools about %d pages", pgs); while ((sgv_pools_mgr.mgr.throttle.inactive_pages_total > @@ -621,8 +625,9 @@ (obj->sg_entries + pages_to_alloc); TRACE_MEM("trans_tbl %p", obj->trans_tbl); /* - * No need to clear trans_tbl, if needed, it will - * be fully rewritten in scst_alloc_sg_entries() + * No need to clear trans_tbl, if needed, it + * will be fully rewritten in + * scst_alloc_sg_entries(), */ } } else { @@ -733,7 +738,8 @@ *sgv = obj; if (size & ~PAGE_MASK) - obj->sg_entries[cnt-1].length -= PAGE_SIZE - (size & ~PAGE_MASK); + obj->sg_entries[cnt-1].length -= + PAGE_SIZE - (size & ~PAGE_MASK); TRACE_MEM("sgv_obj=%p, sg_entries %p (size=%d, pages=%d, sg_count=%d, " "count=%d, last_len=%d)", obj, obj->sg_entries, size, pages, @@ -758,7 +764,8 @@ out_fail_free_sg_entries: if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { + if (obj->trans_tbl != + (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; @@ -933,8 +940,10 @@ (sizeof(obj->sg_entries[0]) + (clustered ? sizeof(obj->trans_tbl[0]) : 0)); } else if (i <= sgv_pools_mgr.sgv_max_trans_order) { - /* sgv ie sg_entries is allocated outside object but ttbl - is embedded still */ + /* + * sgv ie sg_entries is allocated outside object, but + * ttbl is still embedded. + */ size = sizeof(*obj) + (1 << i) * ((clustered ? sizeof(obj->trans_tbl[0]) : 0)); } else { @@ -995,8 +1004,8 @@ PAGE_SIZE) & PAGE_MASK)) - 1; pmgr->sgv_max_trans_order = get_order( - (((space4sgv_ttbl / - (sizeof(struct trans_tbl_ent))) * PAGE_SIZE) & PAGE_MASK)) - 1; + (((space4sgv_ttbl / sizeof(struct trans_tbl_ent)) * PAGE_SIZE) + & PAGE_MASK)) - 1; TRACE_MEM("sgv_max_local_order %d, sgv_max_trans_order %d", pmgr->sgv_max_local_order, pmgr->sgv_max_trans_order); @@ -1009,8 +1018,8 @@ (sizeof(struct scatterlist)) + sizeof(struct sgv_pool_obj)); TRACE_MEM("max object size with embedded ttbl %zd", - (1 << pmgr->sgv_max_trans_order) * sizeof(struct trans_tbl_ent) + - sizeof(struct sgv_pool_obj)); + (1 << pmgr->sgv_max_trans_order) * sizeof(struct trans_tbl_ent) + + sizeof(struct sgv_pool_obj)); } void sgv_pool_deinit(struct sgv_pool *pool) @@ -1117,7 +1126,8 @@ if (sgv_pool_cached_purge(e, SHRINK_TIME_AFTER, rt) == 0) { nr -= 1 << e->order_or_pages; - spin_unlock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); + spin_unlock_bh( + &sgv_pools_mgr.mgr.pool_mgr_lock); sgv_dtor_and_free(e); spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); } else @@ -1319,7 +1329,8 @@ sgv_pools_mgr.mgr.throttle.inactive_pages_total, sgv_pools_mgr.mgr.throttle.active_pages_total, "Hi/lo watermarks [pages]", sgv_pools_mgr.mgr.throttle.hi_wmk, - sgv_pools_mgr.mgr.throttle.lo_wmk, "Hi watermark releases/failures", + sgv_pools_mgr.mgr.throttle.lo_wmk, + "Hi watermark releases/failures", sgv_pools_mgr.mgr.throttle.releases_on_hiwmk, sgv_pools_mgr.mgr.throttle.releases_failed); Modified: trunk/scst/src/scst_mem.h =================================================================== --- trunk/scst/src/scst_mem.h 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_mem.h 2008-10-30 20:17:42 UTC (rev 555) @@ -37,7 +37,8 @@ int order_or_pages; struct { - unsigned long time_stamp; /* jiffies, protected by pool_mgr_lock */ + /* jiffies, protected by pool_mgr_lock */ + unsigned long time_stamp; struct list_head recycling_list_entry; struct list_head sorted_recycling_list_entry; } recycle_entry; @@ -77,7 +78,8 @@ /* 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 */ struct kmem_cache *caches[SGV_POOL_ELEMENTS]; - struct list_head recycling_lists[SGV_POOL_ELEMENTS]; /* protected by pool_mgr_lock */ + /* protected by pool_mgr_lock */ + struct list_head recycling_lists[SGV_POOL_ELEMENTS]; struct sgv_pool_acc acc; struct sgv_pool_cache_acc cache_acc[SGV_POOL_ELEMENTS]; @@ -95,15 +97,22 @@ struct sgv_pool_mgr { spinlock_t pool_mgr_lock; - struct list_head sorted_recycling_list; /* protected by pool_mgr_lock */ - int pitbool_running:1; /* protected by pool_mgr_lock */ + /* protected by pool_mgr_lock */ + struct list_head sorted_recycling_list; + /* protected by pool_mgr_lock */ + unsigned pitbool_running:1; struct sgv_mem_throttling { u32 inactive_pages_total; u32 active_pages_total; - u32 hi_wmk; /* compared against inactive_pages_total + active_pages_total */ - u32 lo_wmk; /* compared against inactive_pages_total only */ + /* + * compared against inactive_pages_total + + * active_pages_total + */ + u32 hi_wmk; + /* compared against inactive_pages_total only */ + u32 lo_wmk; u32 releases_on_hiwmk; u32 releases_failed; @@ -138,7 +147,8 @@ return obj->sg_entries; } -extern int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark); +extern int scst_sgv_pools_init(unsigned long mem_hwmark, + unsigned long mem_lwmark); extern void scst_sgv_pools_deinit(void); extern int sgv_pool_procinfo_show(struct seq_file *seq, void *v); Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_priv.h 2008-10-30 20:17:42 UTC (rev 555) @@ -39,9 +39,11 @@ #define TRACE_RTRY 0x80000000 #define TRACE_SCSI_SERIALIZING 0x40000000 -#define TRACE_SND_TOP 0x20000000 /** top being the edge away from the interupt */ +/** top being the edge away from the interupt */ +#define TRACE_SND_TOP 0x20000000 #define TRACE_RCV_TOP 0x01000000 -#define TRACE_SND_BOT 0x08000000 /** bottom being the edge toward the interupt */ +/** bottom being the edge toward the interupt */ +#define TRACE_SND_BOT 0x08000000 #define TRACE_RCV_BOT 0x04000000 #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) @@ -165,7 +167,8 @@ extern wait_queue_head_t scst_dev_cmd_waitQ; extern struct mutex scst_suspend_mutex; -extern struct list_head scst_cmd_lists_list; /* protected by scst_suspend_mutex */ +/* protected by scst_suspend_mutex */ +extern struct list_head scst_cmd_lists_list; extern struct list_head scst_acg_list; extern struct scst_acg *scst_default_acg; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_proc.c 2008-10-30 20:17:42 UTC (rev 555) @@ -128,8 +128,10 @@ " echo \"add_group GROUP\" >/proc/scsi_tgt/scsi_tgt\n" " echo \"del_group GROUP\" >/proc/scsi_tgt/scsi_tgt\n" "\n" -" echo \"add|del H:C:I:L lun [READ_ONLY]\" >/proc/scsi_tgt/groups/GROUP/devices\n" -" echo \"add|del V_NAME lun [READ_ONLY]\" >/proc/scsi_tgt/groups/GROUP/devices\n" +" echo \"add|del H:C:I:L lun [READ_ONLY]\"" +" >/proc/scsi_tgt/groups/GROUP/devices\n" +" echo \"add|del V_NAME lun [READ_ONLY]\"" +" >/proc/scsi_tgt/groups/GROUP/devices\n" " echo \"clear\" >/proc/scsi_tgt/groups/GROUP/devices\n" "\n" " echo \"add|del NAME\" >/proc/scsi_tgt/groups/GROUP/names\n" @@ -139,8 +141,10 @@ #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) "\n" " echo \"all|none|default\" >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" -" echo \"value DEC|0xHEX|0OCT\" >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" -" echo \"set|add|del TOKEN\" >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" +" echo \"value DEC|0xHEX|0OCT\"" +" >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" +" echo \"set|add|del TOKEN\"" +" >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" " where TOKEN is one of [debug,function,line,pid,entryexit,\n" " buff,mem,sg,out_of_mem,special,scsi,mgmt,minor]\n" " Additionally for /proc/scsi_tgt/trace_level there are these TOKENs\n" @@ -357,7 +361,8 @@ } EXPORT_SYMBOL(scst_proc_log_entry_write); -static ssize_t scst_proc_scsi_tgt_gen_write_log(struct file *file, const char __user *buf, +static ssize_t scst_proc_scsi_tgt_gen_write_log(struct file *file, + const char __user *buf, size_t length, loff_t *off) { int res; @@ -370,7 +375,8 @@ } res = scst_proc_log_entry_write(file, buf, length, - &trace_flag, SCST_DEFAULT_LOG_FLAGS, scst_proc_local_trace_tbl); + &trace_flag, SCST_DEFAULT_LOG_FLAGS, + scst_proc_local_trace_tbl); mutex_unlock(&scst_log_mutex); @@ -396,11 +402,15 @@ goto out; } - seq_printf(seq, "%-20s %-45s %-15s %15s\n", "Target name", "Initiator name", - "SCST latency", "Processing latency (us)"); + seq_printf(seq, "%-20s %-45s %-15s %15s\n", + "Target name", + "Initiator name", + "SCST latency", + "Processing latency (us)"); list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { - list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { + list_for_each_entry(sess, &acg->acg_sess_list, + acg_sess_list_entry) { unsigned long proc_lat = 0, scst_lat = 0; uint64_t proc_time, scst_time; unsigned int processed_cmds; @@ -427,8 +437,10 @@ #endif if (sess->processed_cmds != 0) { - proc_lat = (unsigned long)proc_time / processed_cmds; - scst_lat = (unsigned long)scst_time / processed_cmds; + proc_lat = (unsigned long)proc_time / + processed_cmds; + scst_lat = (unsigned long)scst_time / + processed_cmds; } seq_printf(seq, "%-20s %-45s %-15ld %-15ld\n", @@ -445,7 +457,8 @@ return res; } -static ssize_t scst_proc_scsi_tgt_gen_write_lat(struct file *file, const char __user *buf, +static ssize_t scst_proc_scsi_tgt_gen_write_lat(struct file *file, + const char __user *buf, size_t length, loff_t *off) { int res = length; @@ -460,8 +473,10 @@ } list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { - list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { - PRINT_INFO("Zeroing latency statistics for initiator %s", + list_for_each_entry(sess, &acg->acg_sess_list, + acg_sess_list_entry) { + PRINT_INFO("Zeroing latency statistics for initiator" + " %s", sess->initiator_name); spin_lock_bh(&sess->meas_lock); sess->processing_time = 0; @@ -488,7 +503,8 @@ static int __init scst_proc_init_module_log(void) { int res = 0; -#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) || defined(CONFIG_SCST_MEASURE_LATENCY) +#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) || \ + defined(CONFIG_SCST_MEASURE_LATENCY) struct proc_dir_entry *generic; #endif @@ -512,7 +528,8 @@ &scst_lat_proc_data); if (!generic) { PRINT_ERROR("cannot init /proc/%s/%s", - SCST_PROC_ENTRY_NAME, SCST_PROC_LAT_ENTRY_NAME); + SCST_PROC_ENTRY_NAME, + SCST_PROC_LAT_ENTRY_NAME); res = -ENOMEM; } } @@ -731,7 +748,8 @@ TRACE_ENTRY(); - pr = scst_create_proc_entry(scst_proc_scsi_tgt, "sgv", &scst_sgv_proc_data); + pr = scst_create_proc_entry(scst_proc_scsi_tgt, "sgv", + &scst_sgv_proc_data); if (pr == NULL) { PRINT_ERROR("%s", "cannot create sgv /proc entry"); res = -ENOMEM; @@ -755,7 +773,7 @@ TRACE_ENTRY(); - scst_proc_scsi_tgt = proc_mkdir(SCST_PROC_ENTRY_NAME, 0); + scst_proc_scsi_tgt = proc_mkdir(SCST_PROC_ENTRY_NAME, NULL); if (!scst_proc_scsi_tgt) { PRINT_ERROR("cannot init /proc/%s", SCST_PROC_ENTRY_NAME); goto out_nomem; @@ -770,7 +788,8 @@ goto out_remove; } - generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_VERSION_NAME, + generic = scst_create_proc_entry(scst_proc_scsi_tgt, + SCST_PROC_VERSION_NAME, &scst_version_proc_data); if (!generic) { PRINT_ERROR("cannot init /proc/%s/%s", @@ -778,7 +797,8 @@ goto out_remove1; } - generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_SESSIONS_NAME, + generic = scst_create_proc_entry(scst_proc_scsi_tgt, + SCST_PROC_SESSIONS_NAME, &scst_sessions_proc_data); if (!generic) { PRINT_ERROR("cannot init /proc/%s/%s", @@ -786,7 +806,8 @@ goto out_remove2; } - generic = scst_create_proc_entry(scst_proc_scsi_tgt, SCST_PROC_HELP_NAME, + generic = scst_create_proc_entry(scst_proc_scsi_tgt, + SCST_PROC_HELP_NAME, &scst_help_proc_data); if (!generic) { PRINT_ERROR("cannot init /proc/%s/%s", @@ -838,7 +859,7 @@ remove_proc_entry(SCST_PROC_ENTRY_NAME, scst_proc_scsi_tgt); out_remove: - remove_proc_entry(SCST_PROC_ENTRY_NAME, 0); + remove_proc_entry(SCST_PROC_ENTRY_NAME, NULL); out_nomem: res = -ENOMEM; @@ -858,13 +879,14 @@ remove_proc_entry(SCST_PROC_SESSIONS_NAME, scst_proc_scsi_tgt); remove_proc_entry(SCST_PROC_VERSION_NAME, scst_proc_scsi_tgt); remove_proc_entry(SCST_PROC_ENTRY_NAME, scst_proc_scsi_tgt); - remove_proc_entry(SCST_PROC_ENTRY_NAME, 0); + remove_proc_entry(SCST_PROC_ENTRY_NAME, NULL); TRACE_EXIT(); } -static ssize_t scst_proc_threads_write(struct file *file, const char __user *buf, - size_t length, loff_t *off) +static ssize_t scst_proc_threads_write(struct file *file, + const char __user *buf, + size_t length, loff_t *off) { int res = length; int oldtn, newtn, delta; @@ -1010,10 +1032,12 @@ return; } -static ssize_t scst_proc_scsi_tgt_write(struct file *file, const char __user *buf, - size_t length, loff_t *off) +static ssize_t scst_proc_scsi_tgt_write(struct file *file, + const char __user *buf, + size_t length, loff_t *off) { - struct scst_tgt *vtt = (struct scst_tgt *)PDE(file->f_dentry->d_inode)->data; + struct scst_tgt *vtt = + (struct scst_tgt *)PDE(file->f_dentry->d_inode)->data; ssize_t res = 0; char *buffer; char *start; @@ -1150,10 +1174,12 @@ return; } -static ssize_t scst_proc_scsi_dev_handler_write(struct file *file, const char __user *buf, - size_t length, loff_t *off) +static ssize_t scst_proc_scsi_dev_handler_write(struct file *file, + const char __user *buf, + size_t length, loff_t *off) { - struct scst_dev_type *dev_type = (struct scst_dev_type *)PDE(file->f_dentry->d_inode)->data; + struct scst_dev_type *dev_type = + (struct scst_dev_type *)PDE(file->f_dentry->d_inode)->data; ssize_t res = 0; char *buffer; char *start; @@ -1211,7 +1237,8 @@ return res; } -static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, const char __user *buf, +static ssize_t scst_proc_scsi_tgt_gen_write(struct file *file, + const char __user *buf, size_t length, loff_t *off) { int res, rc = 0, action; @@ -1432,13 +1459,15 @@ goto out; } -static ssize_t scst_proc_groups_devices_write(struct file *file, const char __user *buf, - size_t length, loff_t *off) +static ssize_t scst_proc_groups_devices_write(struct file *file, + const char __user *buf, + size_t length, loff_t *off) { int res, action, virt = 0, rc, read_only = 0; char *buffer, *p, *e = NULL; unsigned int host, channel = 0, id = 0, lun = 0, virt_lun; - struct scst_acg *acg = (struct scst_acg *)PDE(file->f_dentry->d_inode)->data; + struct scst_acg *acg = + (struct scst_acg *)PDE(file->f_dentry->d_inode)->data; struct scst_acg_dev *acg_dev = NULL, *acg_dev_tmp; struct scst_device *d, *dev = NULL; @@ -1469,8 +1498,10 @@ } /* - * Usage: echo "add|del H:C:I:L lun [READ_ONLY]" >/proc/scsi_tgt/groups/GROUP/devices - * or echo "add|del V_NAME lun [READ_ONLY]" >/proc/scsi_tgt/groups/GROUP/devices + * Usage: echo "add|del H:C:I:L lun [READ_ONLY]" \ + * >/proc/scsi_tgt/groups/GROUP/devices + * or echo "add|del V_NAME lun [READ_ONLY]" \ + * >/proc/scsi_tgt/groups/GROUP/devices * or echo "clear" >/proc/scsi_tgt/groups/GROUP/devices */ p = buffer; @@ -1632,12 +1663,14 @@ return res; } -static ssize_t scst_proc_groups_names_write(struct file *file, const char __user *buf, +static ssize_t scst_proc_groups_names_write(struct file *file, + const char __user *buf, size_t length, loff_t *off) { int res = length, action; char *buffer, *p, *e; - struct scst_acg *acg = (struct scst_acg *)PDE(file->f_dentry->d_inode)->data; + struct scst_acg *acg = + (struct scst_acg *)PDE(file->f_dentry->d_inode)->data; struct scst_acn *n, *nn; TRACE_ENTRY(); @@ -1811,8 +1844,8 @@ TRACE_ENTRY(); seq_printf(seq, "%d - %s\n", dev_type->type, - dev_type->type > (int)ARRAY_SIZE(scst_proc_dev_handler_type) ? - "unknown" : scst_proc_dev_handler_type[dev_type->type]); + dev_type->type > (int)ARRAY_SIZE(scst_proc_dev_handler_type) + ? "unknown" : scst_proc_dev_handler_type[dev_type->type]); TRACE_EXIT(); return 0; @@ -1836,11 +1869,13 @@ goto out; } - seq_printf(seq, "%-20s %-45s %-35s %-15s\n", "Target name", "Initiator name", - "Group name", "Command Count"); + seq_printf(seq, "%-20s %-45s %-35s %-15s\n", + "Target name", "Initiator name", + "Group name", "Command Count"); list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { - list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { + list_for_each_entry(sess, &acg->acg_sess_list, + acg_sess_list_entry) { seq_printf(seq, "%-20s %-45s %-35s %-15d\n", sess->tgt->tgtt->name, sess->initiator_name, @@ -1955,7 +1990,8 @@ #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) -int scst_proc_read_tlb(const struct scst_proc_log *tbl, struct seq_file *seq, +static int scst_proc_read_tlb(const struct scst_proc_log *tbl, + struct seq_file *seq, unsigned long log_level, int *first) { const struct scst_proc_log *t = tbl; @@ -2001,7 +2037,8 @@ goto out; } - res = scst_proc_log_entry_read(seq, trace_flag, scst_proc_local_trace_tbl); + res = scst_proc_log_entry_read(seq, trace_flag, + scst_proc_local_trace_tbl); mutex_unlock(&scst_log_mutex); @@ -2030,7 +2067,8 @@ goto out; } - seq_printf(seq, "%-60s%s\n", "Device (host:ch:id:lun or name)", "Device handler"); + seq_printf(seq, "%-60s%s\n", "Device (host:ch:id:lun or name)", + "Device handler"); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { if (dev->virt_id == 0) { char conv[60]; @@ -2042,9 +2080,10 @@ seq_printf(seq, "%s", conv); sprintf(conv, "%%-%dd%%s\n", 60 - size); seq_printf(seq, conv, dev->scsi_dev->lun, - dev->handler ? dev->handler->name : "-"); + dev->handler ? dev->handler->name : "-"); } else - seq_printf(seq, "%-60s%s\n", dev->virt_name, dev->handler->name); + seq_printf(seq, "%-60s%s\n", + dev->virt_name, dev->handler->name); } mutex_unlock(&scst_mutex); @@ -2137,7 +2176,7 @@ if (root) { mode_t mode; - mode = S_IFREG | S_IRUGO | ((pdata->seq_op.write) ? S_IWUSR : 0); + mode = S_IFREG | S_IRUGO | (pdata->seq_op.write ? S_IWUSR : 0); p = create_proc_entry(name, mode, root); if (p == NULL) { PRINT_ERROR("Fail to create entry %s in /proc", name); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-10-30 19:11:04 UTC (rev 554) +++ trunk/scst/src/scst_targ.c 2008-10-30 20:17:42 UTC (rev 555) @@ -64,7 +64,8 @@ #ifdef CONFIG_SCST_EXTRACHECKS if (unlikely(sess->shut_phase != SCST_SESS_SPH_READY)) { - PRINT_CRIT_ERROR("%s", "New cmd while shutting down the session"); + PRINT_CRIT_ERROR("%s", + "New cmd while shutting down the session"); sBUG(); } #endif @@ -229,7 +230,8 @@ case SCST_SESS_IPH_SUCCESS: break; case SCST_SESS_IPH_INITING: - TRACE_DBG("Adding cmd %p to init deferred cmd list", cmd); + TRACE_DBG("Adding cmd %p to init deferred cmd list", + cmd); list_add_tail(&cmd->cmd_list_entry, &sess->init_deferred_cmd_list); spin_unlock_irqrestore(&sess->sess_list_lock, flags); @@ -243,7 +245,8 @@ sBUG(); } } else - list_add_tail(&cmd->search_cmd_list_entry, &sess->search_cmd_list); + list_add_tail(&cmd->search_cmd_list_entry, + &sess->search_cmd_list); spin_unlock_irqrestore(&sess->sess_list_lock, flags); @@ -323,9 +326,9 @@ TRACE_ENTRY(); cmd->inc_expected_sn_on_done = dev->handler->exec_sync || - (!dev->has_own_order_mgmt && - ((dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) || - (cmd->queue_type == SCST_CMD_QUEUE_ORDERED))); + (!dev->has_own_order_mgmt && + (dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER || + cmd->queue_type == SCST_CMD_QUEUE_ORDERED)); /* * Expected transfer data supplied by the SCSI transport via the @@ -382,7 +385,8 @@ cmd->op_name, cmd->data_direction, cmd->expected_data_direction, scst_cmd_is_expected_set(cmd) ? "yes" : "no", - cmd->bufflen, cmd->expected_transfer_len, cmd->op_flags); + cmd->bufflen, cmd->expected_transfer_len, + cmd->op_flags); if (unlikely((cmd->op_flags & SCST_UNKNOWN_LENGTH) != 0)) { if (scst_cmd_is_expected_set(cmd)) { @@ -445,7 +449,7 @@ case VERIFY_12: case VERIFY_16: /* VERIFY commands with BYTCHK unset shouldn't fail here */ - if (((cmd->op_flags & SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED) != 0) && + if ((cmd->op_flags & SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED) && (cmd->cdb[1] & BYTCHK) == 0) res = true; break; @@ -479,7 +483,8 @@ TRACE_DBG("Calling dev handler %s parse(%p)", dev->handler->name, cmd); - TRACE_BUFF_FLAG(TRACE_SND_BOT, "Parsing: ", cmd->cdb, cmd->cdb_len); + TRACE_BUFF_FLAG(TRACE_SND_BOT, "Parsing: ", + cmd->cdb, cmd->cdb_len); state = dev->handler->parse(cmd); /* Caution: cmd can be already dead here */ TRACE_DBG("Dev handler %s parse() returned %d", @@ -546,10 +551,12 @@ # ifdef CONFIG_SCST_EXTRACHECKS if ((cmd->data_direction != cmd->expected_data_direction) || (cmd->bufflen != cmd->expected_transfer_len)) { - PRINT_WARNING("Expected values don't match decoded ones: " - "data_direction %d, expected_data_direction %d, " + PRINT_WARNING("Expected values don't match decoded " + "ones: data_direction %d, " + "expected_data_direction %d, " "bufflen %d, expected_transfer_len %d", - cmd->data_direction, cmd->expected_data_direction, + cmd->data_direction, + cmd->expected_data_direction, cmd->bufflen, cmd->expected_transfer_len); PRINT_BUFFER("Suspicious CDB", cmd->cdb, cmd->cdb_len); } @@ -557,18 +564,22 @@ cmd->data_direction = cmd->expected_data_direction; cmd->bufflen = cmd->expected_transfer_len; #else - if (unlikely(cmd->data_direction != cmd->expected_data_direction)) { + if (unlikely(cmd->data_direction != + cmd->expected_data_direction)) { if (((cmd->expected_data_direction != SCST_DATA_NONE) || (cmd->bufflen != 0)) && !scst_is_allowed_to_mismatch_cmd(cmd)) { - PRINT_ERROR("Expected data direction %d for opcode " - "0x%02x (handler %s, target %s) doesn't match " - "decoded value %d", cmd->expected_data_direction, + PRINT_ERROR("Expected data direction %d for " + "opcode 0x%02x (handler %s, target %s) " + "doesn't match " + "decoded value %d", + cmd->expected_data_direction, cmd->cdb[0], dev->handler->name, cmd->tgtt->name, cmd->data_direction); - PRINT_BUFFER("Failed CDB", cmd->cdb, cmd->cdb_len); + PRINT_BUFFER("Failed CDB", + cmd->cdb, cmd->cdb_len); scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_message)); + SCST_LOAD_SENSE(scst_sense_invalid_message)); goto out_dev_done; } } @@ -1102,7 +1113,8 @@ break; case SCST_PREPROCESS_STATUS_NEED_THREAD: TRACE_DBG("Target driver's %s pre_exec() requested " - "thread context, rescheduling", cmd->tgtt->name); + "thread context, rescheduling", + cmd->tgtt->name); res = SCST_CMD_STATE_RES_NEED_THREAD; cmd->state = SCST_CMD_STATE_TGT_PRE_EXEC; break; @@ -1128,8 +1140,8 @@ getnstimeofday(&ts); cmd->post_exec_start = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): post_exec_start %lld (tv_sec %ld, " - "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, ts.tv_sec, - ts.tv_nsec); + "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, + ts.tv_sec, ts.tv_nsec); } #endif @@ -1268,8 +1280,8 @@ getnstimeofday(&ts); cmd->post_exec_start = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): post_exec_start %lld (tv_sec %ld, " - "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, ts.tv_sec, - ts.tv_nsec); + "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, + ts.tv_sec, ts.tv_nsec); } #endif @@ -1362,7 +1374,8 @@ if (!overflow) { if (offs >= buffer_size) { scst_put_buf(cmd, buffer); - buffer_size = scst_get_buf_next(cmd, &buffer); + buffer_size = scst_get_buf_next(cmd, + &buffer); if (buffer_size > 0) { memset(buffer, 0, buffer_size); offs = 0; @@ -1372,9 +1385,10 @@ } } if ((buffer_size - offs) < 8) { - PRINT_ERROR("Buffer allocated for REPORT " - "LUNS command doesn't allow to fit 8 " - "byte entry (buffer_size=%d)", + PRINT_ERROR("Buffer allocated for " + "REPORT LUNS command doesn't " + "allow to fit 8 byte entry " + "(buffer_size=%d)", buffer_size); goto out_put_hw_err; } @@ -1595,13 +1609,19 @@ } /* Reserve check before Unit Attention */ - if (unlikely(test_bit(SCST_TGT_DEV_RESERVED, &tgt_dev->tgt_dev_flags))) { - if ((cmd->cdb[0] != INQUIRY) && (cmd->cdb[0] != REPORT_LUNS) && - (cmd->cdb[0] != RELEASE) && (cmd->cdb[0] != RELEASE_10) && - (cmd->cdb[0] != REPORT_DEVICE_IDENTIFIER) && - (cmd->cdb[0] != ALLOW_MEDIUM_REMOVAL || (cmd->cdb[4] & 3)) && - (cmd->cdb[0] != LOG_SENSE) && (cmd->cdb[0] != REQUEST_SENSE)) { - scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); + if (unlikely(test_bit(SCST_TGT_DEV_RESERVED, + &tgt_dev->tgt_dev_flags))) { + if (cmd->cdb[0] != INQUIRY && + cmd->cdb[0] != REPORT_LUNS && + cmd->cdb[0] != RELEASE && + cmd->cdb[0] != RELEASE_10 && + cmd->cdb[0] != REPORT_DEVICE_IDENTIFIER && + (cmd->cdb[0] != ALLOW_MEDIUM_REMOVAL || + (cmd->cdb[4] & 3)) && + cmd->cdb[0] != LOG_SENSE && + cmd->cdb[0] != REQUEST_SENSE) { + scst_set_cmd_error_status(cmd, + SAM_STAT_RESERVATION_CONFLICT); goto out_complete; } } @@ -1611,14 +1631,20 @@ unlikely(dev->scsi_dev->was_reset)) { if (scst_is_ua_command(cmd)) { int done = 0; - /* Prevent more than 1 cmd to be triggered by was_reset */ + /* + * Prevent more than 1 cmd to be triggered by + * was_reset. + */ spin_lock_bh(&dev->dev_lock); barrier(); /* to reread was_reset */ if (dev->scsi_dev->was_reset) { TRACE(TRACE_MGMT, "was_reset is %d", 1); scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_reset_UA)); - /* It looks like it is safe to clear was_reset here */ + SCST_LOAD_SENSE(scst_sense_reset_UA)); + /* + * It looks like it is safe to clear was_reset + * here. + */ dev->scsi_dev->was_reset = 0; done = 1; } @@ -1676,7 +1702,10 @@ if (likely(tgt_dev->num_free_sn_slots < (int)ARRAY_SIZE(tgt_dev->sn_slots)-1)) { if (tgt_dev->num_free_sn_slots < 0) tgt_dev->cur_sn_slot = slot; - smp_mb(); /* to be in-sync with SIMPLE case in scst_cmd_set_sn() */ + /* + * To be in-sync with SIMPLE case in scst_cmd_set_sn() + */ + smp_mb(); tgt_dev->num_free_sn_slots++; TRACE_SN("Incremented num_free_sn_slots (%d)", tgt_dev->num_free_sn_slots); @@ -1868,7 +1897,8 @@ if (likely(res == SCST_EXEC_COMPLETED)) { scst_post_exec_sn(cmd, true); if (cmd->dev->scsi_dev != NULL) - generic_unplug_device(cmd->dev->scsi_dev->request_queue); + generic_unplug_device( + cmd->dev->scsi_dev->request_queue); } else sBUG_ON(res != SCST_EXEC_NEED_THREAD); @@ -2090,7 +2120,8 @@ expected_sn = tgt_dev->expected_sn; if ((cmd->sn != expected_sn) || (tgt_dev->hq_cmd_count > 0)) { - if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { + if (unlikely(test_bit(SCST_CMD_ABORTED, + &cmd->cmd_flags))) { /* Necessary to allow aborting out of sn cmds */ TRACE_MGMT_DBG("Aborting out of sn cmd %p " "(tag %llu, sn %lu)", cmd, @@ -2157,8 +2188,8 @@ if (cmd->double_ua_possible) { TRACE(TRACE_MGMT_MINOR, "Double UA " "detected for device %p", dev); - TRACE(TRACE_MGMT_MINOR, "Retrying cmd %p " - "(tag %llu)", cmd, + TRACE(TRACE_MGMT_MINOR, "Retrying cmd" + " %p (tag %llu)", cmd, (long long unsigned)cmd->tag); cmd->status = 0; @@ -2166,7 +2197,8 @@ cmd->host_status = DID_OK; cmd->driver_status = 0; - mempool_free(cmd->sense, scst_sense_mempool); + mempool_free(cmd->sense, + scst_sense_mempool); cmd->sense = NULL; scst_check_restore_sg_buff(cmd); @@ -2234,7 +2266,8 @@ TRACE(TRACE_SCSI|TRACE_MINOR, "Host status %x " "received, returning HARDWARE ERROR instead", cmd->host_status); - scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); + scst_set_cmd_error(cmd, + SCST_LOAD_SENSE(scst_sense_hardw_error)); } } @@ -2270,7 +2303,9 @@ if (unlikely((cmd->cdb[0] == MODE_SENSE || cmd->cdb[0] == MODE_SENSE_10)) && cmd->tgt_dev->acg_dev->rd_only_flag && - (type == TYPE_DISK || type == TYPE_WORM || type == TYPE_MOD || + (type == TYPE_DISK || + type == TYPE_WORM || + type == TYPE_MOD || type == TYPE_TAPE)) { int32_t length; uint8_t *address; @@ -2299,7 +2334,8 @@ * since we don't support ACA */ if (unlikely((cmd->cdb[0] == INQUIRY)) && - !(cmd->cdb[1] & SCST_INQ_EVPD/* Std INQUIRY data (no EVPD) */) && + /* Std INQUIRY data (no EVPD) */ + !(cmd->cdb[1] & SCST_INQ_EVPD) && (cmd->resp_data_len > SCST_INQ_BYTE3)) { uint8_t *buffer; int buflen; @@ -2322,7 +2358,7 @@ PRINT_ERROR("%s", "Unable to get INQUIRY " "buffer"); scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_hardw_error)); + SCST_LOAD_SENSE(scst_sense_hardw_error)); err = true; } if (buflen > 0) @@ -2335,7 +2371,8 @@ if (unlikely((cmd->cdb[0] == MODE_SELECT) || (cmd->cdb[0] == MODE_SELECT_10) || (cmd->cdb[0] == LOG_SELECT))) { - TRACE(TRACE_SCSI, "MODE/LOG SELECT succeeded (LUN %lld)", + TRACE(TRACE_SCSI, + "MODE/LOG SELECT succeeded (LUN %lld)", (long long unsigned int)cmd->lun); cmd->state = SCST_CMD_STATE_MODE_SELECT_CHECKS; goto out; @@ -2347,7 +2384,8 @@ struct scst_tgt_dev *tgt_dev_tmp; struct scst_device *dev = cmd->dev; - TRACE(TRACE_SCSI, "Real RESERVE failed lun=%lld, " + TRACE(TRACE_SCSI, + "Real RESERVE failed lun=%lld, " "status=%x", (long long unsigned int)cmd->lun, cmd->status); @@ -2356,7 +2394,8 @@ /* Clearing the reservation */ spin_lock_bh(&dev->dev_lock); - list_for_each_entry(tgt_dev_tmp, &dev->dev_tgt_dev_list, + list_for_each_entry(tgt_dev_tmp, + &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { clear_bit(SCST_TGT_DEV_RESERVED, &tgt_dev_tmp->tgt_dev_flags); @@ -2435,7 +2474,8 @@ (((cmd->sense[12] == 0x2a) && (cmd->sense[13] == 0x01)) || (cmd->sense[12] == 0x29) /* reset */ || (cmd->sense[12] == 0x28) /* medium changed */ || - (cmd->sense[12] == 0x2F) /* cleared by another ini (just in case) */)) { + /* cleared by another ini (just in case) */ + (cmd->sense[12] == 0x2F))) { if (atomic) { TRACE_DBG("Possible parameters changed UA %x: " "thread context required", cmd->sense[12]); @@ -2567,9 +2607,11 @@ TRACE_ENTRY(); #ifdef CONFIG_SCST_DEBUG_TM - if (cmd->tm_dbg_delayed && !test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags)) { + if (cmd->tm_dbg_delayed && + !test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags)) { if (scst_cmd_atomic(cmd)) { - TRACE_MGMT_DBG("%s", "DEBUG_TM delayed cmd needs a thread"); + TRACE_MGMT_DBG("%s", + "DEBUG_TM delayed cmd needs a thread"); res = SCST_CMD_STATE_RES_NEED_THREAD; return res; } @@ -2590,7 +2632,8 @@ scst_on_hq_cmd_response(cmd); if (unlikely(!cmd->sent_for_exec)) { - TRACE_SN("cmd %p was not sent to mid-lev (sn %ld, set %d)", + TRACE_SN("cmd %p was not sent to mid-lev" + " (sn %ld, set %d)", cmd, cmd->sn, cmd->sn_set); scst_unblock_deferred(cmd->tgt_dev, cmd); cmd->sent_for_exec = 1; @@ -2615,8 +2658,9 @@ scst_xmit_process_aborted_cmd(cmd); if (unlikely(test_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags))) { - TRACE_MGMT_DBG("Flag NO_RESP set for cmd %p (tag %llu), skipping", - cmd, (long long unsigned int)cmd->tag); + TRACE_MGMT_DBG("Flag NO_RESP set for cmd %p (tag %llu)," + " skipping", + cmd, (long long unsigned int)cmd->tag); cmd->state = SCST_CMD_STATE_FINISHED; res = SCST_CMD_STATE_RES_CONT_SAME; goto out; @@ -2648,8 +2692,9 @@ spin_unlock_bh(&sess->meas_lock); TRACE_DBG("cmd %p (sess %p): finish %lld (tv_sec %ld, " - "tv_nsec %ld), scst_time %lld, proc_time %lld", cmd, sess, - finish, ts.tv_sec, ts.tv_nsec, scst_time, proc_time); + "tv_nsec %ld), scst_time %lld, proc_time %lld", + cmd, sess, finish, ts.tv_sec, ts.tv_nsec, scst_time, + proc_time); } #endif TRACE_EXIT_HRES(res); @@ -2686,8 +2731,8 @@ if (cmd->sg) { int i; struct scatterlist *sg = cmd->sg; - TRACE_SEND_BOT("Xmitting %d S/G(s) at %p sg[0].page at %p", - cmd->sg_cnt, sg, (void *)sg_page(&sg[0])); + TRACE_SEND_BOT("Xmitting %d S/G(s) at %p sg[0].page at " + "%p", cmd->sg_cnt, sg, (void *)sg_page(&sg[0])); for (i = 0; i < cmd->sg_cnt; ++i) { TRACE_BUFF_FLAG(TRACE_SND_BOT, "Xmitting sg", sg_virt(&sg[i]), @@ -2813,7 +2858,8 @@ TRACE_ENTRY(); if (scst_is_implicit_hq(cmd)) { - TRACE(TRACE_SCSI|TRACE_SCSI_SERIALIZING, "Implicit HQ cmd %p", cmd); + TRACE(TRACE_SCSI|TRACE_SCSI_SERIALIZING, + "Implicit HQ cmd %p", cmd); cmd->queue_type = SCST_CMD_QUEUE_HEAD_OF_QUEUE; } @@ -2823,7 +2869,8 @@ scst_check_debug_sn(cmd); - if (cmd->dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) { + if (cmd->dev->queue_alg == + SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) { /* * Not the best way, but well enough until there will be a * possibility to specify queue type during pass-through @@ -2874,14 +2921,13 @@ tgt_dev->num_free_sn_slots--; if (tgt_dev->num_free_sn_slots >= 0) { int i = 0; - /* - * Commands can finish in any order, so we don't - * know, which slot is empty. + /* Commands can finish in any order, so + * we don't know which slot is empty. */ while (1) { tgt_dev->cur_sn_slot++; - if (tgt_dev->cur_sn_slot == tgt_dev->sn_slots + - ARRAY_SIZE(tgt_dev->sn_slots)) + if (tgt_dev->cur_sn_slot == + tgt_dev->sn_slots + ARRAY_SIZE(tgt_dev->sn_slots)) tgt_dev->cur_sn_slot = tgt_dev->sn_slots; if (atomic_read(tgt_dev->cur_sn_slot) == 0) @@ -2891,7 +2937,8 @@ sBUG_ON(i == ARRAY_SIZE(tgt_dev->sn_slots)); } TRACE_SN("New cur SN slot %zd", - tgt_dev->cur_sn_slot-tgt_dev->sn_slots); + tgt_dev->cur_sn_slot - + tgt_dev->sn_slots); } } spin_unlock_irqrestore(&tgt_dev->sn_lock, flags); @@ -2955,10 +3002,11 @@ if (tgt_dev->lun == cmd->lun) { TRACE_DBG("tgt_dev %p found", tgt_dev); - if (unlikely(tgt_dev->dev->handler == &scst_null_devtype)) { + if (unlikely(tgt_dev->dev->handler == + &scst_null_devtype)) { PRINT_INFO("Dev handler for device " - "%lld is NULL, the device will not be " - "visible remotely", + "%lld is NULL, the device will not " + "be visible remotely", (long long unsigned int)cmd->lun); break; } @@ -2972,8 +3020,10 @@ } } if (res != 0) { - TRACE(TRACE_MINOR, "tgt_dev for lun %lld not foun... [truncated message content] |