aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-04-29 06:52:43 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-02 23:42:07 -0400
commit146f9f65bd13f56665205aed7205d531c810cb35 (patch)
tree138417836966c26ad213a77b958b404c89c5b39e /fs/cifs
parent2a2047bc94d0efc316401170c3d078d9edc20dc4 (diff)
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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 8b75a8ec90b4..bfbf3235a69b 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -617,59 +617,59 @@ incomplete_rcv:
617 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { 617 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
618 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 618 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
619 619
620 if ((mid_entry->mid == smb_buffer->Mid) && 620 if (mid_entry->mid != smb_buffer->Mid ||
621 (mid_entry->midState == MID_REQUEST_SUBMITTED) && 621 mid_entry->midState != MID_REQUEST_SUBMITTED ||
622 (mid_entry->command == smb_buffer->Command)) { 622 mid_entry->command != smb_buffer->Command) {
623 if (length == 0 && 623 mid_entry = NULL;
624 check2ndT2(smb_buffer, server->maxBuf) > 0) { 624 continue;
625 /* We have a multipart transact2 resp */ 625 }
626 isMultiRsp = true; 626
627 if (mid_entry->resp_buf) { 627 if (length == 0 &&
628 /* merge response - fix up 1st*/ 628 check2ndT2(smb_buffer, server->maxBuf) > 0) {
629 if (coalesce_t2(smb_buffer, 629 /* We have a multipart transact2 resp */
630 isMultiRsp = true;
631 if (mid_entry->resp_buf) {
632 /* merge response - fix up 1st*/
633 if (coalesce_t2(smb_buffer,
630 mid_entry->resp_buf)) { 634 mid_entry->resp_buf)) {
631 mid_entry->multiRsp = 635 mid_entry->multiRsp = true;
632 true; 636 break;
633 break;
634 } else {
635 /* all parts received */
636 mid_entry->multiEnd =
637 true;
638 goto multi_t2_fnd;
639 }
640 } else { 637 } else {
641 if (!isLargeBuf) { 638 /* all parts received */
642 cERROR(1, "1st trans2 resp needs bigbuf"); 639 mid_entry->multiEnd = true;
643 /* BB maybe we can fix this up, switch 640 goto multi_t2_fnd;
644 to already allocated large buffer? */ 641 }
645 } else { 642 } else {
646 /* Have first buffer */ 643 if (!isLargeBuf) {
647 mid_entry->resp_buf = 644 /*
648 smb_buffer; 645 * FIXME: switch to already
649 mid_entry->largeBuf = 646 * allocated largebuf?
650 true; 647 */
651 bigbuf = NULL; 648 cERROR(1, "1st trans2 resp "
652 } 649 "needs bigbuf");
650 } else {
651 /* Have first buffer */
652 mid_entry->resp_buf =
653 smb_buffer;
654 mid_entry->largeBuf = true;
655 bigbuf = NULL;
653 } 656 }
654 break;
655 } 657 }
656 mid_entry->resp_buf = smb_buffer; 658 break;
657 mid_entry->largeBuf = isLargeBuf; 659 }
660 mid_entry->resp_buf = smb_buffer;
661 mid_entry->largeBuf = isLargeBuf;
658multi_t2_fnd: 662multi_t2_fnd:
659 if (length == 0) 663 if (length == 0)
660 mid_entry->midState = 664 mid_entry->midState = MID_RESPONSE_RECEIVED;
661 MID_RESPONSE_RECEIVED; 665 else
662 else 666 mid_entry->midState = MID_RESPONSE_MALFORMED;
663 mid_entry->midState =
664 MID_RESPONSE_MALFORMED;
665#ifdef CONFIG_CIFS_STATS2 667#ifdef CONFIG_CIFS_STATS2
666 mid_entry->when_received = jiffies; 668 mid_entry->when_received = jiffies;
667#endif 669#endif
668 list_del_init(&mid_entry->qhead); 670 list_del_init(&mid_entry->qhead);
669 mid_entry->callback(mid_entry); 671 mid_entry->callback(mid_entry);
670 break; 672 break;
671 }
672 mid_entry = NULL;
673 } 673 }
674 spin_unlock(&GlobalMid_Lock); 674 spin_unlock(&GlobalMid_Lock);
675 675