fs.h (f2620e9ceb3ede0297da3c6eb743b5c3a42cd4f3) fs.h (34816cb9aeca7b0ad3289c2de04cad0cd1b111ed)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 118 unchanged lines hidden (view full) ---

127#define MAXVOLLEN 32
128
129/*
130 * There is a 128-byte region in the superblock reserved for in-core
131 * pointers to summary information. Originally this included an array
132 * of pointers to blocks of struct csum; now there are just a few
133 * pointers and the remaining space is padded with fs_ocsp[].
134 *
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 118 unchanged lines hidden (view full) ---

127#define MAXVOLLEN 32
128
129/*
130 * There is a 128-byte region in the superblock reserved for in-core
131 * pointers to summary information. Originally this included an array
132 * of pointers to blocks of struct csum; now there are just a few
133 * pointers and the remaining space is padded with fs_ocsp[].
134 *
135 * NOCSPTRS determines the size of this padding. One pointer (fs_csp)
136 * is taken away to point to a contiguous array of struct csum for
137 * all cylinder groups; a second (fs_maxcluster) points to an array
138 * of cluster sizes that is computed as cylinder groups are inspected,
139 * and the third points to an array that tracks the creation of new
140 * directories. A fourth pointer, fs_active, is used when creating
141 * snapshots; it points to a bitmap of cylinder groups for which the
142 * free-block bitmap has changed since the snapshot operation began.
135 * NOCSPTRS determines the size of this padding. Historically this
136 * space was used to store pointers to structures that summaried
137 * filesystem usage and layout information. However, these pointers
138 * left various kernel pointers in the superblock which made otherwise
139 * identical superblocks appear to have differences. So, all the
140 * pointers in the superblock were moved to a fs_summary_info structure
141 * reducing the superblock to having only a single pointer to this
142 * structure. When writing the superblock to disk, this pointer is
143 * temporarily NULL'ed out so that the kernel pointer will not appear
144 * in the on-disk copy of the superblock.
143 */
145 */
144#define NOCSPTRS ((128 / sizeof(void *)) - 4)
146#define NOCSPTRS ((128 / sizeof(void *)) - 1)
145
146/*
147 * A summary of contiguous blocks of various sizes is maintained
148 * in each cylinder group. Normally this is set by the initial
149 * value of fs_maxcontig. To conserve space, a maximum summary size
150 * is set by FS_MAXCONTIG.
151 */
152#define FS_MAXCONTIG 16

--- 112 unchanged lines hidden (view full) ---

265 int64_t cs_nbfree; /* number of free blocks */
266 int64_t cs_nifree; /* number of free inodes */
267 int64_t cs_nffree; /* number of free frags */
268 int64_t cs_numclusters; /* number of free clusters */
269 int64_t cs_spare[3]; /* future expansion */
270};
271
272/*
147
148/*
149 * A summary of contiguous blocks of various sizes is maintained
150 * in each cylinder group. Normally this is set by the initial
151 * value of fs_maxcontig. To conserve space, a maximum summary size
152 * is set by FS_MAXCONTIG.
153 */
154#define FS_MAXCONTIG 16

--- 112 unchanged lines hidden (view full) ---

267 int64_t cs_nbfree; /* number of free blocks */
268 int64_t cs_nifree; /* number of free inodes */
269 int64_t cs_nffree; /* number of free frags */
270 int64_t cs_numclusters; /* number of free clusters */
271 int64_t cs_spare[3]; /* future expansion */
272};
273
274/*
275 * Pointers to super block summary information. Placed in a separate
276 * structure so there is just one pointer in the superblock.
277 *
278 * The pointers in this structure are used as follows:
279 * fs_contigdirs references an array that tracks the creation of new
280 * directories
281 * fs_csp references a contiguous array of struct csum for
282 * all cylinder groups
283 * fs_maxcluster references an array of cluster sizes that is computed
284 * as cylinder groups are inspected
285 * fs_active is used when creating snapshots; it points to a bitmap
286 * of cylinder groups for which the free-block bitmap has changed
287 * since the snapshot operation began.
288 */
289struct fs_summary_info {
290 uint8_t *si_contigdirs; /* (u) # of contig. allocated dirs */
291 struct csum *si_csp; /* (u) cg summary info buffer */
292 int32_t *si_maxcluster; /* (u) max cluster in each cyl group */
293 u_int *si_active; /* (u) used by snapshots to track fs */
294};
295#define fs_contigdirs fs_si->si_contigdirs
296#define fs_csp fs_si->si_csp
297#define fs_maxcluster fs_si->si_maxcluster
298#define fs_active fs_si->si_active
299
300/*
273 * Super block for an FFS filesystem.
274 */
275struct fs {
276 int32_t fs_firstfield; /* historic filesystem linked list, */
277 int32_t fs_unused_1; /* used for incore super blocks */
278 int32_t fs_sblkno; /* offset of super-block in filesys */
279 int32_t fs_cblkno; /* offset of cyl-block in filesys */
280 int32_t fs_iblkno; /* offset of inode-blocks in filesys */

--- 54 unchanged lines hidden (view full) ---

335 int8_t fs_old_flags; /* old FS_ flags */
336 u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
337 u_char fs_volname[MAXVOLLEN]; /* volume name */
338 u_int64_t fs_swuid; /* system-wide uid */
339 int32_t fs_pad; /* due to alignment of fs_swuid */
340/* these fields retain the current block allocation info */
341 int32_t fs_cgrotor; /* last cg searched */
342 void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
301 * Super block for an FFS filesystem.
302 */
303struct fs {
304 int32_t fs_firstfield; /* historic filesystem linked list, */
305 int32_t fs_unused_1; /* used for incore super blocks */
306 int32_t fs_sblkno; /* offset of super-block in filesys */
307 int32_t fs_cblkno; /* offset of cyl-block in filesys */
308 int32_t fs_iblkno; /* offset of inode-blocks in filesys */

--- 54 unchanged lines hidden (view full) ---

363 int8_t fs_old_flags; /* old FS_ flags */
364 u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
365 u_char fs_volname[MAXVOLLEN]; /* volume name */
366 u_int64_t fs_swuid; /* system-wide uid */
367 int32_t fs_pad; /* due to alignment of fs_swuid */
368/* these fields retain the current block allocation info */
369 int32_t fs_cgrotor; /* last cg searched */
370 void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
343 u_int8_t *fs_contigdirs; /* (u) # of contig. allocated dirs */
344 struct csum *fs_csp; /* (u) cg summary info buffer */
345 int32_t *fs_maxcluster; /* (u) max cluster in each cyl group */
346 u_int *fs_active; /* (u) used by snapshots to track fs */
371 struct fs_summary_info *fs_si;/* In-core pointer to summary info */
347 int32_t fs_old_cpc; /* cyl per cycle in postbl */
348 int32_t fs_maxbsize; /* maximum blocking factor permitted */
349 int64_t fs_unrefs; /* number of unreferenced inodes */
350 int64_t fs_providersize; /* size of underlying GEOM provider */
351 int64_t fs_metaspace; /* size of area reserved for metadata */
352 int64_t fs_sparecon64[13]; /* old rotation block list head */
353 int64_t fs_sblockactualloc; /* byte offset of this superblock */
354 int64_t fs_sblockloc; /* byte offset of standard superblock */

--- 487 unchanged lines hidden ---
372 int32_t fs_old_cpc; /* cyl per cycle in postbl */
373 int32_t fs_maxbsize; /* maximum blocking factor permitted */
374 int64_t fs_unrefs; /* number of unreferenced inodes */
375 int64_t fs_providersize; /* size of underlying GEOM provider */
376 int64_t fs_metaspace; /* size of area reserved for metadata */
377 int64_t fs_sparecon64[13]; /* old rotation block list head */
378 int64_t fs_sblockactualloc; /* byte offset of this superblock */
379 int64_t fs_sblockloc; /* byte offset of standard superblock */

--- 487 unchanged lines hidden ---