Commit d4a28d7d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

dm: remove dm_get_dev_t

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: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230531125535.676098-20-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 49177377
...@@ -323,20 +323,6 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, ...@@ -323,20 +323,6 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
return 0; return 0;
} }
/*
* 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 * Add a device to the list, or just increment the usage count if
* it's already present. * it's already present.
...@@ -359,9 +345,11 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, ...@@ -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) if (MAJOR(dev) != major || MINOR(dev) != minor)
return -EOVERFLOW; return -EOVERFLOW;
} else { } else {
dev = dm_get_dev_t(path); r = lookup_bdev(path, &dev);
if (!dev) if (r)
return -ENODEV; r = early_lookup_bdev(path, &dev);
if (r)
return r;
} }
if (dev == disk_devt(t->md->disk)) if (dev == disk_devt(t->md->disk))
return -EINVAL; return -EINVAL;
......
...@@ -170,8 +170,6 @@ struct dm_dev { ...@@ -170,8 +170,6 @@ struct dm_dev {
char name[16]; char name[16];
}; };
dev_t dm_get_dev_t(const char *path);
/* /*
* Constructors should call these functions to ensure destination devices * Constructors should call these functions to ensure destination devices
* are opened/closed correctly. * are opened/closed correctly.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment