From patchwork Tue Mar 20 10:32:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10296791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 43D21602C2 for ; Tue, 20 Mar 2018 10:39:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 333AA29048 for ; Tue, 20 Mar 2018 10:39:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 257A129581; Tue, 20 Mar 2018 10:39:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7DB029048 for ; Tue, 20 Mar 2018 10:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbeCTKjX (ORCPT ); Tue, 20 Mar 2018 06:39:23 -0400 Received: from m6562.mail.qiye.163.com ([123.126.65.62]:37203 "EHLO m6562.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbeCTKjU (ORCPT ); Tue, 20 Mar 2018 06:39:20 -0400 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp12 (Coremail) with SMTP id WtOowAC3189e47BaWEJgAA--.11203S5; Tue, 20 Mar 2018 18:33:03 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, sage@redhat.com, elder@kernel.org, jdillama@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH 3/3] rbd: show the state_lock_timeout option in sysfs Date: Tue, 20 Mar 2018 06:32:59 -0400 Message-Id: <1521541979-15995-4-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521541979-15995-1-git-send-email-dongsheng.yang@easystack.cn> References: <1521541979-15995-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: WtOowAC3189e47BaWEJgAA--.11203S5 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUpHmDUUUUU X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiEAAPelnxqNtgnwAAsB Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/block/rbd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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,