[PATCH 1/5] xfs: add two wrappers for iterating ags in a AF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Shida Zhang <zhangshida@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux