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