linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/2] staging: lustre: lloop_device: Replace semaphore lo_sem with completion
Date: Wed, 8 Jun 2016 18:49:04 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1606081846390.30765@casper.infradead.org> (raw)
In-Reply-To: <1465372242-7116-2-git-send-email-binoy.jayan@linaro.org>


> The semaphore 'lo_sem' in lloop_device is used as completion, so it
> should be written as one. Semaphores are going away in the future.
> 
> Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>

NAK. The lloop_device is about to get deleted.

> ---
>  drivers/staging/lustre/lustre/llite/lloop.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
> index 813a9a3..90b31ba 100644
> --- a/drivers/staging/lustre/lustre/llite/lloop.c
> +++ b/drivers/staging/lustre/lustre/llite/lloop.c
> @@ -131,7 +131,7 @@ struct lloop_device {
>  	struct bio		*lo_bio;
>  	struct bio		*lo_biotail;
>  	int			lo_state;
> -	struct semaphore	lo_sem;
> +	struct completion	lo_comp;
>  	struct mutex		lo_ctl_mutex;
>  	atomic_t	 lo_pending;
>  	wait_queue_head_t	  lo_bh_wait;
> @@ -423,9 +423,9 @@ static int loop_thread(void *data)
>  	lo->lo_pvec.ldp_offsets = lo->lo_requests[0].lrd_offsets;
>  
>  	/*
> -	 * up sem, we are running
> +	 * signal completion, we are running
>  	 */
> -	up(&lo->lo_sem);
> +	complete(&lo->lo_comp);
>  
>  	for (;;) {
>  		wait_event(lo->lo_bh_wait, loop_active(lo));
> @@ -466,7 +466,7 @@ static int loop_thread(void *data)
>  	cl_env_put(env, &refcheck);
>  
>  out:
> -	up(&lo->lo_sem);
> +	complete(&lo->lo_comp);
>  	return ret;
>  }
>  
> @@ -539,7 +539,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
>  	set_blocksize(bdev, lo->lo_blocksize);
>  
>  	kthread_run(loop_thread, lo, "lloop%d", lo->lo_number);
> -	down(&lo->lo_sem);
> +	wait_for_completion(&lo->lo_comp);
>  	return 0;
>  
>  out:
> @@ -568,7 +568,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,
>  	spin_unlock_irq(&lo->lo_lock);
>  	wake_up(&lo->lo_bh_wait);
>  
> -	down(&lo->lo_sem);
> +	wait_for_completion(&lo->lo_comp);
>  	lo->lo_backing_file = NULL;
>  	lo->lo_device = NULL;
>  	lo->lo_offset = 0;
> @@ -821,7 +821,7 @@ static int __init lloop_init(void)
>  			goto out_mem4;
>  
>  		mutex_init(&lo->lo_ctl_mutex);
> -		sema_init(&lo->lo_sem, 0);
> +		init_completion(&lo->lo_comp);
>  		init_waitqueue_head(&lo->lo_bh_wait);
>  		lo->lo_number = i;
>  		spin_lock_init(&lo->lo_lock);
> -- 
> 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
> 

  reply	other threads:[~2016-06-08 17:49 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 [this message]
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
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.1606081846390.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;
as well as URLs for NNTP newsgroup(s).