From: Yu Kuai <yukuai3@xxxxxxxxxx> Now that all bcache stash the file of opened bdev, it's ok to get mapping from the file. Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> --- drivers/md/bcache/super.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 4153c9ddbe0b..ec9efa79d5a8 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -163,15 +163,16 @@ static const char *read_super_common(struct cache_sb *sb, struct block_device * } -static const char *read_super(struct cache_sb *sb, struct block_device *bdev, +static const char *read_super(struct cache_sb *sb, struct file *bdev_file, struct cache_sb_disk **res) { const char *err; + struct block_device *bdev = file_bdev(bdev_file); struct cache_sb_disk *s; struct page *page; unsigned int i; - page = read_cache_page_gfp(bdev->bd_inode->i_mapping, + page = read_cache_page_gfp(bdev_file->f_mapping, SB_OFFSET >> PAGE_SHIFT, GFP_KERNEL); if (IS_ERR(page)) return "IO error"; @@ -2564,7 +2565,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, if (set_blocksize(file_bdev(bdev_file), 4096)) goto out_blkdev_put; - err = read_super(sb, file_bdev(bdev_file), &sb_disk); + err = read_super(sb, bdev_file, &sb_disk); if (err) goto out_blkdev_put; -- 2.39.2