linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Remove unnecessary checks in functions related to xfs_fsmap
@ 2025-05-17  7:43 Zizhi Wo
  2025-05-19  6:35 ` Nirjhar Roy (IBM)
  2025-05-19 15:08 ` Darrick J. Wong
  0 siblings, 2 replies; 8+ messages in thread
From: Zizhi Wo @ 2025-05-17  7:43 UTC (permalink / raw)
  To: cem, djwong, dchinner, osandov, john.g.garry
  Cc: linux-xfs, linux-kernel, wozizhi, yangerkun, leo.lilong

From: Zizhi Wo <wozizhi@huaweicloud.com>

In __xfs_getfsmap_datadev(), if "pag_agno(pag) == end_ag", we don't need
to check the result of query_fn(), because there won't be another iteration
of the loop anyway. Also, both before and after the change, info->group
will eventually be set to NULL and the reference count of xfs_group will
also be decremented before exiting the iteration.

The same logic applies to other similar functions as well, so related
cleanup operations are performed together.

Signed-off-by: Zizhi Wo <wozizhi@huaweicloud.com>
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
---
 fs/xfs/xfs_fsmap.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
index 414b27a86458..792282aa8a29 100644
--- a/fs/xfs/xfs_fsmap.c
+++ b/fs/xfs/xfs_fsmap.c
@@ -579,8 +579,6 @@ __xfs_getfsmap_datadev(
 		if (pag_agno(pag) == end_ag) {
 			info->last = true;
 			error = query_fn(tp, info, &bt_cur, priv);
-			if (error)
-				break;
 		}
 		info->group = NULL;
 	}
@@ -813,8 +811,6 @@ xfs_getfsmap_rtdev_rtbitmap(
 			info->last = true;
 			error = xfs_getfsmap_rtdev_rtbitmap_helper(rtg, tp,
 					&ahigh, info);
-			if (error)
-				break;
 		}
 
 		xfs_rtgroup_unlock(rtg, XFS_RTGLOCK_BITMAP_SHARED);
@@ -1018,8 +1014,6 @@ xfs_getfsmap_rtdev_rmapbt(
 			info->last = true;
 			error = xfs_getfsmap_rtdev_rmapbt_helper(bt_cur,
 					&info->high, info);
-			if (error)
-				break;
 		}
 		info->group = NULL;
 	}
-- 
2.39.2


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

end of thread, other threads:[~2025-05-21  5:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17  7:43 [PATCH] xfs: Remove unnecessary checks in functions related to xfs_fsmap Zizhi Wo
2025-05-19  6:35 ` Nirjhar Roy (IBM)
2025-05-19 15:08 ` Darrick J. Wong
2025-05-20 10:38   ` Carlos Maiolino
2025-05-20 11:57     ` Zizhi Wo
2025-05-20 12:47       ` Carlos Maiolino
2025-05-20 13:15         ` Zizhi Wo
2025-05-21  5:57     ` Nirjhar Roy (IBM)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).