Re: [PATCH 2/2] rbd: only set disk to read-only once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/01/2013 12:15 AM, Josh Durgin wrote:
> rbd_open(), called every time the device is opened, calls
> set_device_ro().  There's no reason to set the device read-only or
> read-write every time it is opened. Just do this once during device
> setup, using set_disk_ro() instead because the struct block_device
> isn't available to us there.

Looks good; set_disk_ro() sort of makes more sense anyway without
any partitions.

Reviewed-by: Alex Elder <elder@xxxxxxxxxx>

> Signed-off-by: Josh Durgin <josh.durgin@xxxxxxxxxxx>
> ---
>  drivers/block/rbd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index b3b1b57..fc3ebd9 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -490,7 +490,6 @@ static int rbd_open(struct block_device *bdev, fmode_t mode)
>  		return -ENOENT;
>  
>  	(void) get_device(&rbd_dev->dev);
> -	set_device_ro(bdev, rbd_dev->mapping.read_only);
>  
>  	return 0;
>  }
> @@ -4949,6 +4948,7 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
>  	if (ret)
>  		goto err_out_disk;
>  	set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
> +	set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
>  
>  	ret = rbd_bus_add_dev(rbd_dev);
>  	if (ret)
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux