public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: linux-xfs@vger.kernel.org,
	Andrey Albershteyn <aalbersh@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Carlos Maiolino <cem@kernel.org>
Subject: [PATCH v2 3/3] repair: use cached report zone
Date: Fri, 19 Dec 2025 18:38:10 +0900	[thread overview]
Message-ID: <20251219093810.540437-4-dlemoal@kernel.org> (raw)
In-Reply-To: <20251219093810.540437-1-dlemoal@kernel.org>

Use BLKREPORTZONEV2 ioctl with the BLK_ZONE_REP_CACHED flag set to
speed up zone reports. If this fails, fallback to the legacy
BLKREPORTZONE ioctl() which is slower as it uses the device to get the
zone report.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 repair/zoned.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/repair/zoned.c b/repair/zoned.c
index 206b0158f95f..1e4891c483ee 100644
--- a/repair/zoned.c
+++ b/repair/zoned.c
@@ -82,8 +82,13 @@ check_zones(
 		memset(rep, 0, rep_size);
 		rep->sector = sector;
 		rep->nr_zones = ZONES_PER_IOCTL;
+		rep->flags = BLK_ZONE_REP_CACHED;
 
-		ret = ioctl(fd, BLKREPORTZONE, rep);
+		ret = ioctl(fd, BLKREPORTZONEV2, rep);
+		if (ret < 0 && errno == ENOTTY) {
+			rep->flags = 0;
+			ret = ioctl(fd, BLKREPORTZONE, rep);
+		}
 		if (ret) {
 			do_error(_("ioctl(BLKREPORTZONE) failed: %d!\n"), ret);
 			goto out_free;
-- 
2.52.0


  parent reply	other threads:[~2025-12-19  9:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19  9:38 [PATCH v2 0/3] Enable cached zone report Damien Le Moal
2025-12-19  9:38 ` [PATCH v2 1/3] libxfs: define BLKREPORTZONEV2 if the kernel does not provide it Damien Le Moal
2025-12-19  9:38 ` [PATCH v2 2/3] mkfs: use cached report zone Damien Le Moal
2025-12-19  9:38 ` Damien Le Moal [this message]
2025-12-19 23:56 ` [PATCH v2 0/3] Enable cached zone report Darrick J. Wong
2025-12-19 23:59   ` Darrick J. Wong
2025-12-20  0:00   ` Damien Le Moal
2025-12-20  1:54     ` Darrick J. Wong
2025-12-20  2:22       ` Damien Le Moal
2025-12-20  2:59       ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251219093810.540437-4-dlemoal@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox