]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/globals.h
Perform parallel processing based on AG stride/concat unit
[thirdparty/xfsprogs-dev.git] / repair / globals.h
1 /*
2 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef _XFS_REPAIR_GLOBAL_H
20 #define _XFS_REPAIR_GLOBAL_H
21
22 #ifndef EXTERN
23 #define EXTERN extern
24 #endif
25
26 /* useful macros */
27
28 #define rounddown(x, y) (((x)/(y))*(y))
29
30 /* error flags */
31
32 #define XR_OK 0 /* good */
33 #define XR_BAD_MAGIC 1 /* bad magic number */
34 #define XR_BAD_BLOCKSIZE 2 /* bad block size */
35 #define XR_BAD_BLOCKLOG 3 /* bad sb_blocklog field */
36 #define XR_BAD_VERSION 4 /* bad version number */
37 #define XR_BAD_INPROGRESS 5 /* in progress set */
38 #define XR_BAD_FS_SIZE_DATA 6 /* ag sizes, number, fs size mismatch */
39 #define XR_BAD_INO_SIZE_DATA 7 /* bad inode size or perblock fields */
40 #define XR_BAD_SECT_SIZE_DATA 8 /* bad sector size info */
41 #define XR_AGF_GEO_MISMATCH 9 /* agf info conflicts with sb */
42 #define XR_AGI_GEO_MISMATCH 10 /* agf info conflicts with sb */
43 #define XR_SB_GEO_MISMATCH 11 /* sb geo conflicts with fs sb geo */
44 #define XR_EOF 12 /* seeked beyond EOF */
45 #define XR_BAD_RT_GEO_DATA 13 /* realtime geometry inconsistent */
46 #define XR_BAD_INO_MAX_PCT 14 /* max % of inodes > 100% */
47 #define XR_BAD_INO_ALIGN 15 /* bad inode alignment value */
48 #define XR_INSUFF_SEC_SB 16 /* not enough matching secondary sbs */
49 #define XR_BAD_SB_UNIT 17 /* bad stripe unit */
50 #define XR_BAD_SB_WIDTH 18 /* bad stripe width */
51 #define XR_BAD_SVN 19 /* bad shared version number */
52 #define XR_BAD_ERR_CODE 20 /* Bad error code */
53
54 /* XFS filesystem (il)legal values */
55
56 #define XR_LOG2BSIZE_MIN 9 /* min/max fs blocksize (log2) */
57 #define XR_LOG2BSIZE_MAX 16 /* 2^XR_* == blocksize */
58
59 #define NUM_SBS 8 /* max # of sbs to verify */
60 #define NUM_AGH_SECTS 4 /* # of components in an ag header */
61
62 /*
63 * secondary sb mask -- if the secondary sb feature bits has a
64 * the partial sb mask bit set, then you depend on the fields
65 * in it up to and including sb_inoalignmt but the unused part of the
66 * sector may have trash in it. If the sb has any bits set that are in
67 * the good mask, then the entire sb and sector are good (was bzero'ed
68 * by mkfs). The third mask is for filesystems made by pre-6.5 campus
69 * alpha mkfs's. Those are rare so we'll check for those under
70 * a special option.
71 */
72 #define XR_PART_SECSB_VNMASK 0x0F80 /* >= XFS_SB_VERSION_ALIGNBIT */
73 #define XR_GOOD_SECSB_VNMASK 0x0F00 /* >= XFS_SB_VERSION_DALIGNBIT */
74 #define XR_ALPHA_SECSB_VNMASK 0x0180 /* DALIGN|ALIGN bits */
75
76 /* global variables for xfs_repair */
77
78 /* arguments and argument flag variables */
79
80 EXTERN char *fs_name; /* name of filesystem */
81 EXTERN int verbose; /* verbose flag, mostly for debugging */
82
83
84 /* for reading stuff in manually (bypassing libsim) */
85
86 EXTERN char *iobuf; /* large buffer */
87 EXTERN int iobuf_size;
88 EXTERN char *smallbuf; /* small (1-4 page) buffer */
89 EXTERN int smallbuf_size;
90 EXTERN char *sb_bufs[NUM_SBS]; /* superblock buffers */
91 EXTERN int sbbuf_size;
92
93 /* direct I/O info */
94
95 EXTERN int minio_align; /* min I/O size and alignment */
96 EXTERN int mem_align; /* memory alignment */
97 EXTERN int max_iosize; /* max I/O size */
98
99 /* file descriptors */
100
101 EXTERN int fs_fd; /* filesystem fd */
102
103 /* command-line flags */
104
105 EXTERN int verbose;
106 EXTERN int no_modify;
107 EXTERN int dangerously; /* live dangerously ... fix ro mount */
108 EXTERN int isa_file;
109 EXTERN int zap_log;
110 EXTERN int dumpcore; /* abort, not exit on fatal errs */
111 EXTERN int delete_attr_ok; /* can clear attrs w/o clearing files */
112 EXTERN int force_geo; /* can set geo on low confidence info */
113 EXTERN int assume_xfs; /* assume we have an xfs fs */
114 EXTERN int pre_65_beta; /* fs was mkfs'ed by a version earlier * than 6.5-beta */
115 EXTERN char *log_name; /* Name of log device */
116 EXTERN int log_spec; /* Log dev specified as option */
117 EXTERN char *rt_name; /* Name of realtime device */
118 EXTERN int rt_spec; /* Realtime dev specified as option */
119
120 /* misc status variables */
121
122 EXTERN int primary_sb_modified;
123 EXTERN int bad_ino_btree;
124 EXTERN int clear_sunit;
125 EXTERN int fs_is_dirty;
126
127 /* for hunting down the root inode */
128
129 EXTERN int need_root_inode;
130 EXTERN int need_root_dotdot;
131
132 EXTERN int need_rbmino;
133 EXTERN int need_rsumino;
134
135 EXTERN int lost_quotas;
136 EXTERN int have_uquotino;
137 EXTERN int have_gquotino;
138 EXTERN int lost_uquotino;
139 EXTERN int lost_gquotino;
140 EXTERN int lost_pquotino;
141
142 EXTERN xfs_agino_t first_prealloc_ino;
143 EXTERN xfs_agino_t last_prealloc_ino;
144 EXTERN xfs_agblock_t bnobt_root;
145 EXTERN xfs_agblock_t bcntbt_root;
146 EXTERN xfs_agblock_t inobt_root;
147
148 /* configuration vars -- fs geometry dependent */
149
150 EXTERN int inodes_per_block;
151 EXTERN int inodes_per_cluster; /* inodes per inode buffer */
152 EXTERN unsigned int glob_agcount;
153 EXTERN int chunks_pblock; /* # of 64-ino chunks per allocation */
154 EXTERN int max_symlink_blocks;
155 EXTERN __int64_t fs_max_file_offset;
156
157 /* block allocation bitmaps */
158
159 EXTERN __uint64_t **ba_bmap; /* see incore.h */
160 EXTERN __uint64_t *rt_ba_bmap; /* see incore.h */
161
162 /* realtime info */
163
164 EXTERN xfs_rtword_t *btmcompute;
165 EXTERN xfs_suminfo_t *sumcompute;
166
167 /* inode tree records have full or partial backptr fields ? */
168
169 EXTERN int full_ino_ex_data;/*
170 * if 1, use ino_ex_data_t component
171 * of ino_un union, if 0, use
172 * parent_list_t component. see
173 * incore.h for more details
174 */
175
176 #define ORPHANAGE "lost+found"
177
178 /* superblock counters */
179
180 EXTERN __uint64_t sb_icount; /* allocated (made) inodes */
181 EXTERN __uint64_t sb_ifree; /* free inodes */
182 EXTERN __uint64_t sb_fdblocks; /* free data blocks */
183 EXTERN __uint64_t sb_frextents; /* free realtime extents */
184
185 EXTERN xfs_ino_t orphanage_ino;
186 EXTERN xfs_ino_t old_orphanage_ino;
187
188 /* superblock geometry info */
189
190 EXTERN xfs_extlen_t sb_inoalignmt;
191 EXTERN __uint32_t sb_unit;
192 EXTERN __uint32_t sb_width;
193
194 extern size_t ts_dirbuf_size;
195 extern size_t ts_dir_freemap_size;
196 extern size_t ts_attr_freemap_size;
197
198 EXTERN pthread_rwlock_t *per_ag_lock;
199
200 EXTERN int report_interval;
201 EXTERN __uint64_t *prog_rpt_done;
202
203 EXTERN int ag_stride;
204
205 #endif /* _XFS_REPAIR_GLOBAL_H */