Re: [PATCH] rbd: show the rbd options in sysfs

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

 



On Tue, Mar 20, 2018 at 11:33 AM, Dongsheng Yang
<dongsheng.yang@xxxxxxxxxxxx> wrote:
> We need to know the rbd options for a rbd device, such as whether lock_on_read
> is true or false. then this patch show the rbd options in sysfs.
>
> Signed-off-by: Dongsheng Yang <dongsheng.yang@xxxxxxxxxxxx>
> ---
>  drivers/block/rbd.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 49e227e..96657ad 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4129,6 +4129,43 @@ static ssize_t rbd_image_refresh(struct device *dev,
>         return size;
>  }
>
> +static ssize_t rbd_queue_depth_show(struct device *dev,
> +                            struct device_attribute *attr, char *buf)
> +{
> +       struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
> +
> +       return sprintf(buf, "%llu\n",
> +               (unsigned long long)rbd_dev->opts->queue_depth);
> +}
> +
> +
> +static ssize_t rbd_read_only_show(struct device *dev,
> +                            struct device_attribute *attr, char *buf)
> +{
> +       struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
> +
> +       return sprintf(buf, "%s\n",
> +               rbd_dev->opts->read_only? "true" : "false");
> +}
> +
> +static ssize_t rbd_lock_on_read_show(struct device *dev,
> +                            struct device_attribute *attr, char *buf)
> +{
> +       struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
> +
> +       return sprintf(buf, "%s\n",
> +               rbd_dev->opts->lock_on_read? "true" : "false");
> +}
> +
> +static ssize_t rbd_exclusive_show(struct device *dev,
> +                            struct device_attribute *attr, char *buf)
> +{
> +       struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
> +
> +       return sprintf(buf, "%s\n",
> +               rbd_dev->opts->exclusive? "true" : "false");
> +}
> +
>  static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL);
>  static DEVICE_ATTR(features, S_IRUGO, rbd_features_show, NULL);
>  static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL);
> @@ -4145,6 +4182,10 @@ static ssize_t rbd_image_refresh(struct device *dev,
>  static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL);
>  static DEVICE_ATTR(snap_id, S_IRUGO, rbd_snap_id_show, NULL);
>  static DEVICE_ATTR(parent, S_IRUGO, rbd_parent_show, NULL);
> +static DEVICE_ATTR(queue_depth, S_IRUGO, rbd_queue_depth_show, NULL);
> +static DEVICE_ATTR(read_only, S_IRUGO, rbd_read_only_show, NULL);
> +static DEVICE_ATTR(lock_on_read, S_IRUGO, rbd_lock_on_read_show, NULL);
> +static DEVICE_ATTR(exclusive, S_IRUGO, rbd_exclusive_show, NULL);

Hi Dongsheng,

I'd prefer a single map_options attribute, similar to client_options
that you are familiar with.

Thanks,

                Ilya
--
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