diff mbox

[3/3] rbd: show the state_lock_timeout option in sysfs

Message ID 1521541979-15995-4-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show

Commit Message

Dongsheng Yang March 20, 2018, 10:32 a.m. UTC
This patch add a /sys/bus/rbd/devices/X/state_lock_timeout to
show the option of state_lock_timeout of rbd device

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
---
 drivers/block/rbd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6bfbfe5..4c492ad 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4159,6 +4159,15 @@  static ssize_t rbd_queue_depth_show(struct device *dev,
 		(unsigned long long)rbd_dev->opts->queue_depth);
 }
 
+static ssize_t rbd_state_lock_timeout_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->state_lock_timeout);
+}
+
 
 static ssize_t rbd_read_only_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
@@ -4204,6 +4213,7 @@  static ssize_t rbd_exclusive_show(struct device *dev,
 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(state_lock_timeout, S_IRUGO, rbd_state_lock_timeout_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);
@@ -4226,6 +4236,7 @@  static ssize_t rbd_exclusive_show(struct device *dev,
 	&dev_attr_parent.attr,
 	&dev_attr_refresh.attr,
 	&dev_attr_queue_depth.attr,
+	&dev_attr_state_lock_timeout.attr,
 	&dev_attr_read_only.attr,
 	&dev_attr_lock_on_read.attr,
 	&dev_attr_exclusive.attr,