mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: remove redundant ASSERT in __xfs_bunmapi
@ 2026-11-27  8:40 jianyungao89
  2026-11-30 13:28 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: jianyungao89 @ 2026-11-27  8:40 UTC (permalink / raw)
  To: linux-xfs
  Cc: cem, djwong, sandeen, bfoster, ast, ishiyama, linux-kernel, Jianyun Gao

From: Jianyun Gao <jianyungao89@gmail.com>

In __xfs_bunmapi(), the code checks if the fork is in btree format and
then immediately asserts the same condition:

    if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
        ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
        cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);

The ASSERT was originally meaningful when the if-condition tested a
different property (the XFS_IFBROOT flag), serving as a cross-check
that IFBROOT implies BTREE format.  commit ac1e067211d14 ("xfs: remove
XFS_IFBROOT") replaced the flag check with a direct format comparison,
making the ASSERT tautological.  Remove it.

Fixes: ac1e067211d14 ("xfs: remove XFS_IFBROOT")
Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
---
 fs/xfs/libxfs/xfs_bmap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index dcd5faf3428e..f2627ec2dd24 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5166,7 +5166,6 @@ __xfs_bunmapi(
 
 	logflags = 0;
 	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
-		ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
 		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
 	} else
 		cur = NULL;
-- 
2.34.1


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

* Re: [PATCH] xfs: remove redundant ASSERT in __xfs_bunmapi
  2026-11-27  8:40 [PATCH] xfs: remove redundant ASSERT in __xfs_bunmapi jianyungao89
@ 2026-11-30 13:28 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-11-30 13:28 UTC (permalink / raw)
  To: jianyungao89
  Cc: linux-xfs, cem, djwong, sandeen, bfoster, ast, ishiyama, linux-kernel

On Fri, Nov 27, 2026 at 04:40:16PM +0800, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
> 
> In __xfs_bunmapi(), the code checks if the fork is in btree format and
> then immediately asserts the same condition:
> 
>     if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
>         ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
>         cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
> 
> The ASSERT was originally meaningful when the if-condition tested a
> different property (the XFS_IFBROOT flag), serving as a cross-check
> that IFBROOT implies BTREE format.  commit ac1e067211d14 ("xfs: remove
> XFS_IFBROOT") replaced the flag check with a direct format comparison,
> making the ASSERT tautological.  Remove it.
> 
> Fixes: ac1e067211d14 ("xfs: remove XFS_IFBROOT")

The change looks good, but this is a lot of text for a trivial fix.
And the Fixes tag does not belong here - nothing is fixed here, this
just removed a little bit of redundant code.


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

end of thread, other threads:[~2026-11-30 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  8:40 [PATCH] xfs: remove redundant ASSERT in __xfs_bunmapi jianyungao89
2026-11-30 13:28 ` Christoph Hellwig

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®