xref: /linux/fs/xfs/xfs_iwalk.h (revision 13d59a2a61cbbb4cda13a0cba6d4d1fc537f5dd4)
1a211432cSDarrick J. Wong /* SPDX-License-Identifier: GPL-2.0-or-later */
2a211432cSDarrick J. Wong /*
3a211432cSDarrick J. Wong  * Copyright (C) 2019 Oracle.  All Rights Reserved.
4a211432cSDarrick J. Wong  * Author: Darrick J. Wong <darrick.wong@oracle.com>
5a211432cSDarrick J. Wong  */
6a211432cSDarrick J. Wong #ifndef __XFS_IWALK_H__
7a211432cSDarrick J. Wong #define __XFS_IWALK_H__
8a211432cSDarrick J. Wong 
9a211432cSDarrick J. Wong /* Walk all inodes in the filesystem starting from @startino. */
10a211432cSDarrick J. Wong typedef int (*xfs_iwalk_fn)(struct xfs_mount *mp, struct xfs_trans *tp,
11a211432cSDarrick J. Wong 			    xfs_ino_t ino, void *data);
12a211432cSDarrick J. Wong /* Return values for xfs_iwalk_fn. */
13a211432cSDarrick J. Wong #define XFS_IWALK_CONTINUE	(XFS_ITER_CONTINUE)
14a211432cSDarrick J. Wong #define XFS_IWALK_ABORT		(XFS_ITER_ABORT)
15a211432cSDarrick J. Wong 
16a211432cSDarrick J. Wong int xfs_iwalk(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t startino,
17*13d59a2aSDarrick J. Wong 		unsigned int flags, xfs_iwalk_fn iwalk_fn,
18*13d59a2aSDarrick J. Wong 		unsigned int inode_records, void *data);
1940786717SDarrick J. Wong int xfs_iwalk_threaded(struct xfs_mount *mp, xfs_ino_t startino,
20*13d59a2aSDarrick J. Wong 		unsigned int flags, xfs_iwalk_fn iwalk_fn,
21*13d59a2aSDarrick J. Wong 		unsigned int inode_records, bool poll, void *data);
22*13d59a2aSDarrick J. Wong 
23*13d59a2aSDarrick J. Wong /* Only iterate inodes within the same AG as @startino. */
24*13d59a2aSDarrick J. Wong #define XFS_IWALK_SAME_AG	(0x1)
25*13d59a2aSDarrick J. Wong 
26*13d59a2aSDarrick J. Wong #define XFS_IWALK_FLAGS_ALL	(XFS_IWALK_SAME_AG)
27a211432cSDarrick J. Wong 
2804b8fba2SDarrick J. Wong /* Walk all inode btree records in the filesystem starting from @startino. */
2904b8fba2SDarrick J. Wong typedef int (*xfs_inobt_walk_fn)(struct xfs_mount *mp, struct xfs_trans *tp,
3004b8fba2SDarrick J. Wong 				 xfs_agnumber_t agno,
3104b8fba2SDarrick J. Wong 				 const struct xfs_inobt_rec_incore *irec,
3204b8fba2SDarrick J. Wong 				 void *data);
3304b8fba2SDarrick J. Wong /* Return value (for xfs_inobt_walk_fn) that aborts the walk immediately. */
3404b8fba2SDarrick J. Wong #define XFS_INOBT_WALK_ABORT	(XFS_IWALK_ABORT)
3504b8fba2SDarrick J. Wong 
3604b8fba2SDarrick J. Wong int xfs_inobt_walk(struct xfs_mount *mp, struct xfs_trans *tp,
37*13d59a2aSDarrick J. Wong 		xfs_ino_t startino, unsigned int flags,
38*13d59a2aSDarrick J. Wong 		xfs_inobt_walk_fn inobt_walk_fn, unsigned int inobt_records,
39*13d59a2aSDarrick J. Wong 		void *data);
40*13d59a2aSDarrick J. Wong 
41*13d59a2aSDarrick J. Wong /* Only iterate inobt records within the same AG as @startino. */
42*13d59a2aSDarrick J. Wong #define XFS_INOBT_WALK_SAME_AG	(XFS_IWALK_SAME_AG)
43*13d59a2aSDarrick J. Wong 
44*13d59a2aSDarrick J. Wong #define XFS_INOBT_WALK_FLAGS_ALL (XFS_INOBT_WALK_SAME_AG)
4504b8fba2SDarrick J. Wong 
46a211432cSDarrick J. Wong #endif /* __XFS_IWALK_H__ */
47