From patchwork Wed Oct 10 01:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 10633813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B9BC112B for ; Wed, 10 Oct 2018 01:52:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B67C298B6 for ; Wed, 10 Oct 2018 01:52:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FF5D298DF; Wed, 10 Oct 2018 01:52:55 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 1EFE4298B6 for ; Wed, 10 Oct 2018 01:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbeJJJMm (ORCPT ); Wed, 10 Oct 2018 05:12:42 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:39878 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbeJJJMm (ORCPT ); Wed, 10 Oct 2018 05:12:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1539136374; x=1570672374; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dxrWePnl5ZIkkpVfiz/THEVrSj320iyO/cmnX8ge+cc=; b=YJyw8tVVB7XTHWDgY3Go8x0wC9uqmgt476d+xn/lKN3gFfOhmrHCvWC6 2GhMK0akHQPfyunGAHc85ZnC+myNCptfTQ3A3tUwjWljlNtFxp55sg7xA 0l2iPljxu6Q6LTFMKC/3e1LcbCqCNTsflUerR9xN3lY5nn5aGYVqvGewM n2rhG6pVN0m3J84dNJ8yx00LjDnvMp66JW81e0fz9qhEtpPtvHknpXTaM ueN+0wAn4tIfKyN5G2iZJbTqMShpYtfsxiVyvN2oU0RGbFjNPZJWjHVIL zQzqwJO1kyjTZFt1scJCmXglmoCkTbCaqZ1StnMiErJWLDI/jAgYoE1qS A==; X-IronPort-AV: E=Sophos;i="5.54,362,1534780800"; d="scan'208";a="92692982" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Oct 2018 09:52:54 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 09 Oct 2018 18:38:20 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 09 Oct 2018 18:52:53 -0700 From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@redhat.com, Mike Snitzer Cc: Christoph Hellwig , Matias Bjorling Subject: [PATCH 09/11] block: Expose queue nr_zones in sysfs Date: Wed, 10 Oct 2018 10:52:37 +0900 Message-Id: <20181010015239.24930-10-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181010015239.24930-1-damien.lemoal@wdc.com> References: <20181010015239.24930-1-damien.lemoal@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Expose through sysfs the nr_zones field of a zoned block device request queue. This represents the total number of zones of the device calculated using the known disk capacity and zone size. Exposing this value helps in debugging disk issues as well as facilitating scripts based use of the disk (e.g. blktests). Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- block/blk-sysfs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..f7060a938bf9 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -300,6 +300,11 @@ static ssize_t queue_zoned_show(struct request_queue *q, char *page) } } +static ssize_t queue_nr_zones_show(struct request_queue *q, char *page) +{ + return queue_var_show(q->nr_zones, page); +} + static ssize_t queue_nomerges_show(struct request_queue *q, char *page) { return queue_var_show((blk_queue_nomerges(q) << 1) | @@ -637,6 +642,11 @@ static struct queue_sysfs_entry queue_zoned_entry = { .show = queue_zoned_show, }; +static struct queue_sysfs_entry queue_nr_zones_entry = { + .attr = {.name = "nr_zones", .mode = 0444 }, + .show = queue_nr_zones_show, +}; + static struct queue_sysfs_entry queue_nomerges_entry = { .attr = {.name = "nomerges", .mode = 0644 }, .show = queue_nomerges_show, @@ -727,6 +737,7 @@ static struct attribute *default_attrs[] = { &queue_write_zeroes_max_entry.attr, &queue_nonrot_entry.attr, &queue_zoned_entry.attr, + &queue_nr_zones_entry.attr, &queue_nomerges_entry.attr, &queue_rq_affinity_entry.attr, &queue_iostats_entry.attr,