]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 16 Mar 2026 11:40:17 +0000 (20:40 +0900)
committerCarlos Maiolino <cem@kernel.org>
Wed, 18 Mar 2026 09:08:07 +0000 (10:08 +0100)
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>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_zone_alloc.c

index 9d02160c5334830044222afdfc21c7754b249fbb..612fcafd3a0c2714167974db88f2299b28dc7334 100644 (file)
@@ -678,10 +678,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