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 9e7ee96dfSDarrick J. Wong /* 10e7ee96dfSDarrick J. Wong * Return codes for the inode/inobt walk function are 0 to continue iterating, 11e7ee96dfSDarrick J. Wong * and non-zero to stop iterating. Any non-zero value will be passed up to the 12e7ee96dfSDarrick J. Wong * iwalk or inobt_walk caller. The special value -ECANCELED can be used to 13e7ee96dfSDarrick J. Wong * stop iteration, as neither iwalk nor inobt_walk will ever generate that 14e7ee96dfSDarrick J. Wong * error code on their own. 15e7ee96dfSDarrick J. Wong */ 16e7ee96dfSDarrick J. Wong 17a211432cSDarrick J. Wong /* Walk all inodes in the filesystem starting from @startino. */ 18a211432cSDarrick J. Wong typedef int (*xfs_iwalk_fn)(struct xfs_mount *mp, struct xfs_trans *tp, 19a211432cSDarrick J. Wong xfs_ino_t ino, void *data); 20a211432cSDarrick J. Wong 21a211432cSDarrick J. Wong int xfs_iwalk(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t startino, 2213d59a2aSDarrick J. Wong unsigned int flags, xfs_iwalk_fn iwalk_fn, 2313d59a2aSDarrick J. Wong unsigned int inode_records, void *data); 2440786717SDarrick J. Wong int xfs_iwalk_threaded(struct xfs_mount *mp, xfs_ino_t startino, 2513d59a2aSDarrick J. Wong unsigned int flags, xfs_iwalk_fn iwalk_fn, 2613d59a2aSDarrick J. Wong unsigned int inode_records, bool poll, void *data); 2713d59a2aSDarrick J. Wong 28*0a4d7974SChristoph Hellwig /* Only iterate within the same AG as @startino. */ 295b35d922SChandan Babu R #define XFS_IWALK_SAME_AG (1U << 0) 3013d59a2aSDarrick J. Wong 3113d59a2aSDarrick J. Wong #define XFS_IWALK_FLAGS_ALL (XFS_IWALK_SAME_AG) 32a211432cSDarrick J. Wong 3304b8fba2SDarrick J. Wong /* Walk all inode btree records in the filesystem starting from @startino. */ 3404b8fba2SDarrick J. Wong typedef int (*xfs_inobt_walk_fn)(struct xfs_mount *mp, struct xfs_trans *tp, 3504b8fba2SDarrick J. Wong xfs_agnumber_t agno, 3604b8fba2SDarrick J. Wong const struct xfs_inobt_rec_incore *irec, 3704b8fba2SDarrick J. Wong void *data); 3804b8fba2SDarrick J. Wong 3904b8fba2SDarrick J. Wong int xfs_inobt_walk(struct xfs_mount *mp, struct xfs_trans *tp, 4013d59a2aSDarrick J. Wong xfs_ino_t startino, unsigned int flags, 4113d59a2aSDarrick J. Wong xfs_inobt_walk_fn inobt_walk_fn, unsigned int inobt_records, 4213d59a2aSDarrick J. Wong void *data); 4313d59a2aSDarrick J. Wong 44a211432cSDarrick J. Wong #endif /* __XFS_IWALK_H__ */ 45