Re: [PATCH v5 2/7] block: allow blk-zoned devices to have non-power-of-2 zone size

From: Hannes Reinecke
Date: Tue May 24 2022 - 03:14:23 EST


On 5/24/22 09:10, Pankaj Raghav wrote:
On 5/24/22 07:19, Hannes Reinecke wrote:

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c4e4c7071b7b..f5c7a41032ba 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -676,6 +676,21 @@ static inline unsigned int
blk_queue_zone_no(struct request_queue *q,
      return div64_u64(sector, zone_sectors);
  }
  +static inline bool blk_queue_is_zone_start(struct request_queue *q,
sector_t sec)
+{
+    sector_t zone_sectors = blk_queue_zone_sectors(q);
+    u64 remainder = 0;
+
+    if (!blk_queue_is_zoned(q))
+        return false;
+

Not sure if we need this here; surely blk_queue_zone_sectors() will
already barf, and none of the callers did this check.

I totally agree with you but all the other blk_queue_* functions had
this defensive check and I didn't want to break that pattern:

Ah, fair enough.

Reviewed-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman