xref: /linux/fs/xfs/xfs_iwalk.h (revision 40786717c88c2d4cb426cc2eb99ac50000e5a910)
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,
17a211432cSDarrick J. Wong 		xfs_iwalk_fn iwalk_fn, unsigned int inode_records, void *data);
18*40786717SDarrick J. Wong int xfs_iwalk_threaded(struct xfs_mount *mp, xfs_ino_t startino,
19*40786717SDarrick J. Wong 		xfs_iwalk_fn iwalk_fn, unsigned int inode_records, void *data);
20a211432cSDarrick J. Wong 
2104b8fba2SDarrick J. Wong /* Walk all inode btree records in the filesystem starting from @startino. */
2204b8fba2SDarrick J. Wong typedef int (*xfs_inobt_walk_fn)(struct xfs_mount *mp, struct xfs_trans *tp,
2304b8fba2SDarrick J. Wong 				 xfs_agnumber_t agno,
2404b8fba2SDarrick J. Wong 				 const struct xfs_inobt_rec_incore *irec,
2504b8fba2SDarrick J. Wong 				 void *data);
2604b8fba2SDarrick J. Wong /* Return value (for xfs_inobt_walk_fn) that aborts the walk immediately. */
2704b8fba2SDarrick J. Wong #define XFS_INOBT_WALK_ABORT	(XFS_IWALK_ABORT)
2804b8fba2SDarrick J. Wong 
2904b8fba2SDarrick J. Wong int xfs_inobt_walk(struct xfs_mount *mp, struct xfs_trans *tp,
3004b8fba2SDarrick J. Wong 		xfs_ino_t startino, xfs_inobt_walk_fn inobt_walk_fn,
3104b8fba2SDarrick J. Wong 		unsigned int inobt_records, void *data);
3204b8fba2SDarrick J. Wong 
33a211432cSDarrick J. Wong #endif /* __XFS_IWALK_H__ */
34