mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Wang <x-professor@outlook.com>
To: Mikulas Patocka <mpatocka@redhat.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: "dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] dm zoned: tidy up the variables in dmz_lookup_secondary_sb()
Date: Wed, 2 Dec 2026 16:31:48 +0000	[thread overview]
Message-ID: <20261202163146.843368-1-x-professor@outlook.com> (raw)

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


             reply	other threads:[~2026-12-02 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:31 Yingjie Wang [this message]
2026-12-03  6:43 ` 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=20261202163146.843368-1-x-professor@outlook.com \
    --to=x-professor@outlook.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@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

all inboxes | Powered by JetHome®