/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2021 Oracle. All Rights Reserved. * Author: Darrick J. Wong */ #ifndef __XFS_SCRUB_ISCAN_H__ #define __XFS_SCRUB_ISCAN_H__ struct xchk_iscan { /* Lock to protect the scan cursor. */ struct mutex lock; /* This is the inode that is being scanned. */ xfs_ino_t cursor_ino; /* * This is the last inode that we've successfully scanned, either * because the caller scanned it, or we moved the cursor past an empty * part of the inode address space. Scan callers should only use the * xchk_iscan_visit function to modify this. */ xfs_ino_t __visited_ino; /* Operational state of the livescan. */ unsigned long __opstate; /* Number of times to try iget calls for any inode. */ unsigned int iget_tries; /* Wait this many jiffies for an iget retry. */ unsigned int iget_retry_delay; /* Number of tries remaining for iget of cursor_ino. Do not modify. */ unsigned int __cursor_tries; }; /* Set if the scan has been aborted due to some event in the fs. */ #define XCHK_ISCAN_OPSTATE_ABORTED (1) static inline bool xchk_iscan_aborted(const struct xchk_iscan *iscan) { return test_bit(XCHK_ISCAN_OPSTATE_ABORTED, &iscan->__opstate); } static inline void xchk_iscan_abort(struct xchk_iscan *iscan) { set_bit(XCHK_ISCAN_OPSTATE_ABORTED, &iscan->__opstate); } void xchk_iscan_start(struct xchk_iscan *iscan); void xchk_iscan_finish(struct xchk_iscan *iscan); int xchk_iscan_advance(struct xfs_scrub *sc, struct xchk_iscan *iscan); int xchk_iscan_iget(struct xfs_scrub *sc, struct xchk_iscan *iscan, struct xfs_inode **ipp); void xchk_iscan_mark_visited(struct xchk_iscan *iscan, struct xfs_inode *ip); bool xchk_iscan_want_live_update(struct xchk_iscan *iscan, xfs_ino_t ino); #endif /* __XFS_SCRUB_ISCAN_H__ */