Commit 9c31820b authored by Roland Dreier's avatar Roland Dreier Committed by Nicholas Bellinger

target: Remove cmd->se_ordered_id (unused except debug log lines)

For every command, we set se_ordered_id by doing atomic_inc_return on
dev->dev_ordered_id for the corresponding device.  However, the only
places this value gets used are in pr_debug() calls, which doesn't
seem worth an extra atomic op per IO.
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 45182ed5
...@@ -769,7 +769,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) ...@@ -769,7 +769,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
spin_lock_init(&dev->se_tmr_lock); spin_lock_init(&dev->se_tmr_lock);
spin_lock_init(&dev->qf_cmd_lock); spin_lock_init(&dev->qf_cmd_lock);
sema_init(&dev->caw_sem, 1); sema_init(&dev->caw_sem, 1);
atomic_set(&dev->dev_ordered_id, 0);
INIT_LIST_HEAD(&dev->t10_wwn.t10_vpd_list); INIT_LIST_HEAD(&dev->t10_wwn.t10_vpd_list);
spin_lock_init(&dev->t10_wwn.t10_vpd_lock); spin_lock_init(&dev->t10_wwn.t10_vpd_lock);
INIT_LIST_HEAD(&dev->t10_pr.registration_list); INIT_LIST_HEAD(&dev->t10_pr.registration_list);
......
...@@ -1178,14 +1178,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) ...@@ -1178,14 +1178,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd)
" emulation is not supported\n"); " emulation is not supported\n");
return TCM_INVALID_CDB_FIELD; return TCM_INVALID_CDB_FIELD;
} }
/*
* Used to determine when ORDERED commands should go from
* Dormant to Active status.
*/
cmd->se_ordered_id = atomic_inc_return(&dev->dev_ordered_id);
pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n",
cmd->se_ordered_id, cmd->sam_task_attr,
dev->transport->name);
return 0; return 0;
} }
...@@ -1773,16 +1766,14 @@ static bool target_handle_task_attr(struct se_cmd *cmd) ...@@ -1773,16 +1766,14 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
*/ */
switch (cmd->sam_task_attr) { switch (cmd->sam_task_attr) {
case TCM_HEAD_TAG: case TCM_HEAD_TAG:
pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x, " pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x\n",
"se_ordered_id: %u\n", cmd->t_task_cdb[0]);
cmd->t_task_cdb[0], cmd->se_ordered_id);
return false; return false;
case TCM_ORDERED_TAG: case TCM_ORDERED_TAG:
atomic_inc_mb(&dev->dev_ordered_sync); atomic_inc_mb(&dev->dev_ordered_sync);
pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, " pr_debug("Added ORDERED for CDB: 0x%02x to ordered list\n",
" se_ordered_id: %u\n", cmd->t_task_cdb[0]);
cmd->t_task_cdb[0], cmd->se_ordered_id);
/* /*
* Execute an ORDERED command if no other older commands * Execute an ORDERED command if no other older commands
...@@ -1806,10 +1797,8 @@ static bool target_handle_task_attr(struct se_cmd *cmd) ...@@ -1806,10 +1797,8 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
list_add_tail(&cmd->se_delayed_node, &dev->delayed_cmd_list); list_add_tail(&cmd->se_delayed_node, &dev->delayed_cmd_list);
spin_unlock(&dev->delayed_cmd_lock); spin_unlock(&dev->delayed_cmd_lock);
pr_debug("Added CDB: 0x%02x Task Attr: 0x%02x to" pr_debug("Added CDB: 0x%02x Task Attr: 0x%02x to delayed CMD listn",
" delayed CMD list, se_ordered_id: %u\n", cmd->t_task_cdb[0], cmd->sam_task_attr);
cmd->t_task_cdb[0], cmd->sam_task_attr,
cmd->se_ordered_id);
return true; return true;
} }
...@@ -1894,20 +1883,18 @@ static void transport_complete_task_attr(struct se_cmd *cmd) ...@@ -1894,20 +1883,18 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { if (cmd->sam_task_attr == TCM_SIMPLE_TAG) {
atomic_dec_mb(&dev->simple_cmds); atomic_dec_mb(&dev->simple_cmds);
dev->dev_cur_ordered_id++; dev->dev_cur_ordered_id++;
pr_debug("Incremented dev->dev_cur_ordered_id: %u for" pr_debug("Incremented dev->dev_cur_ordered_id: %u for SIMPLE\n",
" SIMPLE: %u\n", dev->dev_cur_ordered_id, dev->dev_cur_ordered_id);
cmd->se_ordered_id);
} else if (cmd->sam_task_attr == TCM_HEAD_TAG) { } else if (cmd->sam_task_attr == TCM_HEAD_TAG) {
dev->dev_cur_ordered_id++; dev->dev_cur_ordered_id++;
pr_debug("Incremented dev_cur_ordered_id: %u for" pr_debug("Incremented dev_cur_ordered_id: %u for HEAD_OF_QUEUE\n",
" HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, dev->dev_cur_ordered_id);
cmd->se_ordered_id);
} else if (cmd->sam_task_attr == TCM_ORDERED_TAG) { } else if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
atomic_dec_mb(&dev->dev_ordered_sync); atomic_dec_mb(&dev->dev_ordered_sync);
dev->dev_cur_ordered_id++; dev->dev_cur_ordered_id++;
pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n",
" %u\n", dev->dev_cur_ordered_id, cmd->se_ordered_id); dev->dev_cur_ordered_id);
} }
target_restart_delayed_cmds(dev); target_restart_delayed_cmds(dev);
......
...@@ -454,7 +454,6 @@ struct se_cmd { ...@@ -454,7 +454,6 @@ struct se_cmd {
unsigned unknown_data_length:1; unsigned unknown_data_length:1;
/* See se_cmd_flags_table */ /* See se_cmd_flags_table */
u32 se_cmd_flags; u32 se_cmd_flags;
u32 se_ordered_id;
/* Total size in bytes associated with command */ /* Total size in bytes associated with command */
u32 data_length; u32 data_length;
u32 residual_count; u32 residual_count;
...@@ -744,7 +743,6 @@ struct se_device { ...@@ -744,7 +743,6 @@ struct se_device {
atomic_long_t write_bytes; atomic_long_t write_bytes;
/* Active commands on this virtual SE device */ /* Active commands on this virtual SE device */
atomic_t simple_cmds; atomic_t simple_cmds;
atomic_t dev_ordered_id;
atomic_t dev_ordered_sync; atomic_t dev_ordered_sync;
atomic_t dev_qf_count; atomic_t dev_qf_count;
u32 export_count; u32 export_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment