locking/atomic, kref: Add kref_read()
Since we need to change the implementation, stop exposing internals. Provide kref_read() to read the current reference count; typically used for debug messages. Kills two anti-patterns: atomic_read(&kref->refcount) kref->refcount.counter Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
committed by
Ingo Molnar
parent
1e24edca05
commit
2c935bc572
@@ -371,7 +371,7 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
|
||||
*/
|
||||
pr_debug("write_pending aborted cmd[%p] refcount %d "
|
||||
"transport_state %x, t_state %x, se_cmd_flags %x\n",
|
||||
cmd,cmd->se_cmd.cmd_kref.refcount.counter,
|
||||
cmd, kref_read(&cmd->se_cmd.cmd_kref),
|
||||
cmd->se_cmd.transport_state,
|
||||
cmd->se_cmd.t_state,
|
||||
cmd->se_cmd.se_cmd_flags);
|
||||
@@ -584,7 +584,7 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
|
||||
*/
|
||||
pr_debug("queue_data_in aborted cmd[%p] refcount %d "
|
||||
"transport_state %x, t_state %x, se_cmd_flags %x\n",
|
||||
cmd,cmd->se_cmd.cmd_kref.refcount.counter,
|
||||
cmd, kref_read(&cmd->se_cmd.cmd_kref),
|
||||
cmd->se_cmd.transport_state,
|
||||
cmd->se_cmd.t_state,
|
||||
cmd->se_cmd.se_cmd_flags);
|
||||
|
||||
Reference in New Issue
Block a user