[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241104014439.3786609-2-zhangshida@kylinos.cn>
Date: Mon, 4 Nov 2024 09:44:35 +0800
From: zhangshida <starzhangzsd@...il.com>
To: djwong@...nel.org,
dchinner@...hat.com,
leo.lilong@...wei.com,
wozizhi@...wei.com,
osandov@...com,
xiang@...nel.org,
zhangjiachen.jaycee@...edance.com
Cc: linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
zhangshida@...inos.cn,
starzhangzsd@...il.com
Subject: [PATCH 1/5] xfs: add two wrappers for iterating ags in a AF
From: Shida Zhang <zhangshida@...inos.cn>
As indicated by the diagram:
|<--------+ af 0 +--------->|
|----------------------------
| ag 0 | ag 1 | ag 2 | ag 3 |
+--------------------------------
|----------2-->|----1--->| |
curr_af start next_af-1 next_af
1.First iterate over [start, next_af).
2.Then [restart, start).
Signed-off-by: Shida Zhang <zhangshida@...inos.cn>
---
fs/xfs/libxfs/xfs_ag.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
index 9edfe0e96439..0c6b7fe5194f 100644
--- a/fs/xfs/libxfs/xfs_ag.h
+++ b/fs/xfs/libxfs/xfs_ag.h
@@ -311,6 +311,23 @@ xfs_perag_next_wrap(
for_each_perag_wrap_at((mp), (start_agno), (mp)->m_sb.sb_agcount, \
(agno), (pag))
+/*
+ * Iterate all AGs from start_agno through wrap_agno, then curr_af through
+ * (start_agno - 1).
+ */
+#define for_each_perag_af_wrap_at(mp, start_agno, wrap_agno, agno, pag, curr_af) \
+ for_each_perag_wrap_range((mp), (start_agno), (curr_af), (wrap_agno), (agno), \
+ (pag))
+
+/*
+ * Iterate all AGs from start_agno through to the end of the AF, then curr_af
+ * through (start_agno - 1).
+ */
+#define for_each_perag_af_wrap(mp, start_agno, agno, pag, curr_af, next_af) \
+ for_each_perag_af_wrap_at((mp), (start_agno), (next_af), (agno), (pag), \
+ (curr_af))
+
+
struct aghdr_init_data {
/* per ag data */
--
2.33.0
Powered by blists - more mailing lists