mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-29 19:42:58 +00:00
scst: Revert "Increase tgt_dev_cmd_count by one" (r8465)
Because of the previous patch, r8465 is no longer necessary. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8518 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+2
-2
@@ -3161,7 +3161,7 @@ struct scst_tgt_dev {
|
||||
*/
|
||||
int tgt_dev_dif_guard_format;
|
||||
|
||||
/* One more than the number of commands associated with this tgt_dev. */
|
||||
/* How many cmds alive on this dev in this session */
|
||||
atomic_t tgt_dev_cmd_count ____cacheline_aligned_in_smp;
|
||||
|
||||
/* ALUA command filter */
|
||||
@@ -4781,7 +4781,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) - 1;
|
||||
return atomic_read(&cmd->tgt_dev->tgt_dev_cmd_count);
|
||||
else
|
||||
return (unsigned int)-1;
|
||||
}
|
||||
|
||||
+1
-3
@@ -5359,7 +5359,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, 1);
|
||||
atomic_set(&tgt_dev->tgt_dev_cmd_count, 0);
|
||||
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
|
||||
@@ -5538,8 +5538,6 @@ 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) - 1,
|
||||
atomic_read(®->tgt_dev->tgt_dev_cmd_count),
|
||||
debug_transport_id_to_initiator_name(reg->transport_id),
|
||||
reg->rel_tgt_id, reg, be64_to_cpu(reg->key), reg->tgt_dev,
|
||||
sess);
|
||||
|
||||
@@ -4154,8 +4154,7 @@ 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) - 1);
|
||||
pos = sprintf(buf, "%d\n", atomic_read(&tgt_dev->tgt_dev_cmd_count));
|
||||
|
||||
return pos;
|
||||
}
|
||||
@@ -4489,7 +4488,6 @@ 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();
|
||||
|
||||
@@ -5027,9 +5027,8 @@ static int scst_translate_lun(struct scst_cmd *cmd)
|
||||
|
||||
rcu_read_lock();
|
||||
tgt_dev = scst_lookup_tgt_dev(cmd->sess, cmd->lun);
|
||||
if (tgt_dev &&
|
||||
!atomic_inc_not_zero(&tgt_dev->tgt_dev_cmd_count))
|
||||
tgt_dev = NULL;
|
||||
if (tgt_dev)
|
||||
atomic_inc(&tgt_dev->tgt_dev_cmd_count);
|
||||
rcu_read_unlock();
|
||||
|
||||
if (tgt_dev) {
|
||||
|
||||
Reference in New Issue
Block a user