]>
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); |
bd35f31c DW |
25 | int scrub_fs_metadata(struct scrub_ctx *ctx, unsigned int scrub_type, |
26 | struct action_list *alist); | |
48508407 DW |
27 | int scrub_summary_metadata(struct scrub_ctx *ctx, struct action_list *alist); |
28 | int scrub_fs_counters(struct scrub_ctx *ctx, struct action_list *alist); | |
fd7d73c0 | 29 | |
273165cc CH |
30 | bool can_scrub_fs_metadata(struct scrub_ctx *ctx); |
31 | bool can_scrub_inode(struct scrub_ctx *ctx); | |
32 | bool can_scrub_bmap(struct scrub_ctx *ctx); | |
33 | bool can_scrub_dir(struct scrub_ctx *ctx); | |
34 | bool can_scrub_attr(struct scrub_ctx *ctx); | |
35 | bool can_scrub_symlink(struct scrub_ctx *ctx); | |
36 | bool can_scrub_parent(struct scrub_ctx *ctx); | |
19852474 | 37 | bool xfs_can_repair(struct scrub_ctx *ctx); |
c2371fdd | 38 | bool can_force_rebuild(struct scrub_ctx *ctx); |
fd7d73c0 | 39 | |
a7ee7b68 | 40 | int scrub_file(struct scrub_ctx *ctx, int fd, const struct xfs_bulkstat *bstat, |
3bc9ea15 | 41 | unsigned int type, struct action_list *alist); |
fd7d73c0 | 42 | |
19852474 | 43 | /* Repair parameters are the scrub inputs and retry count. */ |
ee310b0c | 44 | struct action_item { |
19852474 DW |
45 | struct list_head list; |
46 | __u64 ino; | |
47 | __u32 type; | |
48 | __u32 flags; | |
49 | __u32 gen; | |
50 | __u32 agno; | |
51 | }; | |
52 | ||
ee310b0c DW |
53 | /* |
54 | * Only ask the kernel to repair this object if the kernel directly told us it | |
55 | * was corrupt. Objects that are only flagged as having cross-referencing | |
56 | * errors or flagged as eligible for optimization are left for later. | |
57 | */ | |
19852474 DW |
58 | #define XRM_REPAIR_ONLY (1U << 0) |
59 | ||
60 | /* Complain if still broken even after fix. */ | |
06e49f3e | 61 | #define XRM_COMPLAIN_IF_UNFIXED (1U << 1) |
19852474 | 62 | |
bb9be147 DW |
63 | enum check_outcome xfs_repair_metadata(struct scrub_ctx *ctx, |
64 | struct xfs_fd *xfdp, struct action_item *aitem, | |
65 | unsigned int repair_flags); | |
19852474 | 66 | |
fd7d73c0 | 67 | #endif /* XFS_SCRUB_SCRUB_H_ */ |