From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933457AbcFHWwJ (ORCPT ); Wed, 8 Jun 2016 18:52:09 -0400 Received: from casper.infradead.org ([85.118.1.10]:59929 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933441AbcFHWwG (ORCPT ); Wed, 8 Jun 2016 18:52:06 -0400 Date: Wed, 8 Jun 2016 23:52:00 +0100 (BST) From: James Simmons To: Binoy Jayan cc: Greg Kroah-Hartman , Oleg Drokin , Andreas Dilger , lustre-devel@lists.lustre.org, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: Re: [PATCH 2/2] staging: lustre: lnet: Replace semaphore ln_rc_signal with completion In-Reply-To: <1465372242-7116-3-git-send-email-binoy.jayan@linaro.org> Message-ID: References: <1465372242-7116-1-git-send-email-binoy.jayan@linaro.org> <1465372242-7116-3-git-send-email-binoy.jayan@linaro.org> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_235200_709430_A554EE7D X-CRM114-Status: GOOD ( 17.27 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 No problems in testing. Acked-by: James Simmons > --- > 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 > #include > #include > +#include > > #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 > #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 >