]>
Commit | Line | Data |
---|---|---|
8d318d62 | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
fd7d73c0 | 2 | /* |
52520522 | 3 | * Copyright (C) 2018-2024 Oracle. All Rights Reserved. |
8d318d62 | 4 | * Author: Darrick J. Wong <djwong@kernel.org> |
fd7d73c0 DW |
5 | */ |
6 | #ifndef XFS_SCRUB_SCRUB_H_ | |
7 | #define XFS_SCRUB_SCRUB_H_ | |
8 | ||
9 | /* Online scrub and repair. */ | |
10 | enum check_outcome { | |
11 | CHECK_DONE, /* no further processing needed */ | |
12 | CHECK_REPAIR, /* schedule this for repairs */ | |
13 | CHECK_ABORT, /* end program */ | |
14 | CHECK_RETRY, /* repair failed, try again later */ | |
15 | }; | |
16 | ||
ee310b0c DW |
17 | struct action_item; |
18 | ||
273165cc CH |
19 | void scrub_report_preen_triggers(struct scrub_ctx *ctx); |
20 | int scrub_primary_super(struct scrub_ctx *ctx, struct action_list *alist); | |
21 | int scrub_ag_headers(struct scrub_ctx *ctx, xfs_agnumber_t agno, | |
83d2c80b | 22 | struct action_list *alist); |
273165cc | 23 | int scrub_ag_metadata(struct scrub_ctx *ctx, xfs_agnumber_t agno, |
83d2c80b | 24 | struct action_list *alist); |
273165cc CH |
25 | int scrub_fs_metadata(struct scrub_ctx *ctx, struct action_list *alist); |
26 | int scrub_fs_summary(struct scrub_ctx *ctx, struct action_list *alist); | |
fd7d73c0 | 27 | |
273165cc CH |
28 | bool can_scrub_fs_metadata(struct scrub_ctx *ctx); |
29 | bool can_scrub_inode(struct scrub_ctx *ctx); | |
30 | bool can_scrub_bmap(struct scrub_ctx *ctx); | |
31 | bool can_scrub_dir(struct scrub_ctx *ctx); | |
32 | bool can_scrub_attr(struct scrub_ctx *ctx); | |
33 | bool can_scrub_symlink(struct scrub_ctx *ctx); | |
34 | bool can_scrub_parent(struct scrub_ctx *ctx); | |
19852474 | 35 | bool xfs_can_repair(struct scrub_ctx *ctx); |
c2371fdd | 36 | bool can_force_rebuild(struct scrub_ctx *ctx); |
fd7d73c0 | 37 | |
a7ee7b68 | 38 | int scrub_file(struct scrub_ctx *ctx, int fd, const struct xfs_bulkstat *bstat, |
3bc9ea15 | 39 | unsigned int type, struct action_list *alist); |
fd7d73c0 | 40 | |
19852474 | 41 | /* Repair parameters are the scrub inputs and retry count. */ |
ee310b0c | 42 | struct action_item { |
19852474 DW |
43 | struct list_head list; |
44 | __u64 ino; | |
45 | __u32 type; | |
46 | __u32 flags; | |
47 | __u32 gen; | |
48 | __u32 agno; | |
49 | }; | |
50 | ||
ee310b0c DW |
51 | /* |
52 | * Only ask the kernel to repair this object if the kernel directly told us it | |
53 | * was corrupt. Objects that are only flagged as having cross-referencing | |
54 | * errors or flagged as eligible for optimization are left for later. | |
55 | */ | |
19852474 DW |
56 | #define XRM_REPAIR_ONLY (1U << 0) |
57 | ||
58 | /* Complain if still broken even after fix. */ | |
06e49f3e | 59 | #define XRM_COMPLAIN_IF_UNFIXED (1U << 1) |
19852474 | 60 | |
bb9be147 DW |
61 | enum check_outcome xfs_repair_metadata(struct scrub_ctx *ctx, |
62 | struct xfs_fd *xfdp, struct action_item *aitem, | |
63 | unsigned int repair_flags); | |
19852474 | 64 | |
fd7d73c0 | 65 | #endif /* XFS_SCRUB_SCRUB_H_ */ |