aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-08-01 05:00:11 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-08-01 11:25:31 -0400
commitd5686b444ff3f72808d2b3fbd58672a86cdf38e7 (patch)
treed3cdebc042269641f7134556e2f8d263d526581a /drivers/md
parenta95164d979c5ca061f15bcaadc829c146693d4d9 (diff)
[PATCH] switch mtd and dm-table to lookup_bdev()
No need to open-code it... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 798e468103b8..61f441409234 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -316,29 +316,12 @@ static inline int check_space(struct dm_table *t)
316 */ 316 */
317static int lookup_device(const char *path, dev_t *dev) 317static int lookup_device(const char *path, dev_t *dev)
318{ 318{
319 int r; 319 struct block_device *bdev = lookup_bdev(path);
320 struct nameidata nd; 320 if (IS_ERR(bdev))
321 struct inode *inode; 321 return PTR_ERR(bdev);
322 322 *dev = bdev->bd_dev;
323 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) 323 bdput(bdev);
324 return r; 324 return 0;
325
326 inode = nd.path.dentry->d_inode;
327 if (!inode) {
328 r = -ENOENT;
329 goto out;
330 }
331
332 if (!S_ISBLK(inode->i_mode)) {
333 r = -ENOTBLK;
334 goto out;
335 }
336
337 *dev = inode->i_rdev;
338
339 out:
340 path_put(&nd.path);
341 return r;
342} 325}
343 326
344/* 327/*