Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3005881ybt; Mon, 29 Jun 2020 12:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAlQ0uMWtNAv76lV0yUlwzl8pgohvZNpFADuj3rk1WiGyz2g2qlzbK/dTDO/AYXp59az5X X-Received: by 2002:a05:6402:1687:: with SMTP id a7mr19046818edv.358.1593459750823; Mon, 29 Jun 2020 12:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593459750; cv=none; d=google.com; s=arc-20160816; b=rCKvq/Ok5B6cE+tr/K4pHlPUWizDKPT4nxuBk5H3OSei7hgvAk0nJ5Y3Kv7zU9KH9a VNPB1VcCDCzwyuLwMdz3fOquMWkt35Ks0l7nA7aG4BERecfkQqnqrOY6TcAtSNBR7Wep 0lHn8HVwZaww1K8OeRpO8rDW7CtmzgeNzDFzSNhlP8ENryLeh2uIzy1UYTNw/iUUmKC1 iKaAw035m9JfJI81yfnne8JfZvUPr5vOXwiyGap1rmedgIZxWWv0ePAx/HC6Sw5t01oO yxNWR34Q6YR5SZ3XZFB51XT2FalguK1zpG2GXMdNvwnaV48Vpi2JV/DY2G6yQmO4vXvb TLbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6a8cX4N7tIU78Bd4F2J28aUNQpAoW/gTIhMzNFxYwFY=; b=LT9kkG/rJ9/NqdaGJHVZ8IhVStmIAtc+Tl30cuzhxPTOyjRE04KkQfW2uJ+UnzaC2D IdpiVEb8joNpE4oxrh8TkLJf6okBWa8LXUp+L9CJXiKxSkQlf2UCM/LkqR1TI9ieGq+E aTZbpm2ZlPXt9Wi/xDD83QqvcJHSvVaSzo53xfefkVAAxm8oK/hT3O8nPCvzQdK4tXRX GXTQqBQyvOQgXBWHYuS/x5wHx6N+hFZqzagTysIdwe5yQXH/psYRoGxXqg2hDWycqB92 QQ143K3Jyzn+kDARh6RCS1p2gkITZcfr4EVL/ax53kaGrfH5kpNTzz27F0sXtGnhp/P/ Aktg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=wzHj9+Bu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si379674ejb.157.2020.06.29.12.42.07; Mon, 29 Jun 2020 12:42:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=wzHj9+Bu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387848AbgF2TmC (ORCPT + 99 others); Mon, 29 Jun 2020 15:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387919AbgF2Tlv (ORCPT ); Mon, 29 Jun 2020 15:41:51 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CF2C03E97E for ; Mon, 29 Jun 2020 12:41:51 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id h28so14003439edz.0 for ; Mon, 29 Jun 2020 12:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=6a8cX4N7tIU78Bd4F2J28aUNQpAoW/gTIhMzNFxYwFY=; b=wzHj9+BuUUyCxdkKKiVEO9Ay5o9qtrK16ExaJLYOzw9UjAZQdvSNNgtbBCPwpsy/DK oOPPisPG3Jp6HMjyAM88YEmbc4MDI7lDa7lekQFpo9RI9gN3n9mARHGJEwrNKi9kC38r Ce3aUZZ+nEMx9yRyJBLUvGZbk5xaDb6NWnMGjIj16rwPeBiYEbInz0zi20nb9qNOgstC wNZrkFMkycFHtcxYH+4vMjgNQZrnLfYkT3RQ4NcC0f5LkbXSt4M6eGqtfetmnqe8GV8S 2fNCPhZVLkcIeUdVeVcXi5koewbAqwpWVD8ZaYMi7h6Gy4t3JE8Mkz7HXMGVRP9Gzk9j D2+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=6a8cX4N7tIU78Bd4F2J28aUNQpAoW/gTIhMzNFxYwFY=; b=Oc+mkTpkZkd+7HdZLx1MgyYYMiYHS89cIGyUcdnwxHLxCEmhrorAH/gAFyKr3RnmRs 5PdE3naWmX2I/cJyoMmG0rnMy2Yq12Y/WCMGfMc9IVtZMaG4f90CJDyhXYb8vUAxzYyk RDKnqUlP5A3HZwl7D0oyQzZmd9kzVjFXM+gFxv/B+xDaFoL39weCz7uYpV79f0nourSq /zHAjFxLzvKi7c1sRoDRagpUe/VwP2LnQUNbLf3pxqMb5GmFFnC7NIdUI8SdMXp0VyX/ abszDirtJK4nSzCA3h9zJpufwntUDe2uuC5f4Gre2TFOvKrkEIBhGstghxScospb2rS0 fAYg== X-Gm-Message-State: AOAM533E781Dp4tKj6TO2LKqyRyOo2CEANE822McbAD2UlF6iGRz7NJr L7j0LQdtPEHVCmT1s6m6CBRWaA== X-Received: by 2002:a50:8467:: with SMTP id 94mr18907410edp.249.1593459709993; Mon, 29 Jun 2020 12:41:49 -0700 (PDT) Received: from localhost (5.186.127.235.cgn.fibianet.dk. [5.186.127.235]) by smtp.gmail.com with ESMTPSA id l18sm599845eds.46.2020.06.29.12.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 12:41:49 -0700 (PDT) Date: Mon, 29 Jun 2020 21:41:48 +0200 From: Javier =?utf-8?B?R29uesOhbGV6?= To: Niklas Cassel Cc: Jonathan Corbet , Jens Axboe , Keith Busch , Christoph Hellwig , Sagi Grimberg , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: Re: [PATCH 1/2] block: add max_open_zones to blk-sysfs Message-ID: <20200629194148.vaifnt4fhr2t5bi2@MacBook-Pro.localdomain> References: <20200616102546.491961-1-niklas.cassel@wdc.com> <20200616102546.491961-2-niklas.cassel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200616102546.491961-2-niklas.cassel@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.06.2020 12:25, Niklas Cassel wrote: >Add a new max_open_zones definition in the sysfs documentation. >This definition will be common for all devices utilizing the zoned block >device support in the kernel. > >Export max open zones according to this new definition for NVMe Zoned >Namespace devices, ZAC ATA devices (which are treated as SCSI devices by >the kernel), and ZBC SCSI devices. > >Add the new max_open_zones struct member to the request_queue, rather >than as a queue limit, since this property cannot be split across stacking >drivers. > >Signed-off-by: Niklas Cassel >--- > Documentation/block/queue-sysfs.rst | 7 +++++++ > block/blk-sysfs.c | 15 +++++++++++++++ > drivers/nvme/host/zns.c | 1 + > drivers/scsi/sd_zbc.c | 4 ++++ > include/linux/blkdev.h | 20 ++++++++++++++++++++ > 5 files changed, 47 insertions(+) > >diff --git a/Documentation/block/queue-sysfs.rst b/Documentation/block/queue-sysfs.rst >index 6a8513af9201..f01cf8530ae4 100644 >--- a/Documentation/block/queue-sysfs.rst >+++ b/Documentation/block/queue-sysfs.rst >@@ -117,6 +117,13 @@ Maximum number of elements in a DMA scatter/gather list with integrity > data that will be submitted by the block layer core to the associated > block driver. > >+max_open_zones (RO) >+------------------- >+For zoned block devices (zoned attribute indicating "host-managed" or >+"host-aware"), the sum of zones belonging to any of the zone states: >+EXPLICIT OPEN or IMPLICIT OPEN, is limited by this value. >+If this value is 0, there is no limit. >+ > max_sectors_kb (RW) > ------------------- > This is the maximum number of kilobytes that the block layer will allow >diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c >index 02643e149d5e..fa42961e9678 100644 >--- a/block/blk-sysfs.c >+++ b/block/blk-sysfs.c >@@ -305,6 +305,11 @@ static ssize_t queue_nr_zones_show(struct request_queue *q, char *page) > return queue_var_show(blk_queue_nr_zones(q), page); > } > >+static ssize_t queue_max_open_zones_show(struct request_queue *q, char *page) >+{ >+ return queue_var_show(queue_max_open_zones(q), page); >+} >+ > static ssize_t queue_nomerges_show(struct request_queue *q, char *page) > { > return queue_var_show((blk_queue_nomerges(q) << 1) | >@@ -667,6 +672,11 @@ static struct queue_sysfs_entry queue_nr_zones_entry = { > .show = queue_nr_zones_show, > }; > >+static struct queue_sysfs_entry queue_max_open_zones_entry = { >+ .attr = {.name = "max_open_zones", .mode = 0444 }, >+ .show = queue_max_open_zones_show, >+}; >+ > static struct queue_sysfs_entry queue_nomerges_entry = { > .attr = {.name = "nomerges", .mode = 0644 }, > .show = queue_nomerges_show, >@@ -765,6 +775,7 @@ static struct attribute *queue_attrs[] = { > &queue_nonrot_entry.attr, > &queue_zoned_entry.attr, > &queue_nr_zones_entry.attr, >+ &queue_max_open_zones_entry.attr, > &queue_nomerges_entry.attr, > &queue_rq_affinity_entry.attr, > &queue_iostats_entry.attr, >@@ -792,6 +803,10 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr, > (!q->mq_ops || !q->mq_ops->timeout)) > return 0; > >+ if (attr == &queue_max_open_zones_entry.attr && >+ !blk_queue_is_zoned(q)) >+ return 0; >+ > return attr->mode; > } > >diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c >index c08f6281b614..af156529f3b6 100644 >--- a/drivers/nvme/host/zns.c >+++ b/drivers/nvme/host/zns.c >@@ -82,6 +82,7 @@ int nvme_update_zone_info(struct gendisk *disk, struct nvme_ns *ns, > > q->limits.zoned = BLK_ZONED_HM; > blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); >+ blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1); > free_data: > kfree(id); > return status; >diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c >index 183a20720da9..aa3564139b40 100644 >--- a/drivers/scsi/sd_zbc.c >+++ b/drivers/scsi/sd_zbc.c >@@ -717,6 +717,10 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) > /* The drive satisfies the kernel restrictions: set it up */ > blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); > blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE); >+ if (sdkp->zones_max_open == U32_MAX) >+ blk_queue_max_open_zones(q, 0); >+ else >+ blk_queue_max_open_zones(q, sdkp->zones_max_open); > nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks); > > /* READ16/WRITE16 is mandatory for ZBC disks */ >diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h >index 8fd900998b4e..2f332f00501d 100644 >--- a/include/linux/blkdev.h >+++ b/include/linux/blkdev.h >@@ -520,6 +520,7 @@ struct request_queue { > unsigned int nr_zones; > unsigned long *conv_zones_bitmap; > unsigned long *seq_zones_wlock; >+ unsigned int max_open_zones; > #endif /* CONFIG_BLK_DEV_ZONED */ > > /* >@@ -729,6 +730,17 @@ static inline bool blk_queue_zone_is_seq(struct request_queue *q, > return true; > return !test_bit(blk_queue_zone_no(q, sector), q->conv_zones_bitmap); > } >+ >+static inline void blk_queue_max_open_zones(struct request_queue *q, >+ unsigned int max_open_zones) >+{ >+ q->max_open_zones = max_open_zones; >+} >+ >+static inline unsigned int queue_max_open_zones(const struct request_queue *q) >+{ >+ return q->max_open_zones; >+} > #else /* CONFIG_BLK_DEV_ZONED */ > static inline unsigned int blk_queue_nr_zones(struct request_queue *q) > { >@@ -744,6 +756,14 @@ static inline unsigned int blk_queue_zone_no(struct request_queue *q, > { > return 0; > } >+static inline void blk_queue_max_open_zones(struct request_queue *q, >+ unsigned int max_open_zones) >+{ >+} >+static inline unsigned int queue_max_open_zones(const struct request_queue *q) >+{ >+ return 0; >+} > #endif /* CONFIG_BLK_DEV_ZONED */ > > static inline bool rq_is_sync(struct request *rq) >-- >2.26.2 > > >_______________________________________________ >linux-nvme mailing list >linux-nvme@lists.infradead.org >http://lists.infradead.org/mailman/listinfo/linux-nvme Looks good to me. Reviewed-by: Javier González