Lines Matching +full:multi +full:- +full:cluster

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
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 */
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)
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
285 int32_t fsr_sblkno; /* offset of super-block in filesys */
320 * fs_maxcluster references an array of cluster sizes that is computed
323 * of cylinder groups for which the free-block bitmap has changed
329 int32_t *si_maxcluster; /* (u) max cluster in each cyl group */
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
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 */
394 /* this data must be re-computed after crashes */
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 */
432 uint32_t fs_ckhash; /* if CK_SUPERBLOCK, its check-hash */
433 uint32_t fs_metackhash; /* metadata check-hash, see CK_ below */
435 int32_t fs_contigsumsize; /* size of cluster summary array */
437 int32_t fs_old_inodefmt; /* format of on-disk inodes */
439 int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
440 int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
460 #define FS_42INODEFMT -1 /* 4.2BSD inode format */
483 * flag to enforce that inconsistent filesystems be mounted read-only.
494 * structures associated with those features are out-of-date and need
511 #define FS_MULTILABEL 0x00000020 /* file system is MAC multi-label */
533 * The fs_metackhash field indicates the types of metadata check-hash
534 * that are maintained for a filesystem. Not all filesystems check-hash
557 #define ACTIVECGNUM(fs, cg) ((fs)->fs_active[(cg) / (NBBY * sizeof(uint64_t))])
560 if ((fs)->fs_active) \
564 if ((fs)->fs_active) \
576 /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) + \
577 /* old boff */ (fs)->fs_old_cpg * sizeof(uint16_t) + \
578 /* inode map */ howmany((fs)->fs_ipg, NBBY) + \
579 /* block map */ howmany((fs)->fs_fpg, NBBY) + sizeof(int32_t) + \
580 /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \
581 /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \
582 /* cluster map */ howmany(fragstoblks(fs, (fs)->fs_fpg), NBBY)))
617 uint32_t cg_clusteroff; /* (uint8) free cluster map */
623 uint32_t cg_ckhash; /* check-hash of this cg */
626 /* actually longer - space used for cylinder group maps */
632 #define cg_chkmagic(cgp) ((cgp)->cg_magic == CG_MAGIC)
634 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_iusedoff))
636 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_freeoff))
638 ((uint8_t *)((uint8_t *)(cgp) + (cgp)->cg_clusteroff))
640 ((int32_t *)((uintptr_t)(cgp) + (cgp)->cg_clustersumoff))
646 #define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb)
647 #define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
653 #define cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c))
654 #define cgdata(fs, c) (cgdmin(fs, c) + (fs)->fs_metaspace) /* data zone */
656 #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
657 #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
658 #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
659 #define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
661 ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \
662 (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask))))
670 #define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg)
673 (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs))))))
680 #define dtog(fs, d) ((d) / (fs)->fs_fpg)
681 #define dtogd(fs, d) ((d) % (fs)->fs_fpg)
688 (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
695 #define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
696 ((loc) & (fs)->fs_qbmask)
697 #define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
698 ((loc) & (fs)->fs_qfmask)
699 #define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
700 (((off_t)(frag)) << (fs)->fs_fshift)
701 #define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
702 (((off_t)(blk)) << (fs)->fs_bshift)
704 #define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
705 ((blk) << (fs)->fs_bshift)
706 #define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
707 ((loc) >> (fs)->fs_bshift)
708 #define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
709 ((loc) >> (fs)->fs_fshift)
710 #define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
711 (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
712 #define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
713 (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
714 #define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
715 ((frags) >> (fs)->fs_fragshift)
716 #define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
717 ((blks) << (fs)->fs_fragshift)
718 #define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
719 ((fsb) & ((fs)->fs_frag - 1))
720 #define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
721 ((fsb) &~ ((fs)->fs_frag - 1))
728 (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
729 (fs)->fs_cstotal.cs_nffree - \
730 (((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))
736 (((lbn) >= UFS_NDADDR || (ip)->i_size >= \
738 ? (fs)->fs_bsize \
739 : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
741 (((lbn) >= UFS_NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
742 ? (fs)->fs_bsize \
748 #define NINDIR(fs) ((fs)->fs_nindir)
753 * are this lbn - 1 and triple indirects are this lbn - 2. This yields
773 return (-1);
781 for (res = 1; level > 0; level--)
789 #define INOPB(fs) ((fs)->fs_inopb)
790 #define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)