diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 05:00:11 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 11:25:31 -0400 |
commit | d5686b444ff3f72808d2b3fbd58672a86cdf38e7 (patch) | |
tree | d3cdebc042269641f7134556e2f8d263d526581a /drivers/md | |
parent | a95164d979c5ca061f15bcaadc829c146693d4d9 (diff) | |
download | op-kernel-dev-d5686b444ff3f72808d2b3fbd58672a86cdf38e7.zip op-kernel-dev-d5686b444ff3f72808d2b3fbd58672a86cdf38e7.tar.gz |
[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.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 798e468..61f4414 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) */ static int lookup_device(const char *path, dev_t *dev) { - int r; - struct nameidata nd; - struct inode *inode; - - if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) - return r; - - inode = nd.path.dentry->d_inode; - if (!inode) { - r = -ENOENT; - goto out; - } - - if (!S_ISBLK(inode->i_mode)) { - r = -ENOTBLK; - goto out; - } - - *dev = inode->i_rdev; - - out: - path_put(&nd.path); - return r; + struct block_device *bdev = lookup_bdev(path); + if (IS_ERR(bdev)) + return PTR_ERR(bdev); + *dev = bdev->bd_dev; + bdput(bdev); + return 0; } /* |