The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] dm zoned: tidy up the variables in dmz_lookup_secondary_sb()
@ 2026-12-02 16:31 Yingjie Wang
  2026-12-03  6:43 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Yingjie Wang @ 2026-12-02 16:31 UTC (permalink / raw)
  To: Mikulas Patocka, Damien Le Moal, Alasdair Kergon, Mike Snitzer,
	Benjamin Marzinski
  Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org

Declare i together with nr_zones, and set nr_zones with an if statement
after the declarations instead of a conditional expression in its
initializer.

No functional change.

Suggested-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/dm-devel/17f0e9c6-856b-4814-81c0-388743e0fd58@kernel.org/
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
---
Damien's review of 3/3 came after the series was applied to for-next,
so this goes on top of commit 2ee78e96ca18 ("dm zoned: fix the search
for the secondary superblock").  Feel free to fold it into that commit
instead.

 drivers/md/dm-zoned-metadata.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index 687573bbc091..1eae19264981 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -1125,11 +1125,14 @@ static int dmz_read_sb(struct dmz_metadata *zmd, struct dmz_sb *sb, int set)
  */
 static int dmz_lookup_secondary_sb(struct dmz_metadata *zmd)
 {
-	unsigned int nr_zones = zmd->nr_devs > 1 ? zmd->nr_cache_zones :
-						   zmd->nr_rnd_zones;
+	unsigned int nr_zones, i;
 	struct dmz_mblock *mblk;
 	unsigned int zone_id = zmd->sb[0].zone->id;
-	unsigned int i;
+
+	if (zmd->nr_devs > 1)
+		nr_zones = zmd->nr_cache_zones;
+	else
+		nr_zones = zmd->nr_rnd_zones;
 
 	/* Allocate a block */
 	mblk = dmz_alloc_mblock(zmd, 0);

base-commit: 2ee78e96ca1894cbfe00eff1e4ff24a93215337f
-- 
2.43.0


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

end of thread, other threads:[~2026-12-03  6:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 16:31 [PATCH] dm zoned: tidy up the variables in dmz_lookup_secondary_sb() Yingjie Wang
2026-12-03  6:43 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox