]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
fd7d73c0 DW |
2 | /* |
3 | * Copyright (C) 2018 Oracle. All Rights Reserved. | |
fd7d73c0 | 4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> |
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 | ||
fd7d73c0 | 19 | void xfs_scrub_report_preen_triggers(struct scrub_ctx *ctx); |
ee310b0c DW |
20 | bool xfs_scrub_primary_super(struct scrub_ctx *ctx, |
21 | struct xfs_action_list *alist); | |
22 | bool xfs_scrub_ag_headers(struct scrub_ctx *ctx, xfs_agnumber_t agno, | |
23 | struct xfs_action_list *alist); | |
24 | bool xfs_scrub_ag_metadata(struct scrub_ctx *ctx, xfs_agnumber_t agno, | |
25 | struct xfs_action_list *alist); | |
26 | bool xfs_scrub_fs_metadata(struct scrub_ctx *ctx, | |
27 | struct xfs_action_list *alist); | |
28 | enum check_outcome xfs_repair_metadata(struct scrub_ctx *ctx, int fd, | |
29 | struct action_item *aitem, unsigned int flags); | |
fd7d73c0 DW |
30 | |
31 | bool xfs_can_scrub_fs_metadata(struct scrub_ctx *ctx); | |
32 | bool xfs_can_scrub_inode(struct scrub_ctx *ctx); | |
33 | bool xfs_can_scrub_bmap(struct scrub_ctx *ctx); | |
34 | bool xfs_can_scrub_dir(struct scrub_ctx *ctx); | |
35 | bool xfs_can_scrub_attr(struct scrub_ctx *ctx); | |
36 | bool xfs_can_scrub_symlink(struct scrub_ctx *ctx); | |
37 | bool xfs_can_scrub_parent(struct scrub_ctx *ctx); | |
19852474 | 38 | bool xfs_can_repair(struct scrub_ctx *ctx); |
fd7d73c0 DW |
39 | |
40 | bool xfs_scrub_inode_fields(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, | |
ee310b0c | 41 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 42 | bool xfs_scrub_data_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 43 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 44 | bool xfs_scrub_attr_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 45 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 46 | bool xfs_scrub_cow_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 47 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 48 | bool xfs_scrub_dir(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 49 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 50 | bool xfs_scrub_attr(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 51 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 52 | bool xfs_scrub_symlink(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 53 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 54 | bool xfs_scrub_parent(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen, |
ee310b0c | 55 | int fd, struct xfs_action_list *alist); |
fd7d73c0 | 56 | |
19852474 | 57 | /* Repair parameters are the scrub inputs and retry count. */ |
ee310b0c | 58 | struct action_item { |
19852474 DW |
59 | struct list_head list; |
60 | __u64 ino; | |
61 | __u32 type; | |
62 | __u32 flags; | |
63 | __u32 gen; | |
64 | __u32 agno; | |
65 | }; | |
66 | ||
ee310b0c DW |
67 | /* |
68 | * Only ask the kernel to repair this object if the kernel directly told us it | |
69 | * was corrupt. Objects that are only flagged as having cross-referencing | |
70 | * errors or flagged as eligible for optimization are left for later. | |
71 | */ | |
19852474 DW |
72 | #define XRM_REPAIR_ONLY (1U << 0) |
73 | ||
74 | /* Complain if still broken even after fix. */ | |
06e49f3e | 75 | #define XRM_COMPLAIN_IF_UNFIXED (1U << 1) |
19852474 DW |
76 | |
77 | enum check_outcome xfs_repair_metadata(struct scrub_ctx *ctx, int fd, | |
ee310b0c | 78 | struct action_item *aitem, unsigned int repair_flags); |
19852474 | 79 | |
fd7d73c0 | 80 | #endif /* XFS_SCRUB_SCRUB_H_ */ |