summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-23 13:38:40 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-01 14:53:39 -0700
commit4e7b5671c6a883d94b5428e1a9c141bbd56cb2a6 (patch)
tree862980514dedf92e87aa3ec651f5be306f207390 /drivers/mtd
parent7918f0f6fdafa1e52c2d77c537cb55ef25fb69a3 (diff)
block: remove i_bdev
Switch the block device lookup interfaces to directly work with a dev_t so that struct block_device references are only acquired by the blkdev_get variants (and the blk-cgroup special case). This means that we now don't need an extra reference in the inode and can generally simplify handling of struct block_device to keep the lookups contained in the core block layer code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Coly Li <colyli@suse.de> [bcache] Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdsuper.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index c3e2098372f2..38b6aa849c63 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -120,8 +120,8 @@ int get_tree_mtd(struct fs_context *fc,
struct fs_context *fc))
{
#ifdef CONFIG_BLOCK
- struct block_device *bdev;
- int ret, major;
+ dev_t dev;
+ int ret;
#endif
int mtdnr;
@@ -169,20 +169,15 @@ int get_tree_mtd(struct fs_context *fc,
/* try the old way - the hack where we allowed users to mount
* /dev/mtdblock$(n) but didn't actually _use_ the blockdev
*/
- bdev = lookup_bdev(fc->source);
- if (IS_ERR(bdev)) {
- ret = PTR_ERR(bdev);
+ ret = lookup_bdev(fc->source, &dev);
+ if (ret) {
errorf(fc, "MTD: Couldn't look up '%s': %d", fc->source, ret);
return ret;
}
pr_debug("MTDSB: lookup_bdev() returned 0\n");
- major = MAJOR(bdev->bd_dev);
- mtdnr = MINOR(bdev->bd_dev);
- bdput(bdev);
-
- if (major == MTD_BLOCK_MAJOR)
- return mtd_get_sb_by_nr(fc, mtdnr, fill_super);
+ if (MAJOR(dev) == MTD_BLOCK_MAJOR)
+ return mtd_get_sb_by_nr(fc, MINOR(dev), fill_super);
#endif /* CONFIG_BLOCK */