mirror of
https://github.com/SCST-project/scst.git
synced 2026-06-09 23:22:33 +00:00
scst: Increase tgt_dev_cmd_count by one
This patch does not change any functionality. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8465 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+2
-2
@@ -3156,7 +3156,7 @@ struct scst_tgt_dev {
|
||||
*/
|
||||
int tgt_dev_dif_guard_format;
|
||||
|
||||
/* How many cmds alive on this dev in this session */
|
||||
/* One more than the number of commands associated with this tgt_dev. */
|
||||
atomic_t tgt_dev_cmd_count ____cacheline_aligned_in_smp;
|
||||
|
||||
/* ALUA command filter */
|
||||
@@ -4776,7 +4776,7 @@ static inline int scst_cmd_get_block_size(struct scst_cmd *cmd)
|
||||
static inline unsigned int scst_get_active_cmd_count(struct scst_cmd *cmd)
|
||||
{
|
||||
if (likely(cmd->tgt_dev != NULL))
|
||||
return atomic_read(&cmd->tgt_dev->tgt_dev_cmd_count);
|
||||
return atomic_read(&cmd->tgt_dev->tgt_dev_cmd_count) - 1;
|
||||
else
|
||||
return (unsigned int)-1;
|
||||
}
|
||||
|
||||
+3
-1
@@ -5373,7 +5373,7 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
|
||||
atomic_set(&tgt_dev->tgt_dev_dif_guard_failed_dev, 0);
|
||||
|
||||
tgt_dev->sess = sess;
|
||||
atomic_set(&tgt_dev->tgt_dev_cmd_count, 0);
|
||||
atomic_set(&tgt_dev->tgt_dev_cmd_count, 1);
|
||||
if (acg_dev->acg->acg_black_hole_type != SCST_ACG_BLACK_HOLE_NONE)
|
||||
set_bit(SCST_TGT_DEV_BLACK_HOLE, &tgt_dev->tgt_dev_flags);
|
||||
else
|
||||
@@ -5552,6 +5552,8 @@ static void scst_del_tgt_dev(struct scst_tgt_dev *tgt_dev)
|
||||
list_del_rcu(&tgt_dev->sess_tgt_dev_list_entry);
|
||||
|
||||
scst_tgt_dev_sysfs_del(tgt_dev);
|
||||
|
||||
atomic_dec(&tgt_dev->tgt_dev_cmd_count);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -607,7 +607,7 @@ static void scst_pr_abort_reg(struct scst_device *dev,
|
||||
|
||||
TRACE_PR("Aborting %d commands for %s/%d (reg %p, key 0x%016llx, "
|
||||
"tgt_dev %p, sess %p)",
|
||||
atomic_read(®->tgt_dev->tgt_dev_cmd_count),
|
||||
atomic_read(®->tgt_dev->tgt_dev_cmd_count) - 1,
|
||||
debug_transport_id_to_initiator_name(reg->transport_id),
|
||||
reg->rel_tgt_id, reg, be64_to_cpu(reg->key), reg->tgt_dev,
|
||||
sess);
|
||||
|
||||
@@ -4152,7 +4152,8 @@ static ssize_t scst_tgt_dev_active_commands_show(struct kobject *kobj,
|
||||
|
||||
tgt_dev = container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
||||
|
||||
pos = sprintf(buf, "%d\n", atomic_read(&tgt_dev->tgt_dev_cmd_count));
|
||||
pos = sprintf(buf, "%d\n",
|
||||
atomic_read(&tgt_dev->tgt_dev_cmd_count) - 1);
|
||||
|
||||
return pos;
|
||||
}
|
||||
@@ -4486,6 +4487,7 @@ static int scst_sysfs_sess_get_active_commands(struct scst_session *sess)
|
||||
list_for_each_entry_rcu(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
active_cmds += atomic_read(&tgt_dev->tgt_dev_cmd_count);
|
||||
active_cmds--;
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
Reference in New Issue
Block a user