diff options
author | Pavel Shilovsky <piastry@etersoft.ru> | 2012-03-23 14:28:03 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2012-03-23 14:28:03 -0400 |
commit | 7c9421e1a9ce8d17816f480c3a5b4f2609442cd5 (patch) | |
tree | 6131acccc9898629df21a5c5a3e75ccf717bf947 /fs/cifs/transport.c | |
parent | 243d04b6e6de7fd08578fffd28b890c0200a2ca5 (diff) |
CIFS: Change mid_q_entry structure fields
to be protocol-unspecific and big enough to keep both CIFS
and SMB2 values.
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 66b4edec0e8e..0961336513d5 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -60,8 +60,8 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) | |||
60 | memset(temp, 0, sizeof(struct mid_q_entry)); | 60 | memset(temp, 0, sizeof(struct mid_q_entry)); |
61 | temp->mid = smb_buffer->Mid; /* always LE */ | 61 | temp->mid = smb_buffer->Mid; /* always LE */ |
62 | temp->pid = current->pid; | 62 | temp->pid = current->pid; |
63 | temp->command = smb_buffer->Command; | 63 | temp->command = cpu_to_le16(smb_buffer->Command); |
64 | cFYI(1, "For smb_command %d", temp->command); | 64 | cFYI(1, "For smb_command %d", smb_buffer->Command); |
65 | /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ | 65 | /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ |
66 | /* when mid allocated can be before when sent */ | 66 | /* when mid allocated can be before when sent */ |
67 | temp->when_alloc = jiffies; | 67 | temp->when_alloc = jiffies; |
@@ -75,7 +75,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | atomic_inc(&midCount); | 77 | atomic_inc(&midCount); |
78 | temp->midState = MID_REQUEST_ALLOCATED; | 78 | temp->mid_state = MID_REQUEST_ALLOCATED; |
79 | return temp; | 79 | return temp; |
80 | } | 80 | } |
81 | 81 | ||
@@ -85,9 +85,9 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) | |||
85 | #ifdef CONFIG_CIFS_STATS2 | 85 | #ifdef CONFIG_CIFS_STATS2 |
86 | unsigned long now; | 86 | unsigned long now; |
87 | #endif | 87 | #endif |
88 | midEntry->midState = MID_FREE; | 88 | midEntry->mid_state = MID_FREE; |
89 | atomic_dec(&midCount); | 89 | atomic_dec(&midCount); |
90 | if (midEntry->largeBuf) | 90 | if (midEntry->large_buf) |
91 | cifs_buf_release(midEntry->resp_buf); | 91 | cifs_buf_release(midEntry->resp_buf); |
92 | else | 92 | else |
93 | cifs_small_buf_release(midEntry->resp_buf); | 93 | cifs_small_buf_release(midEntry->resp_buf); |
@@ -97,8 +97,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) | |||
97 | something is wrong, unless it is quite a slow link or server */ | 97 | something is wrong, unless it is quite a slow link or server */ |
98 | if ((now - midEntry->when_alloc) > HZ) { | 98 | if ((now - midEntry->when_alloc) > HZ) { |
99 | if ((cifsFYI & CIFS_TIMER) && | 99 | if ((cifsFYI & CIFS_TIMER) && |
100 | (midEntry->command != SMB_COM_LOCKING_ANDX)) { | 100 | (midEntry->command != cpu_to_le16(SMB_COM_LOCKING_ANDX))) { |
101 | printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %d", | 101 | printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %llu", |
102 | midEntry->command, midEntry->mid); | 102 | midEntry->command, midEntry->mid); |
103 | printk(" A: 0x%lx S: 0x%lx R: 0x%lx\n", | 103 | printk(" A: 0x%lx S: 0x%lx R: 0x%lx\n", |
104 | now - midEntry->when_alloc, | 104 | now - midEntry->when_alloc, |
@@ -341,7 +341,7 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ) | |||
341 | int error; | 341 | int error; |
342 | 342 | ||
343 | error = wait_event_freezekillable(server->response_q, | 343 | error = wait_event_freezekillable(server->response_q, |
344 | midQ->midState != MID_REQUEST_SUBMITTED); | 344 | midQ->mid_state != MID_REQUEST_SUBMITTED); |
345 | if (error < 0) | 345 | if (error < 0) |
346 | return -ERESTARTSYS; | 346 | return -ERESTARTSYS; |
347 | 347 | ||
@@ -404,7 +404,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov, | |||
404 | mid->receive = receive; | 404 | mid->receive = receive; |
405 | mid->callback = callback; | 405 | mid->callback = callback; |
406 | mid->callback_data = cbdata; | 406 | mid->callback_data = cbdata; |
407 | mid->midState = MID_REQUEST_SUBMITTED; | 407 | mid->mid_state = MID_REQUEST_SUBMITTED; |
408 | 408 | ||
409 | cifs_in_send_inc(server); | 409 | cifs_in_send_inc(server); |
410 | rc = smb_sendv(server, iov, nvec); | 410 | rc = smb_sendv(server, iov, nvec); |
@@ -454,11 +454,11 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) | |||
454 | { | 454 | { |
455 | int rc = 0; | 455 | int rc = 0; |
456 | 456 | ||
457 | cFYI(1, "%s: cmd=%d mid=%d state=%d", __func__, mid->command, | 457 | cFYI(1, "%s: cmd=%d mid=%llu state=%d", __func__, |
458 | mid->mid, mid->midState); | 458 | le16_to_cpu(mid->command), mid->mid, mid->mid_state); |
459 | 459 | ||
460 | spin_lock(&GlobalMid_Lock); | 460 | spin_lock(&GlobalMid_Lock); |
461 | switch (mid->midState) { | 461 | switch (mid->mid_state) { |
462 | case MID_RESPONSE_RECEIVED: | 462 | case MID_RESPONSE_RECEIVED: |
463 | spin_unlock(&GlobalMid_Lock); | 463 | spin_unlock(&GlobalMid_Lock); |
464 | return rc; | 464 | return rc; |
@@ -473,8 +473,8 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) | |||
473 | break; | 473 | break; |
474 | default: | 474 | default: |
475 | list_del_init(&mid->qhead); | 475 | list_del_init(&mid->qhead); |
476 | cERROR(1, "%s: invalid mid state mid=%d state=%d", __func__, | 476 | cERROR(1, "%s: invalid mid state mid=%llu state=%d", __func__, |
477 | mid->mid, mid->midState); | 477 | mid->mid, mid->mid_state); |
478 | rc = -EIO; | 478 | rc = -EIO; |
479 | } | 479 | } |
480 | spin_unlock(&GlobalMid_Lock); | 480 | spin_unlock(&GlobalMid_Lock); |
@@ -616,7 +616,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
616 | return rc; | 616 | return rc; |
617 | } | 617 | } |
618 | 618 | ||
619 | midQ->midState = MID_REQUEST_SUBMITTED; | 619 | midQ->mid_state = MID_REQUEST_SUBMITTED; |
620 | cifs_in_send_inc(ses->server); | 620 | cifs_in_send_inc(ses->server); |
621 | rc = smb_sendv(ses->server, iov, n_vec); | 621 | rc = smb_sendv(ses->server, iov, n_vec); |
622 | cifs_in_send_dec(ses->server); | 622 | cifs_in_send_dec(ses->server); |
@@ -638,7 +638,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
638 | if (rc != 0) { | 638 | if (rc != 0) { |
639 | send_nt_cancel(ses->server, (struct smb_hdr *)buf, midQ); | 639 | send_nt_cancel(ses->server, (struct smb_hdr *)buf, midQ); |
640 | spin_lock(&GlobalMid_Lock); | 640 | spin_lock(&GlobalMid_Lock); |
641 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 641 | if (midQ->mid_state == MID_REQUEST_SUBMITTED) { |
642 | midQ->callback = DeleteMidQEntry; | 642 | midQ->callback = DeleteMidQEntry; |
643 | spin_unlock(&GlobalMid_Lock); | 643 | spin_unlock(&GlobalMid_Lock); |
644 | cifs_small_buf_release(buf); | 644 | cifs_small_buf_release(buf); |
@@ -656,7 +656,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
656 | return rc; | 656 | return rc; |
657 | } | 657 | } |
658 | 658 | ||
659 | if (!midQ->resp_buf || midQ->midState != MID_RESPONSE_RECEIVED) { | 659 | if (!midQ->resp_buf || midQ->mid_state != MID_RESPONSE_RECEIVED) { |
660 | rc = -EIO; | 660 | rc = -EIO; |
661 | cFYI(1, "Bad MID state?"); | 661 | cFYI(1, "Bad MID state?"); |
662 | goto out; | 662 | goto out; |
@@ -665,7 +665,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
665 | buf = (char *)midQ->resp_buf; | 665 | buf = (char *)midQ->resp_buf; |
666 | iov[0].iov_base = buf; | 666 | iov[0].iov_base = buf; |
667 | iov[0].iov_len = get_rfc1002_length(buf) + 4; | 667 | iov[0].iov_len = get_rfc1002_length(buf) + 4; |
668 | if (midQ->largeBuf) | 668 | if (midQ->large_buf) |
669 | *pRespBufType = CIFS_LARGE_BUFFER; | 669 | *pRespBufType = CIFS_LARGE_BUFFER; |
670 | else | 670 | else |
671 | *pRespBufType = CIFS_SMALL_BUFFER; | 671 | *pRespBufType = CIFS_SMALL_BUFFER; |
@@ -737,7 +737,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
737 | goto out; | 737 | goto out; |
738 | } | 738 | } |
739 | 739 | ||
740 | midQ->midState = MID_REQUEST_SUBMITTED; | 740 | midQ->mid_state = MID_REQUEST_SUBMITTED; |
741 | 741 | ||
742 | cifs_in_send_inc(ses->server); | 742 | cifs_in_send_inc(ses->server); |
743 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); | 743 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); |
@@ -755,7 +755,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
755 | if (rc != 0) { | 755 | if (rc != 0) { |
756 | send_nt_cancel(ses->server, in_buf, midQ); | 756 | send_nt_cancel(ses->server, in_buf, midQ); |
757 | spin_lock(&GlobalMid_Lock); | 757 | spin_lock(&GlobalMid_Lock); |
758 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 758 | if (midQ->mid_state == MID_REQUEST_SUBMITTED) { |
759 | /* no longer considered to be "in-flight" */ | 759 | /* no longer considered to be "in-flight" */ |
760 | midQ->callback = DeleteMidQEntry; | 760 | midQ->callback = DeleteMidQEntry; |
761 | spin_unlock(&GlobalMid_Lock); | 761 | spin_unlock(&GlobalMid_Lock); |
@@ -772,7 +772,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
772 | } | 772 | } |
773 | 773 | ||
774 | if (!midQ->resp_buf || !out_buf || | 774 | if (!midQ->resp_buf || !out_buf || |
775 | midQ->midState != MID_RESPONSE_RECEIVED) { | 775 | midQ->mid_state != MID_RESPONSE_RECEIVED) { |
776 | rc = -EIO; | 776 | rc = -EIO; |
777 | cERROR(1, "Bad MID state?"); | 777 | cERROR(1, "Bad MID state?"); |
778 | goto out; | 778 | goto out; |
@@ -871,7 +871,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
871 | return rc; | 871 | return rc; |
872 | } | 872 | } |
873 | 873 | ||
874 | midQ->midState = MID_REQUEST_SUBMITTED; | 874 | midQ->mid_state = MID_REQUEST_SUBMITTED; |
875 | cifs_in_send_inc(ses->server); | 875 | cifs_in_send_inc(ses->server); |
876 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); | 876 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); |
877 | cifs_in_send_dec(ses->server); | 877 | cifs_in_send_dec(ses->server); |
@@ -885,13 +885,13 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
885 | 885 | ||
886 | /* Wait for a reply - allow signals to interrupt. */ | 886 | /* Wait for a reply - allow signals to interrupt. */ |
887 | rc = wait_event_interruptible(ses->server->response_q, | 887 | rc = wait_event_interruptible(ses->server->response_q, |
888 | (!(midQ->midState == MID_REQUEST_SUBMITTED)) || | 888 | (!(midQ->mid_state == MID_REQUEST_SUBMITTED)) || |
889 | ((ses->server->tcpStatus != CifsGood) && | 889 | ((ses->server->tcpStatus != CifsGood) && |
890 | (ses->server->tcpStatus != CifsNew))); | 890 | (ses->server->tcpStatus != CifsNew))); |
891 | 891 | ||
892 | /* Were we interrupted by a signal ? */ | 892 | /* Were we interrupted by a signal ? */ |
893 | if ((rc == -ERESTARTSYS) && | 893 | if ((rc == -ERESTARTSYS) && |
894 | (midQ->midState == MID_REQUEST_SUBMITTED) && | 894 | (midQ->mid_state == MID_REQUEST_SUBMITTED) && |
895 | ((ses->server->tcpStatus == CifsGood) || | 895 | ((ses->server->tcpStatus == CifsGood) || |
896 | (ses->server->tcpStatus == CifsNew))) { | 896 | (ses->server->tcpStatus == CifsNew))) { |
897 | 897 | ||
@@ -921,7 +921,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
921 | if (rc) { | 921 | if (rc) { |
922 | send_nt_cancel(ses->server, in_buf, midQ); | 922 | send_nt_cancel(ses->server, in_buf, midQ); |
923 | spin_lock(&GlobalMid_Lock); | 923 | spin_lock(&GlobalMid_Lock); |
924 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 924 | if (midQ->mid_state == MID_REQUEST_SUBMITTED) { |
925 | /* no longer considered to be "in-flight" */ | 925 | /* no longer considered to be "in-flight" */ |
926 | midQ->callback = DeleteMidQEntry; | 926 | midQ->callback = DeleteMidQEntry; |
927 | spin_unlock(&GlobalMid_Lock); | 927 | spin_unlock(&GlobalMid_Lock); |
@@ -939,7 +939,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
939 | return rc; | 939 | return rc; |
940 | 940 | ||
941 | /* rcvd frame is ok */ | 941 | /* rcvd frame is ok */ |
942 | if (out_buf == NULL || midQ->midState != MID_RESPONSE_RECEIVED) { | 942 | if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_RECEIVED) { |
943 | rc = -EIO; | 943 | rc = -EIO; |
944 | cERROR(1, "Bad MID state?"); | 944 | cERROR(1, "Bad MID state?"); |
945 | goto out; | 945 | goto out; |