All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] wait_for_free_request needs to wait on credits returned by server for SMB2
Date: Thu, 17 Mar 2011 10:36:08 -0400	[thread overview]
Message-ID: <20110317143608.GC3295@infradead.org> (raw)
In-Reply-To: <AANLkTimsJ+vQm7XuVk2NHneRc04CeWebuG3jsLxML4sd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

>  #ifdef CONFIG_CIFS_STATS2
>  			atomic_inc(&server->num_waiters);
> @@ -283,6 +284,20 @@ static int wait_for_free_request(struct
> TCP_Server_Info *server,
>  			atomic_dec(&server->num_waiters);
>  #endif
>  			spin_lock(&GlobalMid_Lock);
> +#ifdef CONFIG_CIFS_SMB2
> +		} else if (server->is_smb2 &&
> +			  (atomic_read(&server->credits) < 1)) {
> +			spin_unlock(&GlobalMid_Lock);
> +#ifdef CONFIG_CIFS_STATS2
> +			atomic_inc(&server->num_waiters);
> +#endif
> +			wait_event(server->request_q,
> +				   atomic_read(&server->credits) > 0);
> +#ifdef CONFIG_CIFS_STATS2
> +			atomic_dec(&server->num_waiters);
> +#endif
> +			spin_lock(&GlobalMid_Lock);
> +#endif /* CONFIG_CIFS_SMB2 */

This ifdef mania is madness.  Please make sure to hide the stats
and smb2 code in properly abstracted helpers that get compiled out if
not actually used.

  parent reply	other threads:[~2011-03-17 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-12 23:48 [PATCH] wait_for_free_request needs to wait on credits returned by server for SMB2 Steve French
     [not found] ` <AANLkTimsJ+vQm7XuVk2NHneRc04CeWebuG3jsLxML4sd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-17 14:36   ` Christoph Hellwig [this message]
     [not found]     ` <20110317143608.GC3295-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2011-03-17 14:43       ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110317143608.GC3295@infradead.org \
    --to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.