cifs: clean up accesses to midCount
It's an atomic_t and the code accesses the "counter" field in it directly instead of using atomic_read(). It also is sometimes accessed under a spinlock and sometimes not. Move it out of the spinlock since we don't need belt-and-suspenders for something that's just informational. Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de> Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
c5797a945c
commit
8097531a5c
@ -331,7 +331,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
|
|||||||
atomic_read(&totSmBufAllocCount));
|
atomic_read(&totSmBufAllocCount));
|
||||||
#endif /* CONFIG_CIFS_STATS2 */
|
#endif /* CONFIG_CIFS_STATS2 */
|
||||||
|
|
||||||
seq_printf(m, "Operations (MIDs): %d\n", midCount.counter);
|
seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&midCount));
|
||||||
seq_printf(m,
|
seq_printf(m,
|
||||||
"\n%d session %d share reconnects\n",
|
"\n%d session %d share reconnects\n",
|
||||||
tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
|
tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
|
||||||
|
@ -628,7 +628,7 @@ multi_t2_fnd:
|
|||||||
} else if (!is_valid_oplock_break(smb_buffer, server) &&
|
} else if (!is_valid_oplock_break(smb_buffer, server) &&
|
||||||
!isMultiRsp) {
|
!isMultiRsp) {
|
||||||
cERROR(1, "No task to wake, unknown frame received! "
|
cERROR(1, "No task to wake, unknown frame received! "
|
||||||
"NumMids %d", midCount.counter);
|
"NumMids %d", atomic_read(&midCount));
|
||||||
cifs_dump_mem("Received Data is: ", (char *)smb_buffer,
|
cifs_dump_mem("Received Data is: ", (char *)smb_buffer,
|
||||||
sizeof(struct smb_hdr));
|
sizeof(struct smb_hdr));
|
||||||
#ifdef CONFIG_CIFS_DEBUG2
|
#ifdef CONFIG_CIFS_DEBUG2
|
||||||
|
@ -61,10 +61,10 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
|
|||||||
temp->tsk = current;
|
temp->tsk = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
list_add_tail(&temp->qhead, &server->pending_mid_q);
|
|
||||||
atomic_inc(&midCount);
|
atomic_inc(&midCount);
|
||||||
temp->midState = MID_REQUEST_ALLOCATED;
|
temp->midState = MID_REQUEST_ALLOCATED;
|
||||||
|
spin_lock(&GlobalMid_Lock);
|
||||||
|
list_add_tail(&temp->qhead, &server->pending_mid_q);
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
@ -78,8 +78,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
|
|||||||
spin_lock(&GlobalMid_Lock);
|
spin_lock(&GlobalMid_Lock);
|
||||||
midEntry->midState = MID_FREE;
|
midEntry->midState = MID_FREE;
|
||||||
list_del(&midEntry->qhead);
|
list_del(&midEntry->qhead);
|
||||||
atomic_dec(&midCount);
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
atomic_dec(&midCount);
|
||||||
if (midEntry->largeBuf)
|
if (midEntry->largeBuf)
|
||||||
cifs_buf_release(midEntry->resp_buf);
|
cifs_buf_release(midEntry->resp_buf);
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user