diff mbox series

[v2,02/34] block/ioctl: port blkdev_bszset() to file

Message ID 20240123-vfs-bdev-file-v2-2-adbd023e19cc@kernel.org (mailing list archive)
State New, archived
Headers show
Series Open block devices as files | expand

Commit Message

Christian Brauner Jan. 23, 2024, 1:26 p.m. UTC
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 block/ioctl.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig Jan. 29, 2024, 4:14 p.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jan Kara Jan. 31, 2024, 6:10 p.m. UTC | #2
On Tue 23-01-24 14:26:19, Christian Brauner wrote:
> Signed-off-by: Christian Brauner <brauner@kernel.org>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  block/ioctl.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 9c73a763ef88..5d0619e02e4c 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -471,7 +471,7 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
>  		int __user *argp)
>  {
>  	int ret, n;
> -	struct bdev_handle *handle;
> +	struct file *file;
>  
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EACCES;
> @@ -483,12 +483,11 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
>  	if (mode & BLK_OPEN_EXCL)
>  		return set_blocksize(bdev, n);
>  
> -	handle = bdev_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
> -	if (IS_ERR(handle))
> +	file = bdev_file_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
> +	if (IS_ERR(file))
>  		return -EBUSY;
>  	ret = set_blocksize(bdev, n);
> -	bdev_release(handle);
> -
> +	fput(file);
>  	return ret;
>  }
>  
> 
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/block/ioctl.c b/block/ioctl.c
index 9c73a763ef88..5d0619e02e4c 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -471,7 +471,7 @@  static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
 		int __user *argp)
 {
 	int ret, n;
-	struct bdev_handle *handle;
+	struct file *file;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -483,12 +483,11 @@  static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
 	if (mode & BLK_OPEN_EXCL)
 		return set_blocksize(bdev, n);
 
-	handle = bdev_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
-	if (IS_ERR(handle))
+	file = bdev_file_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
+	if (IS_ERR(file))
 		return -EBUSY;
 	ret = set_blocksize(bdev, n);
-	bdev_release(handle);
-
+	fput(file);
 	return ret;
 }