dm: remove dm_get_dev_t
authorChristoph Hellwig <hch@lst.de>
Wed, 31 May 2023 12:55:30 +0000 (14:55 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 5 Jun 2023 16:57:40 +0000 (10:57 -0600)
Open code dm_get_dev_t in the only remaining caller, and propagate the
exact error code from lookup_bdev and early_lookup_bdev.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230531125535.676098-20-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/dm-table.c
include/linux/device-mapper.h

index 05aa16d..1576b40 100644 (file)
@@ -324,20 +324,6 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
 }
 
 /*
- * Convert the path to a device
- */
-dev_t dm_get_dev_t(const char *path)
-{
-       dev_t dev;
-
-       if (lookup_bdev(path, &dev) &&
-           early_lookup_bdev(path, &dev))
-               return 0;
-       return dev;
-}
-EXPORT_SYMBOL_GPL(dm_get_dev_t);
-
-/*
  * Add a device to the list, or just increment the usage count if
  * it's already present.
  */
@@ -359,9 +345,11 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
                if (MAJOR(dev) != major || MINOR(dev) != minor)
                        return -EOVERFLOW;
        } else {
-               dev = dm_get_dev_t(path);
-               if (!dev)
-                       return -ENODEV;
+               r = lookup_bdev(path, &dev);
+               if (r)
+                       r = early_lookup_bdev(path, &dev);
+               if (r)
+                       return r;
        }
        if (dev == disk_devt(t->md->disk))
                return -EINVAL;
index a52d2b9..c27b840 100644 (file)
@@ -170,8 +170,6 @@ struct dm_dev {
        char name[16];
 };
 
-dev_t dm_get_dev_t(const char *path);
-
 /*
  * Constructors should call these functions to ensure destination devices
  * are opened/closed correctly.