Lines Matching +full:super +full:- +full:set
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
43 * A filesystem is described by its super-block, which in turn
44 * describes the cylinder groups. The super-block is critical
47 * super-block data does not change, so the copies need not be
51 * are given in the super block as:
52 * [fs->fs_sblkno] Super-block
53 * [fs->fs_cblkno] Cylinder group block
54 * [fs->fs_iblkno] Inode blocks
55 * [fs->fs_dblkno] Data blocks
67 * given in byte-offset form, so they do not imply a sector size. The
76 { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
80 #define UFS_STDSB -1 /* Search standard places for superblock */
109 #define UFS_NOHASHFAIL 0x0001 /* Ignore check-hash failure */
110 #define UFS_NOWARNFAIL 0x0003 /* Ignore non-fatal inconsistencies */
144 * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.
147 * Note that super blocks are always of size SBLOCKSIZE,
155 * the super block for this name.
166 * There is a 128-byte region in the superblock reserved for in-core
180 * in the on-disk copy of the superblock.
182 #define NOCSPTRS ((128 / sizeof(void *)) - 1)
186 * in each cylinder group. Normally this is set by the initial
188 * is set by FS_MAXCONTIG.
196 * be set to 0 if no reserve of free blocks is deemed necessary,
232 * BLK_NOCOPY - A block that was unallocated at the time the snapshot
234 * BLK_SNAP - A block held by another snapshot that is not needed by this
251 #define FFS_SET_FLAGS 6 /* set filesystem flags */
257 #define FFS_SET_CWD 12 /* set current directory */
258 #define FFS_SET_DOTDOT 13 /* set inode number for ".." */
262 #define FFS_SET_SIZE 17 /* set inode size */
285 int32_t fsr_sblkno; /* offset of super-block in filesys */
294 * super block.
312 * Pointers to super block summary information. Placed in a separate
323 * of cylinder groups for which the free-block bitmap has changed
332 #define fs_contigdirs fs_si->si_contigdirs
333 #define fs_csp fs_si->si_csp
334 #define fs_maxcluster fs_si->si_maxcluster
335 #define fs_active fs_si->si_active
338 * Super block for an FFS filesystem.
342 int32_t fs_unused_1; /* used for incore super blocks */
343 int32_t fs_sblkno; /* offset of super-block in filesys */
344 int32_t fs_cblkno; /* offset of cyl-block in filesys */
345 int32_t fs_iblkno; /* offset of inode-blocks in filesys */
371 int32_t fs_sbsize; /* actual size of super block */
394 /* this data must be re-computed after crashes */
397 int8_t fs_fmod; /* super block modified flag */
399 int8_t fs_ronly; /* mounted read-only flag */
403 uint64_t fs_swuid; /* system-wide uid */
408 struct fs_summary_info *fs_si;/* In-core pointer to summary info */
431 uint32_t fs_ckhash; /* if CK_SUPERBLOCK, its check-hash */
432 uint32_t fs_metackhash; /* metadata check-hash, see CK_ below */
436 int32_t fs_old_inodefmt; /* format of on-disk inodes */
438 int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
439 int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
459 #define FS_42INODEFMT -1 /* 4.2BSD inode format */
471 * The FS_UNCLEAN flag is set by the kernel when the filesystem was
472 * mounted with fs_clean set to zero. The FS_DOSOFTDEP flag indicates
474 * Note that the FS_NEEDSFSCK flag is set and cleared by the fsck
475 * utility. It is set when background fsck finds an unexpected
478 * disk error. The FS_NEEDSFSCK can also be set when a mounted filesystem
482 * flag to enforce that inconsistent filesystems be mounted read-only.
484 * The FS_METACKHASH flag when set indicates that the kernel maintains
485 * one or more check hashes. The actual set of supported check hashes
493 * structures associated with those features are out-of-date and need
510 #define FS_MULTILABEL 0x00000020 /* file system is MAC multi-label */
532 * The fs_metackhash field indicates the types of metadata check-hash
533 * that are maintained for a filesystem. Not all filesystems check-hash
556 #define ACTIVECGNUM(fs, cg) ((fs)->fs_active[(cg) / (NBBY * sizeof(uint64_t))])
559 if ((fs)->fs_active) \
563 if ((fs)->fs_active) \
575 /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) + \
576 /* old boff */ (fs)->fs_old_cpg * sizeof(uint16_t) + \
577 /* inode map */ howmany((fs)->fs_ipg, NBBY) + \
578 /* block map */ howmany((fs)->fs_fpg, NBBY) + sizeof(int32_t) + \
579 /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \
580 /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \
581 /* cluster map */ howmany(fragstoblks(fs, (fs)->fs_fpg), NBBY)))
622 uint32_t cg_ckhash; /* check-hash of this cg */
625 /* actually longer - space used for cylinder group maps */
631 #define cg_chkmagic(cgp) ((cgp)->cg_magic == CG_MAGIC)
633 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_iusedoff))
635 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_freeoff))
637 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_clusteroff))
639 ((int32_t *)((uintptr_t)(cgp) + (cgp)->cg_clustersumoff))
645 #define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb)
646 #define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
652 #define cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c))
653 #define cgdata(fs, c) (cgdmin(fs, c) + (fs)->fs_metaspace) /* data zone */
655 #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
656 #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
657 #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
658 #define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
660 ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \
661 (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask))))
669 #define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg)
672 (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs))))))
679 #define dtog(fs, d) ((d) / (fs)->fs_fpg)
680 #define dtogd(fs, d) ((d) % (fs)->fs_fpg)
687 (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
694 #define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
695 ((loc) & (fs)->fs_qbmask)
696 #define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
697 ((loc) & (fs)->fs_qfmask)
698 #define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
699 (((off_t)(frag)) << (fs)->fs_fshift)
700 #define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
701 (((off_t)(blk)) << (fs)->fs_bshift)
703 #define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
704 ((blk) << (fs)->fs_bshift)
705 #define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
706 ((loc) >> (fs)->fs_bshift)
707 #define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
708 ((loc) >> (fs)->fs_fshift)
709 #define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
710 (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
711 #define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
712 (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
713 #define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
714 ((frags) >> (fs)->fs_fragshift)
715 #define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
716 ((blks) << (fs)->fs_fragshift)
717 #define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
718 ((fsb) & ((fs)->fs_frag - 1))
719 #define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
720 ((fsb) &~ ((fs)->fs_frag - 1))
727 (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
728 (fs)->fs_cstotal.cs_nffree - \
729 (((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))
735 (((lbn) >= UFS_NDADDR || (ip)->i_size >= \
737 ? (fs)->fs_bsize \
738 : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
740 (((lbn) >= UFS_NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
741 ? (fs)->fs_bsize \
747 #define NINDIR(fs) ((fs)->fs_nindir)
752 * are this lbn - 1 and triple indirects are this lbn - 2. This yields
772 return (-1); in lbn_level()
780 for (res = 1; level > 0; level--) in lbn_offset()
788 #define INOPB(fs) ((fs)->fs_inopb)
789 #define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)
863 * Block record. A set of frags or tree of blocks starting at an indirect are
864 * freed or a set of frags are allocated.