]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
This does involve additional use of the spin lock in idr.c. Is this an
authorJonathan Cameron <jic23@cam.ac.uk>
Wed, 24 Aug 2011 23:46:33 +0000 (09:46 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 19 Sep 2011 08:03:42 +0000 (18:03 +1000)
issue?

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

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/scsi/osd/osd_uld.c

index b31a8e3841d795154672cad902ec628bafb59c6f..fa849bdd230f7c608c0fa792b5caeeca9cf7676c 100644 (file)
@@ -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;
+               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;
 }