mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
cifs: refactor mid finding loop in cifs_demultiplex_thread
...to reduce the extreme indentation. This should introduce no behavioral changes. Cc: stable@kernel.org Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
2a2047bc94
commit
146f9f65bd
1 changed files with 47 additions and 47 deletions
|
@ -617,9 +617,13 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
|
|||
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
|
||||
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
|
||||
|
||||
if ((mid_entry->mid == smb_buffer->Mid) &&
|
||||
(mid_entry->midState == MID_REQUEST_SUBMITTED) &&
|
||||
(mid_entry->command == smb_buffer->Command)) {
|
||||
if (mid_entry->mid != smb_buffer->Mid ||
|
||||
mid_entry->midState != MID_REQUEST_SUBMITTED ||
|
||||
mid_entry->command != smb_buffer->Command) {
|
||||
mid_entry = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (length == 0 &&
|
||||
check2ndT2(smb_buffer, server->maxBuf) > 0) {
|
||||
/* We have a multipart transact2 resp */
|
||||
|
@ -628,26 +632,26 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
|
|||
/* merge response - fix up 1st*/
|
||||
if (coalesce_t2(smb_buffer,
|
||||
mid_entry->resp_buf)) {
|
||||
mid_entry->multiRsp =
|
||||
true;
|
||||
mid_entry->multiRsp = true;
|
||||
break;
|
||||
} else {
|
||||
/* all parts received */
|
||||
mid_entry->multiEnd =
|
||||
true;
|
||||
mid_entry->multiEnd = true;
|
||||
goto multi_t2_fnd;
|
||||
}
|
||||
} else {
|
||||
if (!isLargeBuf) {
|
||||
cERROR(1, "1st trans2 resp needs bigbuf");
|
||||
/* BB maybe we can fix this up, switch
|
||||
to already allocated large buffer? */
|
||||
/*
|
||||
* FIXME: switch to already
|
||||
* allocated largebuf?
|
||||
*/
|
||||
cERROR(1, "1st trans2 resp "
|
||||
"needs bigbuf");
|
||||
} else {
|
||||
/* Have first buffer */
|
||||
mid_entry->resp_buf =
|
||||
smb_buffer;
|
||||
mid_entry->largeBuf =
|
||||
true;
|
||||
mid_entry->largeBuf = true;
|
||||
bigbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -657,11 +661,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
|
|||
mid_entry->largeBuf = isLargeBuf;
|
||||
multi_t2_fnd:
|
||||
if (length == 0)
|
||||
mid_entry->midState =
|
||||
MID_RESPONSE_RECEIVED;
|
||||
mid_entry->midState = MID_RESPONSE_RECEIVED;
|
||||
else
|
||||
mid_entry->midState =
|
||||
MID_RESPONSE_MALFORMED;
|
||||
mid_entry->midState = MID_RESPONSE_MALFORMED;
|
||||
#ifdef CONFIG_CIFS_STATS2
|
||||
mid_entry->when_received = jiffies;
|
||||
#endif
|
||||
|
@ -669,8 +671,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
|
|||
mid_entry->callback(mid_entry);
|
||||
break;
|
||||
}
|
||||
mid_entry = NULL;
|
||||
}
|
||||
spin_unlock(&GlobalMid_Lock);
|
||||
|
||||
if (mid_entry != NULL) {
|
||||
|
|
Loading…
Reference in a new issue