Convert blkdev_open() to use blkdev_get_handle_by_dev(). Signed-off-by: Jan Kara <jack@xxxxxxx> --- block/fops.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/block/fops.c b/block/fops.c index b6aa470c09ae..d7f3b6e67a2f 100644 --- a/block/fops.c +++ b/block/fops.c @@ -496,7 +496,7 @@ blk_mode_t file_to_blk_mode(struct file *file) static int blkdev_open(struct inode *inode, struct file *filp) { - struct block_device *bdev; + struct bdev_handle *handle; blk_mode_t mode; /* @@ -509,24 +509,25 @@ static int blkdev_open(struct inode *inode, struct file *filp) filp->f_mode |= FMODE_BUF_RASYNC; mode = file_to_blk_mode(filp); - bdev = blkdev_get_by_dev(inode->i_rdev, mode, - mode & BLK_OPEN_EXCL ? filp : NULL, NULL); - if (IS_ERR(bdev)) - return PTR_ERR(bdev); + handle = blkdev_get_handle_by_dev(inode->i_rdev, mode, + mode & BLK_OPEN_EXCL ? filp : NULL, NULL); + if (IS_ERR(handle)) + return PTR_ERR(handle); if (mode & BLK_OPEN_EXCL) filp->private_data = filp; - if (bdev_nowait(bdev)) + if (bdev_nowait(handle->bdev)) filp->f_mode |= FMODE_NOWAIT; - filp->f_mapping = bdev->bd_inode->i_mapping; + filp->f_mapping = handle->bdev->bd_inode->i_mapping; filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping); + filp->private_data = handle; return 0; } static int blkdev_release(struct inode *inode, struct file *filp) { - blkdev_put(I_BDEV(filp->f_mapping->host), filp->private_data); + blkdev_handle_put(filp->private_data); return 0; } -- 2.35.3