diff mbox

[4/7] cifs: add ignore_pend flag to cifs_call_async

Message ID 1302694994-8303-5-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton April 13, 2011, 11:43 a.m. UTC
The current code always ignores the max_pending limit. Have it instead
only optionally ignore the pending limit. For CIFSSMBEcho, we need to
ignore it to make sure they always can go out. For async reads, writes
and potentially other calls, we need to respect it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifsproto.h |    2 +-
 fs/cifs/cifssmb.c   |    2 +-
 fs/cifs/transport.c |    5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

Comments

Pavel Shilovsky April 15, 2011, 8:48 a.m. UTC | #1
2011/4/13 Jeff Layton <jlayton@redhat.com>:
> The current code always ignores the max_pending limit. Have it instead
> only optionally ignore the pending limit. For CIFSSMBEcho, we need to
> ignore it to make sure they always can go out. For async reads, writes
> and potentially other calls, we need to respect it.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/cifsproto.h |    2 +-
>  fs/cifs/cifssmb.c   |    2 +-
>  fs/cifs/transport.c |    5 +++--
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
> index e255a2b..c621b45 100644
> --- a/fs/cifs/cifsproto.h
> +++ b/fs/cifs/cifsproto.h
> @@ -67,7 +67,7 @@ extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
>  extern int wait_for_free_request(struct TCP_Server_Info *sv, const int long_op);
>  extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
>                           unsigned int nvec, mid_callback_t *callback,
> -                          void *cbdata);
> +                          void *cbdata, bool ignore_pend);
>  extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
>                        struct smb_hdr * /* input */ ,
>                        struct smb_hdr * /* out */ ,
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 79e4881..33adc15 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -743,7 +743,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
>        iov.iov_base = smb;
>        iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
>
> -       rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server);
> +       rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server, true);
>        if (rc)
>                cFYI(1, "Echo request failed: %d", rc);
>
> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
> index a31c279..ad32b70 100644
> --- a/fs/cifs/transport.c
> +++ b/fs/cifs/transport.c
> @@ -350,13 +350,14 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
>  */
>  int
>  cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
> -               unsigned int nvec, mid_callback_t *callback, void *cbdata)
> +               unsigned int nvec, mid_callback_t *callback, void *cbdata,
> +               bool ignore_pend)
>  {
>        int rc;
>        struct mid_q_entry *mid;
>        struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
>
> -       rc = wait_for_free_request(server, CIFS_ASYNC_OP);
> +       rc = wait_for_free_request(server, ignore_pend ? CIFS_ASYNC_OP : 0);
>        if (rc)
>                return rc;
>
> --
> 1.7.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Looks right. Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
diff mbox

Patch

diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index e255a2b..c621b45 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -67,7 +67,7 @@  extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
 extern int wait_for_free_request(struct TCP_Server_Info *sv, const int long_op);
 extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
 			   unsigned int nvec, mid_callback_t *callback,
-			   void *cbdata);
+			   void *cbdata, bool ignore_pend);
 extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
 			struct smb_hdr * /* input */ ,
 			struct smb_hdr * /* out */ ,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 79e4881..33adc15 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -743,7 +743,7 @@  CIFSSMBEcho(struct TCP_Server_Info *server)
 	iov.iov_base = smb;
 	iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
 
-	rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server);
+	rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server, true);
 	if (rc)
 		cFYI(1, "Echo request failed: %d", rc);
 
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index a31c279..ad32b70 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -350,13 +350,14 @@  wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
  */
 int
 cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
-		unsigned int nvec, mid_callback_t *callback, void *cbdata)
+		unsigned int nvec, mid_callback_t *callback, void *cbdata,
+		bool ignore_pend)
 {
 	int rc;
 	struct mid_q_entry *mid;
 	struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
 
-	rc = wait_for_free_request(server, CIFS_ASYNC_OP);
+	rc = wait_for_free_request(server, ignore_pend ? CIFS_ASYNC_OP : 0);
 	if (rc)
 		return rc;