public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-kernel@vger.kernel.org, randy.dunlap@oracle.com,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	guenter.roeck@ericsson.com, johnpol@2ka.mipt.ru,
	thellstrom@vmware.com, linux-scsi@vger.kernel.org,
	JBottomley@parallels.com, lm-sensors@lm-sensors.org,
	airlied@redhat.com, paulmck@linux.vnet.ibm.com, naota@elisp.net,
	rtc-linux@googlegroups.com, namhyung@gmail.com,
	rusty@rustcorp.com.au, khali@linux-fr.org, osd-dev@open-osd.org,
	akpm@linux-foundation.org, a.zummo@towertech.it, jkosina@suse.cz,
	cabarnes@indesign-llc.com, tj@kernel.org, bhalevy@panasas.com
Subject: Re: [osd-dev] [PATCH 6/8] [SCSI] osduld: use ida_simple_get to handle id.
Date: Fri, 22 Jul 2011 14:47:06 -0700	[thread overview]
Message-ID: <4E29EFDA.1080407@panasas.com> (raw)
In-Reply-To: <1311352886-4047-7-git-send-email-jic23@cam.ac.uk>

On 07/22/2011 09:41 AM, Jonathan Cameron wrote:
> This does involve additional use of the spin lock in idr.c.
> Is this an issue?
> 

Actually it looks like a bug fix. I had a TODO: to add one.

> Also, some error mangling was needed to keep the interface
> the same.  Does this matter or can we return -ENOSPC instead
> of -EBUSY?
> 

Na. -ENOSPC is just fine. All the osd Application just check for
"any error" not a specific one.

> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

Ack-by: Boaz Harrosh <bharrosh@panasas.com>

> ---
>  drivers/scsi/osd/osd_uld.c |   22 ++++++++--------------
>  1 files changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
> index b31a8e3..fa849bd 100644
> --- a/drivers/scsi/osd/osd_uld.c
> +++ b/drivers/scsi/osd/osd_uld.c
> @@ -387,7 +387,7 @@ static void __remove(struct device *dev)
>  
>  	if (oud->disk)
>  		put_disk(oud->disk);
> -	ida_remove(&osd_minor_ida, oud->minor);
> +	ida_simple_remove(&osd_minor_ida, oud->minor);
>  
>  	kfree(oud);
>  }
> @@ -403,18 +403,12 @@ static int osd_probe(struct device *dev)
>  	if (scsi_device->type != TYPE_OSD)
>  		return -ENODEV;
>  
> -	do {
> -		if (!ida_pre_get(&osd_minor_ida, GFP_KERNEL))
> -			return -ENODEV;
> -
> -		error = ida_get_new(&osd_minor_ida, &minor);
> -	} while (error == -EAGAIN);
> -
> -	if (error)
> -		return error;
> -	if (minor >= SCSI_OSD_MAX_MINOR) {
> -		error = -EBUSY;
> -		goto err_retract_minor;
> +	minor = ida_simple_get(&osd_minor_ida, 0,
> +			       SCSI_OSD_MAX_MINOR, GFP_KERNEL);
> +	if (minor < 0) {
> +		if (minor == -ENOSPC)
> +			return -EBUSY;

Just drop the translation is fine as well

> +		return minor;
>  	}
>  
>  	error = -ENOMEM;
> @@ -491,7 +485,7 @@ err_free_osd:
>  	dev_set_drvdata(dev, NULL);
>  	kfree(oud);
>  err_retract_minor:
> -	ida_remove(&osd_minor_ida, minor);
> +	ida_simple_remove(&osd_minor_ida, minor);
>  	return error;
>  }
>  

  reply	other threads:[~2011-07-22 21:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 16:41 [PATCH 0/8] RFC: Introduce ida_simple interfaces and use them Jonathan Cameron
2011-07-22 16:41 ` [PATCH 1/8] ida: Simplified functions for id allocation Jonathan Cameron
2011-07-22 16:41 ` [PATCH 2/8] hwmon: convert idr to ida and use ida_simple interface Jonathan Cameron
2011-07-29  0:19   ` Guenter Roeck
2011-07-22 16:41 ` [PATCH 3/8] hwmon: ibmaem: convert idr to ida and use ida_simple_get Jonathan Cameron
2011-07-26 18:04   ` Darrick J. Wong
2011-07-22 16:41 ` [PATCH 4/8] [SCSI] use ida_simple_get and ida_simple remove in place of boilerplate code Jonathan Cameron
2011-07-22 16:41 ` [PATCH 5/8] drm/vmwgfx: use ida_simple_get for id allocation Jonathan Cameron
2011-07-22 16:41 ` [PATCH 6/8] [SCSI] osduld: use ida_simple_get to handle id Jonathan Cameron
2011-07-22 21:47   ` Boaz Harrosh [this message]
2011-07-25 11:06     ` [osd-dev] " Jonathan Cameron
2011-07-22 16:41 ` [PATCH 7/8] w1: ds2760 and ds2780, use ida for id and ida_simple_get to get it Jonathan Cameron
2011-07-22 16:41 ` [PATCH 8/8] rtc: class idr converted to ida and ida_simple_get used Jonathan Cameron
2011-07-23 10:17   ` Tejun Heo
2011-07-22 16:41 ` [PATCH 0/8] RFC: Introduce ida_simple interfaces and use them Jonathan Cameron
2011-07-22 16:41 ` [PATCH 1/8] ida: Simplified functions for id allocation Jonathan Cameron
2011-07-23 10:04   ` Tejun Heo
2011-07-22 16:41 ` [PATCH 2/8] hwmon: convert idr to ida and use ida_simple interface Jonathan Cameron
2011-07-22 16:41 ` [PATCH 3/8] hwmon: ibmaem: convert idr to ida and use ida_simple_get Jonathan Cameron
2011-07-22 16:41 ` [PATCH 4/8] [SCSI] use ida_simple_get and ida_simple remove in place of boilerplate code Jonathan Cameron
2011-07-22 16:41 ` [PATCH 5/8] drm/vmwgfx: use ida_simple_get for id allocation Jonathan Cameron
2011-07-22 16:41 ` [PATCH 6/8] [SCSI] osduld: use ida_simple_get to handle id Jonathan Cameron
2011-07-22 16:41 ` [PATCH 7/8] w1: ds2760 and ds2780, use ida for id and ida_simple_get to get it Jonathan Cameron
2011-08-24 17:22   ` Barnes, Clifton A.
2011-07-22 16:41 ` [PATCH 8/8] rtc: class idr converted to ida and ida_simple_get used Jonathan Cameron
2011-07-22 16:48 ` [PATCH 0/8] RFC: Introduce ida_simple interfaces and use them Jonathan Cameron

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=4E29EFDA.1080407@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=JBottomley@parallels.com \
    --cc=a.zummo@towertech.it \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhalevy@panasas.com \
    --cc=cabarnes@indesign-llc.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guenter.roeck@ericsson.com \
    --cc=jic23@cam.ac.uk \
    --cc=jkosina@suse.cz \
    --cc=johnpol@2ka.mipt.ru \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=namhyung@gmail.com \
    --cc=naota@elisp.net \
    --cc=osd-dev@open-osd.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=randy.dunlap@oracle.com \
    --cc=rtc-linux@googlegroups.com \
    --cc=rusty@rustcorp.com.au \
    --cc=thellstrom@vmware.com \
    --cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox