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, Carlos Maiolino <cem@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Hans Holmberg <hans.holmberg@wdc.com>
Subject: [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
Date: Mon, 16 Mar 2026 20:40:17 +0900	[thread overview]
Message-ID: <20260316114020.753228-2-dlemoal@kernel.org> (raw)
In-Reply-To: <20260316114020.753228-1-dlemoal@kernel.org>

When xfs_select_zone_nowait() is called with pack_tight equal to true,
the function xfs_select_open_zone_mru() is called if no open zone is
returned by xfs_select_open_zone_lru(), that is, when oz is NULL. The
open zone pointer return of xfs_select_zone_nowait() is then checked,
but this check is outside of the "if (pack_tight)" that trigered the
call to xfs_select_open_zone_mru(). In other word, this check is
unnecessarily done even when pack_tight is false.

Move the check for the return value of the call to
xfs_select_open_zone_mru() inside the if that controls the call to this
function, so that we do not uselessly test again the value of oz when
pack_tight is false.

No functional changes.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 fs/xfs/xfs_zone_alloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 7d712d5a5ce0..8435ccb018dc 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -675,10 +675,11 @@ xfs_select_zone_nowait(
 	if (oz)
 		goto out_unlock;
 
-	if (pack_tight)
+	if (pack_tight) {
 		oz = xfs_select_open_zone_mru(zi, write_hint);
-	if (oz)
-		goto out_unlock;
+		if (oz)
+			goto out_unlock;
+	}
 
 	/*
 	 * See if we can open a new zone and use that so that data for different
-- 
2.53.0


  reply	other threads:[~2026-03-16 11:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
2026-03-16 11:40 ` Damien Le Moal [this message]
2026-03-16 15:55   ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Christoph Hellwig
2026-03-17 12:18   ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
2026-03-16 15:56   ` Christoph Hellwig
2026-03-17 12:19   ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
2026-03-16 15:57   ` Christoph Hellwig
2026-03-17 12:21   ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
2026-03-16 15:58   ` Christoph Hellwig
2026-03-17 12:25   ` Hans Holmberg
2026-03-18 10:12 ` [PATCH v2 0/4] Zoned XFS code improvements Carlos Maiolino

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=20260316114020.753228-2-dlemoal@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cem@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --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