View | Details | Raw Unified | Return to bug 51189
Collapse All | Expand All

(-)share/man/man5/fs.5 (-95 / +104 lines)
Lines 71-192 Link Here
71
with the
71
with the
72
.Em super-block
72
.Em super-block
73
that is of size
73
that is of size
74
.Dv SBSIZE .
74
.Dv SBLOCKSIZE .
75
The following structure describes the super-block and is
75
The following structure describes the super-block and is
76
from the file
76
from the file
77
.Aq Pa ufs/ffs/fs.h :
77
.Aq Pa ufs/ffs/fs.h :
78
.Bd -literal
78
.Bd -literal
79
/*
79
/*
80
 * Super block for an FFS file system.
80
 * Super block for an FFS filesystem.
81
 */
81
 */
82
struct fs {
82
struct fs {
83
	int32_t	 fs_firstfield;	/* historic file system linked list, */
83
	int32_t	 fs_firstfield;	   /* historic filesystem linked list, */
84
	int32_t	 fs_unused_1;	/*     used for incore super blocks */
84
	int32_t	 fs_unused_1;      /*     used for incore super blocks */
85
	ufs_daddr_t fs_sblkno;	/* addr of super-block in filesys */
85
	int32_t	 fs_sblkno;        /* offset of super-block in filesys */
86
	ufs_daddr_t fs_cblkno;	/* offset of cyl-block in filesys */
86
	int32_t	 fs_cblkno;        /* offset of cyl-block in filesys */
87
	ufs_daddr_t fs_iblkno;	/* offset of inode-blocks in filesys */
87
	int32_t	 fs_iblkno;        /* offset of inode-blocks in filesys */
88
	ufs_daddr_t fs_dblkno;	/* offset of first data after cg */
88
	int32_t	 fs_dblkno;        /* offset of first data after cg */
89
	int32_t	 fs_cgoffset;	/* cylinder group offset in cylinder */
89
	int32_t	 fs_old_cgoffset;  /* cylinder group offset in cylinder */
90
	int32_t	 fs_cgmask;	/* used to calc mod fs_ntrak */
90
	int32_t	 fs_old_cgmask;    /* used to calc mod fs_ntrak */
91
	time_t 	 fs_time;	/* last time written */
91
	int32_t  fs_old_time;      /* last time written */
92
	int32_t	 fs_size;	/* number of blocks in fs */
92
	int32_t	 fs_old_size;      /* number of blocks in fs */
93
	int32_t	 fs_dsize;	/* number of data blocks in fs */
93
	int32_t	 fs_old_dsize;     /* number of data blocks in fs */
94
	int32_t	 fs_ncg;	/* number of cylinder groups */
94
	int32_t	 fs_ncg;           /* number of cylinder groups */
95
	int32_t	 fs_bsize;	/* size of basic blocks in fs */
95
	int32_t	 fs_bsize;         /* size of basic blocks in fs */
96
	int32_t	 fs_fsize;	/* size of frag blocks in fs */
96
	int32_t	 fs_fsize;         /* size of frag blocks in fs */
97
	int32_t	 fs_frag;	/* number of frags in a block in fs */
97
	int32_t	 fs_frag;          /* number of frags in a block in fs */
98
/* these are configuration parameters */
98
/* these are configuration parameters */
99
	int32_t	 fs_minfree;	/* minimum percentage of free blocks */
99
	int32_t	 fs_minfree;       /* minimum percentage of free blocks */
100
	int32_t	 fs_rotdelay;	/* num of ms for optimal next block */
100
	int32_t	 fs_old_rotdelay;  /* num of ms for optimal next block */
101
	int32_t	 fs_rps;	/* disk revolutions per second */
101
	int32_t	 fs_old_rps;       /* disk revolutions per second */
102
/* these fields can be computed from the others */
102
/* these fields can be computed from the others */
103
	int32_t	 fs_bmask;	/* ``blkoff'' calc of blk offsets */
103
	int32_t	 fs_bmask;         /* ``blkoff'' calc of blk offsets */
104
	int32_t	 fs_fmask;	/* ``fragoff'' calc of frag offsets */
104
	int32_t	 fs_fmask;         /* ``fragoff'' calc of frag offsets */
105
	int32_t	 fs_bshift;	/* ``lblkno'' calc of logical blkno */
105
	int32_t	 fs_bshift;        /* ``lblkno'' calc of logical blkno */
106
	int32_t	 fs_fshift;	/* ``numfrags'' calc number of frags */
106
	int32_t	 fs_fshift;        /* ``numfrags'' calc number of frags */
107
/* these are configuration parameters */
107
/* these are configuration parameters */
108
	int32_t	 fs_maxcontig;	/* max number of contiguous blks */
108
	int32_t	 fs_maxcontig;     /* max number of contiguous blks */
109
	int32_t	 fs_maxbpg;	/* max number of blks per cyl group */
109
	int32_t	 fs_maxbpg;        /* max number of blks per cyl group */
110
/* these fields can be computed from the others */
110
/* these fields can be computed from the others */
111
	int32_t	 fs_fragshift;	/* block to frag shift */
111
	int32_t	 fs_fragshift;     /* block to frag shift */
112
	int32_t	 fs_fsbtodb;	/* fsbtodb and dbtofsb shift constant */
112
	int32_t	 fs_fsbtodb;       /* fsbtodb and dbtofsb shift constant */
113
	int32_t	 fs_sbsize;	/* actual size of super block */
113
	int32_t	 fs_sbsize;        /* actual size of super block */
114
	int32_t	 fs_csmask;	/* csum block offset */
114
	int32_t	 fs_spare1[2];     /* old fs_csmask */
115
	int32_t	 fs_csshift;	/* csum block number */
115
	                           /* old fs_csshift */
116
	int32_t	 fs_nindir;	/* value of NINDIR */
116
	int32_t	 fs_nindir;        /* value of NINDIR */
117
	int32_t	 fs_inopb;	/* value of INOPB */
117
	int32_t	 fs_inopb;         /* value of INOPB */
118
	int32_t	 fs_nspf;	/* value of NSPF */
118
	int32_t	 fs_old_nspf;      /* value of NSPF */
119
/* yet another configuration parameter */
119
/* yet another configuration parameter */
120
	int32_t	 fs_optim;	/* optimization preference, see below */
120
	int32_t	 fs_optim;         /* optimization preference, see below */
121
/* these fields are derived from the hardware */
121
	int32_t	 fs_old_npsect;    /* # sectors/track including spares */
122
	int32_t	 fs_npsect;	/* # sectors/track including spares */
122
	int32_t	 fs_old_interleave; /* hardware sector interleave */
123
	int32_t	 fs_interleave;	/* hardware sector interleave */
123
	int32_t	 fs_old_trackskew; /* sector 0 skew, per track */
124
	int32_t	 fs_trackskew;	/* sector 0 skew, per track */
124
	int32_t	 fs_id[2];         /* unique filesystem id */
125
/* fs_id takes the space of the unused fs_headswitch and fs_trkseek fields */
126
	int32_t	fs_id[2];	/* unique file system id*/
127
/* sizes determined by number of cylinder groups and their sizes */
125
/* sizes determined by number of cylinder groups and their sizes */
128
	ufs_daddr_t fs_csaddr;	/* blk addr of cyl grp summary area */
126
	int32_t	 fs_old_csaddr;	   /* blk addr of cyl grp summary area */
129
	int32_t	 fs_cssize;	/* size of cyl grp summary area */
127
	int32_t	 fs_cssize;        /* size of cyl grp summary area */
130
	int32_t	 fs_cgsize;	/* cylinder group size */
128
	int32_t	 fs_cgsize;        /* cylinder group size */
131
/* these fields are derived from the hardware */
129
	int32_t	 fs_spare2;        /* old fs_ntrak */
132
	int32_t	 fs_ntrak;	/* tracks per cylinder */
130
	int32_t	 fs_old_nsect;     /* sectors per track */
133
	int32_t	 fs_nsect;	/* sectors per track */
131
	int32_t  fs_old_spc;       /* sectors per cylinder */
134
	int32_t  fs_spc;	/* sectors per cylinder */
132
	int32_t	 fs_old_ncyl;      /* cylinders in filesystem */
135
/* this comes from the disk driver partitioning */
133
	int32_t	 fs_old_cpg;       /* cylinders per group */
136
	int32_t	 fs_ncyl;	/* cylinders in file system */
134
	int32_t	 fs_ipg;           /* inodes per group */
137
/* these fields can be computed from the others */
135
	int32_t	 fs_fpg;           /* blocks per group * fs_frag */
138
	int32_t	 fs_cpg;	/* cylinders per group */
139
	int32_t	 fs_ipg;	/* inodes per group */
140
	int32_t	 fs_fpg;	/* blocks per group * fs_frag */
141
/* this data must be re-computed after crashes */
136
/* this data must be re-computed after crashes */
142
	struct	csum fs_cstotal;/* cylinder summary information */
137
	struct	csum fs_old_cstotal; /* cylinder summary information */
143
/* these fields are cleared at mount time */
138
/* these fields are cleared at mount time */
144
	int8_t   fs_fmod;	/* super block modified flag */
139
	int8_t   fs_fmod;          /* super block modified flag */
145
	int8_t   fs_clean;	/* file system is clean flag */
140
	int8_t   fs_clean;         /* filesystem is clean flag */
146
	int8_t 	 fs_ronly;	/* mounted read-only flag */
141
	int8_t 	 fs_ronly;         /* mounted read-only flag */
147
	int8_t   fs_flags;	/* currently unused flag */
142
	int8_t   fs_old_flags;     /* old FS_ flags */
148
	u_char	 fs_fsmnt[MAXMNTLEN];	/* name mounted on */
143
	u_char	 fs_fsmnt[MAXMNTLEN]; /* name mounted on */
144
	u_char	 fs_volname[MAXVOLLEN]; /* volume name */
145
	u_int64_t fs_swuid;        /* system-wide uid */
146
	int32_t  fs_pad;           /* due to alignment of fs_swuid */
149
/* these fields retain the current block allocation info */
147
/* these fields retain the current block allocation info */
150
	int32_t	 fs_cgrotor;	/* last cg searched */
148
	int32_t	 fs_cgrotor;       /* last cg searched */
151
	struct	csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */
149
	void 	*fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
152
	int32_t	 *fs_maxcluster;/* max cluster in each cyl group */
150
	u_int8_t *fs_contigdirs;   /* # of contiguously allocated dirs */
153
	int32_t	 fs_cpc;	/* cyl per cycle in postbl */
151
	struct	csum *fs_csp;      /* cg summary info buffer for fs_cs */
154
	int16_t	 fs_opostbl[16][8];	/* old rotation block list head */
152
	int32_t	*fs_maxcluster;    /* max cluster in each cyl group */
155
	int32_t	 fs_sparecon[50];	/* reserved for future constants */
153
	u_int	*fs_active;        /* used by snapshots to track fs */
156
	int32_t	 fs_contigsumsize;	/* size of cluster summary array */
154
	int32_t	 fs_old_cpc;       /* cyl per cycle in postbl */
157
	int32_t	 fs_maxsymlinklen;/* max length of an internal symlink */
155
	int32_t	 fs_maxbsize;      /* maximum blocking factor permitted */
158
	int32_t	 fs_inodefmt;	/* format of on-disk inodes */
156
	int64_t	 fs_sparecon64[17]; /* old rotation block list head */
159
	u_int64_t fs_maxfilesize;/* maximum representable file size */
157
	int64_t	 fs_sblockloc;     /* byte offset of standard superblock */
160
	int64_t	 fs_qbmask;	/* ~fs_bmask for use with 64-bit size */
158
	struct	csum_total fs_cstotal;  /* cylinder summary information */
161
	int64_t	 fs_qfmask;	/* ~fs_fmask for use with 64-bit size */
159
	ufs_time_t fs_time;        /* last time written */
162
	int32_t	 fs_state;	/* validate fs_clean field */
160
	int64_t	 fs_size;          /* number of blocks in fs */
163
	int32_t	 fs_postblformat;/* format of positional layout tables */
161
	int64_t	 fs_dsize;         /* number of data blocks in fs */
164
	int32_t	 fs_nrpos;	/* number of rotational positions */
162
	ufs2_daddr_t fs_csaddr;    /* blk addr of cyl grp summary area */
165
	int32_t	 fs_postbloff;	/* (u_int16) rotation block list head */
163
	int64_t	 fs_pendingblocks; /* blocks in process of being freed */
166
	int32_t	 fs_rotbloff;	/* (u_int8) blocks for each rotation */
164
	int32_t	 fs_pendinginodes; /* inodes in process of being freed */
167
	int32_t	 fs_magic;	/* magic number */
165
	int32_t	 fs_snapinum[FSMAXSNAP]; /* list of snapshot inode numbers */
168
	u_int8_t fs_space[1];	/* list of blocks for each rotation */
166
	int32_t	 fs_avgfilesize;   /* expected average file size */
169
/* actually longer */
167
	int32_t	 fs_avgfpdir;      /* expected # of files per directory */
168
	int32_t	 fs_save_cgsize;   /* save real cg size to use fs_bsize */
169
	int32_t	 fs_sparecon32[26]; /* reserved for future constants */
170
	int32_t  fs_flags;         /* see FS_ flags below */
171
	int32_t	 fs_contigsumsize; /* size of cluster summary array */ 
172
	int32_t	 fs_maxsymlinklen; /* max length of an internal symlink */
173
	int32_t	 fs_old_inodefmt;  /* format of on-disk inodes */
174
	u_int64_t fs_maxfilesize;  /* maximum representable file size */
175
	int64_t	 fs_qbmask;        /* ~fs_bmask for use with 64-bit size */
176
	int64_t	 fs_qfmask;        /* ~fs_fmask for use with 64-bit size */
177
	int32_t	 fs_state;         /* validate fs_clean field */
178
	int32_t	 fs_old_postblformat; /* format of positional layout tables */
179
	int32_t	 fs_old_nrpos;     /* number of rotational positions */
180
	int32_t	 fs_spare5[2];     /* old fs_postbloff */
181
	                           /* old fs_rotbloff */
182
	int32_t	 fs_magic;         /* magic number */
170
};
183
};
171
184
172
/*
185
/*
173
 * File system identification
186
 * Filesystem identification
174
 */
187
 */
175
#define	FS_MAGIC	0x011954   /* the fast file system magic number */
188
#define	FS_UFS1_MAGIC	0x011954    /* UFS1 fast filesystem magic number */
176
#define	FS_OKAY		0x7c269d38 /* superblock checksum */
189
#define	FS_UFS2_MAGIC	0x19540119  /* UFS2 fast filesystem magic number */
177
#define FS_42INODEFMT	-1	   /* 4.2BSD inode format */
190
#define	FS_OKAY		0x7c269d38  /* superblock checksum */
178
#define FS_44INODEFMT	2	   /* 4.4BSD inode format */
191
#define FS_42INODEFMT	-1      /* 4.2BSD inode format */
192
#define FS_44INODEFMT	2       /* 4.4BSD inode format */
193
179
/*
194
/*
180
 * Preference for optimization.
195
 * Preference for optimization.
181
 */
196
 */
182
#define FS_OPTTIME	0	/* minimize allocation time */
197
#define FS_OPTTIME	0	/* minimize allocation time */
183
#define FS_OPTSPACE	1	/* minimize disk fragmentation */
198
#define FS_OPTSPACE	1	/* minimize disk fragmentation */
184
185
/*
186
 * Rotational layout table format types
187
 */
188
#define FS_42POSTBLFMT		-1  /* 4.2BSD rotational table format */
189
#define FS_DYNAMICPOSTBLFMT	1   /* dynamic rotational table format */
190
.Ed
199
.Ed
191
.Pp
200
.Pp
192
Each disk drive contains some number of file systems.
201
Each disk drive contains some number of file systems.
Lines 275-287 Link Here
275
summary information is 2ms for a typical 3600 rpm drive.
284
summary information is 2ms for a typical 3600 rpm drive.
276
.Pp
285
.Pp
277
The element
286
The element
278
.Fa fs_rotdelay
287
.Fa fs_old_rotdelay
279
gives the minimum number of milliseconds to initiate
288
gives the minimum number of milliseconds to initiate
280
another disk transfer on the same cylinder.
289
another disk transfer on the same cylinder.
281
It is used in determining the rotationally optimal
290
It is used in determining the rotationally optimal
282
layout for disk blocks within a file;
291
layout for disk blocks within a file;
283
the default value for
292
the default value for
284
.Fa fs_rotdelay
293
.Fa fs_old_rotdelay
285
is 2ms.
294
is 2ms.
286
.Pp
295
.Pp
287
Each file system has a statically allocated number of inodes.
296
Each file system has a statically allocated number of inodes.
Lines 304-310 Link Here
304
must keep its size within
313
must keep its size within
305
.Dv MINBSIZE .
314
.Dv MINBSIZE .
306
Note that super-blocks are never more than size
315
Note that super-blocks are never more than size
307
.Dv SBSIZE .
316
.Dv SBLOCKSIZE .
308
.Pp
317
.Pp
309
The path name on which the file system is mounted is maintained in
318
The path name on which the file system is mounted is maintained in
310
.Fa fs_fsmnt .
319
.Fa fs_fsmnt .
Lines 336-342 Link Here
336
.Em "Super-block for a file system" :
345
.Em "Super-block for a file system" :
337
The size of the rotational layout tables
346
The size of the rotational layout tables
338
is limited by the fact that the super-block is of size
347
is limited by the fact that the super-block is of size
339
.Dv SBSIZE .
348
.Dv SBLOCKSIZE .
340
The size of these tables is
349
The size of these tables is
341
.Em inversely
350
.Em inversely
342
proportional to the block
351
proportional to the block

Return to bug 51189