From: James Simmons <jsimmons@infradead.org>
To: Binoy Jayan <binoy.jayan@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
lustre-devel@lists.lustre.org,
driverdev-devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 2/2] staging: lustre: lnet: Replace semaphore ln_rc_signal with completion
Date: Wed, 8 Jun 2016 23:52:00 +0100 (BST) [thread overview]
Message-ID: <alpine.LFD.2.20.1606082351370.30765@casper.infradead.org> (raw)
In-Reply-To: <1465372242-7116-3-git-send-email-binoy.jayan@linaro.org>
> The semaphore ln_rc_signal is used as completion, so convert it to
> struct completion. Semaphores are going away in the future.
>
> Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
No problems in testing.
Acked-by: James Simmons <jsimmons@infradead.org>
> ---
> drivers/staging/lustre/include/linux/lnet/lib-types.h | 3 ++-
> drivers/staging/lustre/lnet/lnet/router.c | 9 +++++----
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h
> index 24c4a08..7967b01 100644
> --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h
> +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h
> @@ -38,6 +38,7 @@
> #include <linux/kthread.h>
> #include <linux/uio.h>
> #include <linux/types.h>
> +#include <linux/completion.h>
>
> #include "types.h"
> #include "lnetctl.h"
> @@ -610,7 +611,7 @@ typedef struct {
> /* rcd ready for free */
> struct list_head ln_rcd_zombie;
> /* serialise startup/shutdown */
> - struct semaphore ln_rc_signal;
> + struct completion ln_rc_signal;
>
> struct mutex ln_api_mutex;
> struct mutex ln_lnd_mutex;
> diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
> index b01dc42..0635432 100644
> --- a/drivers/staging/lustre/lnet/lnet/router.c
> +++ b/drivers/staging/lustre/lnet/lnet/router.c
> @@ -18,6 +18,7 @@
> */
>
> #define DEBUG_SUBSYSTEM S_LNET
> +#include <linux/completion.h>
> #include "../../include/linux/lnet/lib-lnet.h"
>
> #define LNET_NRB_TINY_MIN 512 /* min value for each CPT */
> @@ -1065,7 +1066,7 @@ lnet_router_checker_start(void)
> return -EINVAL;
> }
>
> - sema_init(&the_lnet.ln_rc_signal, 0);
> + init_completion(&the_lnet.ln_rc_signal);
>
> rc = LNetEQAlloc(0, lnet_router_checker_event, &the_lnet.ln_rc_eqh);
> if (rc) {
> @@ -1079,7 +1080,7 @@ lnet_router_checker_start(void)
> rc = PTR_ERR(task);
> CERROR("Can't start router checker thread: %d\n", rc);
> /* block until event callback signals exit */
> - down(&the_lnet.ln_rc_signal);
> + wait_for_completion(&the_lnet.ln_rc_signal);
> rc = LNetEQFree(the_lnet.ln_rc_eqh);
> LASSERT(!rc);
> the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
> @@ -1112,7 +1113,7 @@ lnet_router_checker_stop(void)
> wake_up(&the_lnet.ln_rc_waitq);
>
> /* block until event callback signals exit */
> - down(&the_lnet.ln_rc_signal);
> + wait_for_completion(&the_lnet.ln_rc_signal);
> LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN);
>
> rc = LNetEQFree(the_lnet.ln_rc_eqh);
> @@ -1295,7 +1296,7 @@ rescan:
> lnet_prune_rc_data(1); /* wait for UNLINK */
>
> the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
> - up(&the_lnet.ln_rc_signal);
> + complete(&the_lnet.ln_rc_signal);
> /* The unlink event callback will signal final completion */
> return 0;
> }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
>
next prev parent reply other threads:[~2016-06-08 22:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 7:50 [PATCH 0/2] *** staging: lustre: Replace semaphore lock with mutex *** Binoy Jayan
2016-06-08 7:50 ` [PATCH 1/2] staging: lustre: lloop_device: Replace semaphore lo_sem with completion Binoy Jayan
2016-06-08 17:49 ` James Simmons
2016-06-08 7:50 ` [PATCH 2/2] staging: lustre: lnet: Replace semaphore ln_rc_signal " Binoy Jayan
2016-06-08 22:52 ` James Simmons [this message]
2016-06-08 17:46 ` [PATCH 0/2] *** staging: lustre: Replace semaphore lock with mutex *** James Simmons
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=alpine.LFD.2.20.1606082351370.30765@casper.infradead.org \
--to=jsimmons@infradead.org \
--cc=andreas.dilger@intel.com \
--cc=arnd@arndb.de \
--cc=binoy.jayan@linaro.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®