diff mbox series

[5/6] rbd: remove the ->set_read_only method

Message ID 20201207131918.2252553-6-hch@lst.de
State Superseded
Headers show
Series [1/6] dm: use bdev_read_only to check if a device is read-only | expand

Commit Message

Christoph Hellwig Dec. 7, 2020, 1:19 p.m. UTC
Now that the hardware read-only state can't be changed by the BLKROSET
ioctl, the code in this method is not required anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/block/rbd.c | 19 -------------------
 1 file changed, 19 deletions(-)

Comments

Ilya Dryomov Dec. 7, 2020, 2:57 p.m. UTC | #1
On Mon, Dec 7, 2020 at 2:21 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/block/rbd.c | 19 -------------------
>  1 file changed, 19 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2ed79b09439a82..2c64ca15ca079f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
>         put_device(&rbd_dev->dev);
>  }
>
> -static int rbd_set_read_only(struct block_device *bdev, bool ro)
> -{
> -       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
> -
> -       /*
> -        * Both images mapped read-only and snapshots can't be marked
> -        * read-write.
> -        */
> -       if (!ro) {
> -               if (rbd_is_ro(rbd_dev))
> -                       return -EROFS;
> -
> -               rbd_assert(!rbd_is_snap(rbd_dev));
> -       }
> -
> -       return 0;
> -}
> -
>  static const struct block_device_operations rbd_bd_ops = {
>         .owner                  = THIS_MODULE,
>         .open                   = rbd_open,
>         .release                = rbd_release,
> -       .set_read_only          = rbd_set_read_only,
>  };
>
>  /*
> --
> 2.29.2
>

If nothing can mess with read-only state after set_disk_ro(disk, true),
looks good.

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya
Martin K. Petersen Dec. 8, 2020, 5:30 a.m. UTC | #2
Christoph,

> Now that the hardware read-only state can't be changed by the BLKROSET

> ioctl, the code in this method is not required anymore.


Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>


-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2ed79b09439a82..2c64ca15ca079f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -692,29 +692,10 @@  static void rbd_release(struct gendisk *disk, fmode_t mode)
 	put_device(&rbd_dev->dev);
 }
 
-static int rbd_set_read_only(struct block_device *bdev, bool ro)
-{
-	struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
-
-	/*
-	 * Both images mapped read-only and snapshots can't be marked
-	 * read-write.
-	 */
-	if (!ro) {
-		if (rbd_is_ro(rbd_dev))
-			return -EROFS;
-
-		rbd_assert(!rbd_is_snap(rbd_dev));
-	}
-
-	return 0;
-}
-
 static const struct block_device_operations rbd_bd_ops = {
 	.owner			= THIS_MODULE,
 	.open			= rbd_open,
 	.release		= rbd_release,
-	.set_read_only		= rbd_set_read_only,
 };
 
 /*