1
2
3
4
5
6#ifndef __XFS_HEALTH_H__
7#define __XFS_HEALTH_H__
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34struct xfs_mount;
35struct xfs_perag;
36struct xfs_inode;
37struct xfs_fsop_geom;
38
39
40#define XFS_SICK_FS_COUNTERS (1 << 0)
41#define XFS_SICK_FS_UQUOTA (1 << 1)
42#define XFS_SICK_FS_GQUOTA (1 << 2)
43#define XFS_SICK_FS_PQUOTA (1 << 3)
44
45
46#define XFS_SICK_RT_BITMAP (1 << 0)
47#define XFS_SICK_RT_SUMMARY (1 << 1)
48
49
50#define XFS_SICK_AG_SB (1 << 0)
51#define XFS_SICK_AG_AGF (1 << 1)
52#define XFS_SICK_AG_AGFL (1 << 2)
53#define XFS_SICK_AG_AGI (1 << 3)
54#define XFS_SICK_AG_BNOBT (1 << 4)
55#define XFS_SICK_AG_CNTBT (1 << 5)
56#define XFS_SICK_AG_INOBT (1 << 6)
57#define XFS_SICK_AG_FINOBT (1 << 7)
58#define XFS_SICK_AG_RMAPBT (1 << 8)
59#define XFS_SICK_AG_REFCNTBT (1 << 9)
60
61
62#define XFS_SICK_INO_CORE (1 << 0)
63#define XFS_SICK_INO_BMBTD (1 << 1)
64#define XFS_SICK_INO_BMBTA (1 << 2)
65#define XFS_SICK_INO_BMBTC (1 << 3)
66#define XFS_SICK_INO_DIR (1 << 4)
67#define XFS_SICK_INO_XATTR (1 << 5)
68#define XFS_SICK_INO_SYMLINK (1 << 6)
69#define XFS_SICK_INO_PARENT (1 << 7)
70
71
72#define XFS_SICK_FS_PRIMARY (XFS_SICK_FS_COUNTERS | \
73 XFS_SICK_FS_UQUOTA | \
74 XFS_SICK_FS_GQUOTA | \
75 XFS_SICK_FS_PQUOTA)
76
77#define XFS_SICK_RT_PRIMARY (XFS_SICK_RT_BITMAP | \
78 XFS_SICK_RT_SUMMARY)
79
80#define XFS_SICK_AG_PRIMARY (XFS_SICK_AG_SB | \
81 XFS_SICK_AG_AGF | \
82 XFS_SICK_AG_AGFL | \
83 XFS_SICK_AG_AGI | \
84 XFS_SICK_AG_BNOBT | \
85 XFS_SICK_AG_CNTBT | \
86 XFS_SICK_AG_INOBT | \
87 XFS_SICK_AG_FINOBT | \
88 XFS_SICK_AG_RMAPBT | \
89 XFS_SICK_AG_REFCNTBT)
90
91#define XFS_SICK_INO_PRIMARY (XFS_SICK_INO_CORE | \
92 XFS_SICK_INO_BMBTD | \
93 XFS_SICK_INO_BMBTA | \
94 XFS_SICK_INO_BMBTC | \
95 XFS_SICK_INO_DIR | \
96 XFS_SICK_INO_XATTR | \
97 XFS_SICK_INO_SYMLINK | \
98 XFS_SICK_INO_PARENT)
99
100
101
102void xfs_fs_mark_sick(struct xfs_mount *mp, unsigned int mask);
103void xfs_fs_mark_healthy(struct xfs_mount *mp, unsigned int mask);
104void xfs_fs_measure_sickness(struct xfs_mount *mp, unsigned int *sick,
105 unsigned int *checked);
106
107void xfs_rt_mark_sick(struct xfs_mount *mp, unsigned int mask);
108void xfs_rt_mark_healthy(struct xfs_mount *mp, unsigned int mask);
109void xfs_rt_measure_sickness(struct xfs_mount *mp, unsigned int *sick,
110 unsigned int *checked);
111
112void xfs_ag_mark_sick(struct xfs_perag *pag, unsigned int mask);
113void xfs_ag_mark_healthy(struct xfs_perag *pag, unsigned int mask);
114void xfs_ag_measure_sickness(struct xfs_perag *pag, unsigned int *sick,
115 unsigned int *checked);
116
117void xfs_inode_mark_sick(struct xfs_inode *ip, unsigned int mask);
118void xfs_inode_mark_healthy(struct xfs_inode *ip, unsigned int mask);
119void xfs_inode_measure_sickness(struct xfs_inode *ip, unsigned int *sick,
120 unsigned int *checked);
121
122void xfs_health_unmount(struct xfs_mount *mp);
123
124
125
126static inline bool
127xfs_fs_has_sickness(struct xfs_mount *mp, unsigned int mask)
128{
129 unsigned int sick, checked;
130
131 xfs_fs_measure_sickness(mp, &sick, &checked);
132 return sick & mask;
133}
134
135static inline bool
136xfs_rt_has_sickness(struct xfs_mount *mp, unsigned int mask)
137{
138 unsigned int sick, checked;
139
140 xfs_rt_measure_sickness(mp, &sick, &checked);
141 return sick & mask;
142}
143
144static inline bool
145xfs_ag_has_sickness(struct xfs_perag *pag, unsigned int mask)
146{
147 unsigned int sick, checked;
148
149 xfs_ag_measure_sickness(pag, &sick, &checked);
150 return sick & mask;
151}
152
153static inline bool
154xfs_inode_has_sickness(struct xfs_inode *ip, unsigned int mask)
155{
156 unsigned int sick, checked;
157
158 xfs_inode_measure_sickness(ip, &sick, &checked);
159 return sick & mask;
160}
161
162static inline bool
163xfs_fs_is_healthy(struct xfs_mount *mp)
164{
165 return !xfs_fs_has_sickness(mp, -1U);
166}
167
168static inline bool
169xfs_rt_is_healthy(struct xfs_mount *mp)
170{
171 return !xfs_rt_has_sickness(mp, -1U);
172}
173
174static inline bool
175xfs_ag_is_healthy(struct xfs_perag *pag)
176{
177 return !xfs_ag_has_sickness(pag, -1U);
178}
179
180static inline bool
181xfs_inode_is_healthy(struct xfs_inode *ip)
182{
183 return !xfs_inode_has_sickness(ip, -1U);
184}
185
186void xfs_fsop_geom_health(struct xfs_mount *mp, struct xfs_fsop_geom *geo);
187void xfs_ag_geom_health(struct xfs_perag *pag, struct xfs_ag_geometry *ageo);
188void xfs_bulkstat_health(struct xfs_inode *ip, struct xfs_bulkstat *bs);
189
190#endif
191