xref: /linux/fs/xfs/scrub/reap.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2022-2023 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <djwong@kernel.org>
5  */
6 #ifndef __XFS_SCRUB_REAP_H__
7 #define __XFS_SCRUB_REAP_H__
8 
9 struct xagb_bitmap;
10 struct xfsb_bitmap;
11 
12 int xrep_reap_agblocks(struct xfs_scrub *sc, struct xagb_bitmap *bitmap,
13 		const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
14 int xrep_reap_fsblocks(struct xfs_scrub *sc, struct xfsb_bitmap *bitmap,
15 		const struct xfs_owner_info *oinfo);
16 int xrep_reap_ifork(struct xfs_scrub *sc, struct xfs_inode *ip, int whichfork);
17 
18 /* Buffer cache scan context. */
19 struct xrep_bufscan {
20 	/* Disk address for the buffers we want to scan. */
21 	xfs_daddr_t		daddr;
22 
23 	/* Maximum number of sectors to scan. */
24 	xfs_daddr_t		max_sectors;
25 
26 	/* Each round, increment the search length by this number of sectors. */
27 	xfs_daddr_t		daddr_step;
28 
29 	/* Internal scan state; initialize to zero. */
30 	xfs_daddr_t		__sector_count;
31 };
32 
33 xfs_daddr_t xrep_bufscan_max_sectors(struct xfs_mount *mp,
34 		xfs_extlen_t fsblocks);
35 struct xfs_buf *xrep_bufscan_advance(struct xfs_mount *mp,
36 		struct xrep_bufscan *scan);
37 
38 #endif /* __XFS_SCRUB_REAP_H__ */
39