From patchwork Thu Mar 28 00:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13607835 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F0022323; Thu, 28 Mar 2024 00:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711586698; cv=none; b=UjBoexAZTnk271PH82hpH/GAQJhP5J4CT/p1y7yKDe/qN0hZ9tcuGVk/LDLu56HxiQz4lLJPHXkjkKlhiJ1F1RNVE3u6QL+26itxxajhYiKeXNRbWKg2B47WLCn07RrRJFGyu0vog6iid19hZdMunH7Sm32+PLSl5VH9y0calsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711586698; c=relaxed/simple; bh=UP0mZgjcRqm/280fAJDfR9vGthYVSyA6TU+OCeIxCZg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HVuYL4qe/BenVh9v75Y4zMFw2QgDd1vfubKjf6aNHIbShsuYFZmo7cQ2PK0dW6WKp1KuWfrRinXX1GtrxEWvfmuStVXqGRqClysBXZKjbGbS8lFtFnjnMjmgLEMHUy+p7vYQAMAKMrYB6gpbKOKR1Ll9/YZEaxhqvoCFxlds/HY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cXVIUxx4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cXVIUxx4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0BC0C433C7; Thu, 28 Mar 2024 00:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711586698; bh=UP0mZgjcRqm/280fAJDfR9vGthYVSyA6TU+OCeIxCZg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cXVIUxx4R7Wu4geUEFUk7UGFCzynrOm6eaczfznBpznXx6NCeRbcI6r9mbS1kfq8t CDqN5ZRvOZnv6qH1GmGEgbdJO2OxMymXmn97xMfRUaJgvcpY4VN4OxiNB13XMr2e2A JMBIVqV/h6nVdCKKXdl131iBDfze+fHHIzq/z9vJqRL00bYUBSbU9XG44MTTqQtV+s URG6l7YIcF1VUbkx2vC/a/MtZxSvFuq4tW7gDxG3gWSVg+W24CQZLZGW6QAi/0GRaO yZ4U6KIYdv6G1Pa3JdprK/FH/JwQBk0zZvEDf3riOesnpwmRmdneINSoaYhGQudI9f Ns8tsMACjM4pg== From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@lists.linux.dev, Mike Snitzer , linux-nvme@lists.infradead.org, Keith Busch , Christoph Hellwig Subject: [PATCH v3 27/30] block: Replace zone_wlock debugfs entry with zone_wplugs entry Date: Thu, 28 Mar 2024 09:44:06 +0900 Message-ID: <20240328004409.594888-28-dlemoal@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328004409.594888-1-dlemoal@kernel.org> References: <20240328004409.594888-1-dlemoal@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In preparation to completely remove zone write locking, replace the "zone_wlock" mq-debugfs entry that was listing zones that are write-locked with the zone_wplugs entry which lists the zones that currently have a write plug allocated. The write plug information provided is: the zone number, the zone write plug flags, the zone write plug write pointer offset and the number of BIOs currently waiting for execution in the zone write plug BIO list. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- block/blk-mq-debugfs.c | 2 +- block/blk-mq-debugfs.h | 4 ++-- block/blk-zoned.c | 31 ++++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 94668e72ab09..ca1f2b9422d5 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -160,7 +160,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = { { "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops }, { "pm_only", 0600, queue_pm_only_show, NULL }, { "state", 0600, queue_state_show, queue_state_write }, - { "zone_wlock", 0400, queue_zone_wlock_show, NULL }, + { "zone_wplugs", 0400, queue_zone_wplugs_show, NULL }, { }, }; diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index 3ebe2c29b624..c80e453e3014 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -84,9 +84,9 @@ static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) #endif #if defined(CONFIG_BLK_DEV_ZONED) && defined(CONFIG_BLK_DEBUG_FS) -int queue_zone_wlock_show(void *data, struct seq_file *m); +int queue_zone_wplugs_show(void *data, struct seq_file *m); #else -static inline int queue_zone_wlock_show(void *data, struct seq_file *m) +static inline int queue_zone_wplugs_show(void *data, struct seq_file *m) { return 0; } diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 93aa994824d1..d540688c30f9 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1894,17 +1894,34 @@ EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones); #ifdef CONFIG_BLK_DEBUG_FS -int queue_zone_wlock_show(void *data, struct seq_file *m) +int queue_zone_wplugs_show(void *data, struct seq_file *m) { struct request_queue *q = data; - unsigned int i; + struct gendisk *disk = q->disk; + struct blk_zone_wplug *zwplug; + unsigned int zwp_wp_offset, zwp_flags; + unsigned int zwp_zone_no, zwp_ref; + unsigned int zwp_bio_list_size, i; + unsigned long flags; - if (!q->disk->seq_zones_wlock) - return 0; + rcu_read_lock(); + for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) { + hlist_for_each_entry_rcu(zwplug, + &disk->zone_wplugs_hash[i], node) { + spin_lock_irqsave(&zwplug->lock, flags); + zwp_zone_no = zwplug->zone_no; + zwp_flags = zwplug->flags; + zwp_ref = atomic_read(&zwplug->ref); + zwp_wp_offset = zwplug->wp_offset; + zwp_bio_list_size = bio_list_size(&zwplug->bio_list); + spin_unlock_irqrestore(&zwplug->lock, flags); - for (i = 0; i < q->disk->nr_zones; i++) - if (test_bit(i, q->disk->seq_zones_wlock)) - seq_printf(m, "%u\n", i); + seq_printf(m, "%u 0x%x %u %u %u\n", + zwp_zone_no, zwp_flags, zwp_ref, + zwp_wp_offset, zwp_bio_list_size); + } + } + rcu_read_unlock(); return 0; }