linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/2] block: don't return 1 for the fallback case in blkdev_get_zone_info
@ 2025-11-06 14:53 Christoph Hellwig
  2025-11-07  6:14 ` Damien Le Moal
  2025-11-07 11:38 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-11-06 14:53 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Damien Le Moal, linux-block

blkdev_do_report_zones returns the number of reported zones, but
blkdev_get_zone_info returns 0 or an errno.  Translate to the expected
return value in blkdev_report_zone_fallback.

Fixes: b037d41762fd ("block: introduce blkdev_get_zone_info()")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-zoned.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index c5226bcaaa94..8204214e3b89 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -895,8 +895,14 @@ static int blkdev_report_zone_fallback(struct block_device *bdev,
 		.data = zone,
 		.report_active = true,
 	};
+	int error;
 
-	return blkdev_do_report_zones(bdev, sector, 1, &args);
+	error = blkdev_do_report_zones(bdev, sector, 1, &args);
+	if (error < 0)
+		return error;
+	if (error == 0)
+		return -EIO;
+	return 0;
 }
 
 /*
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-07 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06 14:53 [PATCH 3/2] block: don't return 1 for the fallback case in blkdev_get_zone_info Christoph Hellwig
2025-11-07  6:14 ` Damien Le Moal
2025-11-07 11:37   ` Christoph Hellwig
2025-11-07 11:38 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).