fs(4) DG/UX 5.4R3.00 fs(4)
NAME
fs - file system format
SYNOPSIS
#include <ufs/diskformat.h>
DESCRIPTION
There is a at most one filesystem for each virtual disk. The basic
components of a the file system are the File Manager Information
Areas (FMIA's), Disk Allocation Regions (DAR's), and a table of
entries containing information about each DAR called the DAR
Information Area.
The FMIA
Two copies of the FMIA are maintained to reduce its vulnerability to
corruption. The copies are placed in the first and last blocks of
the file system. The FMIA in the first block (the Primary FMIA) is
contained in the first DAR, but the FMIA contained in the last block
of the virtual disk (the Secondary FMIA) is not contained in the last
DAR.
The following is the definition of a FMIA. This contains the per-
filesystem information. When a filesystem is mounted, this structure
is used to generate memory databases for the newly mounted entry.
typedef struct
{
dfselfidtype selfid;
dffsidtype fsid;
uint32etype minordevicenumber;
uint32etype darsize;
uint32etype filenodesperdar;
boolean16etype fsckrequired;
uint16etype revision;
byte8etype fname[DFFSLABELSIZE];
byte8etype fpack[DFFSLABELSIZE];
uint8etype defaultdesexponent;
uint8etype defaultiesexponent;
uint8etype defaultdirdesexponent;
uint8etype defaultdiriesexponent;
uint32etype firstanniversary;
uint32etype secondanniversary;
uint32etype fssize;
uint32etype spaceused;
uint32etype numberofusedfilenodes;
uint32etype firstloglda;
uint32etype secondloglda;
uint32etype logsize;
booleanfieldtype shrinkoperationinprogress;
booleanfieldtype growoperationinprogress;
skiptype reserved:14;
byte8etype padtoblock[DFPADDINGPERFMIABLOCK];
} dffmiablocktype ;
Licensed material--property of copyright holder(s) 1
fs(4) DG/UX 5.4R3.00 fs(4)
selfid is the self-identification information. The block kind is
DF_FMIA_BLOCK. The block number is:
#define DFPRIMARYFMIAADDRESS 0
The file node number is:
#define DFNODENUMBERFORNONFILES 012345670123
The following fields are assumed to be correct by fsck(1M).
fsid is the filesystem identifier unique among mounted file systems
on a single host. It is kept on disk so that it will stay the same
if possible from mount to mount. If it doesn't, NFS accesses using
filehandles based on a previous mount will fail.
minordevicenumber is the assigned extended minor device number. It
is kept on disk so that it will stay the same if possible from mount
to mount. If the value in this field on disk is not in the valid
range for extended minor device numbers, it is file manager's
responsibility to correct the problem at mount time.
darsize is the size of a DAR in blocks. The minimum value for this
field is:
#define DFMINDARSIZE 4032
and the maximum value is:
#define DFMAXDARSIZE(fssize)
mkfs(1M) defines the default for this field; for efficiency, it
should be a multiple of:
#define DFBITSPERBITMAPBLOCK 4032
whenever possible; 4 to 12 MB (two to six bitmap blocks' worth) per
DAR seems a reasonable default DAR size given current disk sizes. As
disks grow by orders of magnitude in size, DAR sizes should likely
grow linearly with the square root of the disk sizes.
filenodesperdar is the number of file nodes for each DAR. This
value must be a multiple of:
#define DFFILENODEMULTIPLEREQUIREMENT 64
The minimum value for this field is
#define DFMINFILENODESPERDAR 64
and the maximum value is:
#define DFMAXFILENODESPERDAR(darsize)
Licensed material--property of copyright holder(s) 2
fs(4) DG/UX 5.4R3.00 fs(4)
mkfs(1M) defines this field's default, which is to have about one
file node for each four user data blocks, similar to 4.2 BSD.
fsckrequired indicates that fsck(1M) needs to be run. If this field
is not zero (FALSE), the filesystem needs to be checked before it can
be mounted.
revision is the revision number of the FMIA. Used to determine the
type of filesystem that the FMIA resides on.
fsck(1M) will attempt to correct the following fields if they are
invalid:
fname is used by statfs(2), fstatfs(2), labelit(1M), volcopy(1M),
frec(1M), Initialized to zeros, when used it is considered an ASCII
string not necessarily terminated by a NULL byte.
fpack is used by statfs(2), fstatfs(2), labelit(1M), volcopy(1M),
frec(1M), Initialized to zeros, when used it is considered an ASCII
string not necessarily terminated by a NULL byte.
The following exponent fields pertain to the size of elements used to
access user data blocks. Data elements are equal sized sets of
contiguous blocks of a file. These data elements are either pointed
to directly from the file node or indirectly through an index
structure. Index elements are arrays of block numbers. The index
structure is hierarchical; an index block number may point to another
index element or, if the bottom is reached, point to a data element.
The direct or indexed access of data elements depends on the size of
the file and the block being accessed; blocks at the beginning of the
file can be accessed through the direct access to provide faster
access for smaller files since they are generally more common. The
following fields control the sizes of these elements, allowing the
user to choose values more suitable for the types of files that will
typically fill the file system. For more information about data
access from the inode, see inode(4).
defaultdesexponent specifies the default data element size for non-
directory files. The default data element size in blocks is 2 raised
to the default_des_exponent power. The default value for this field
is:
#define DFDEFAULTDEFAULTDESEXPONENT 4
The maximum value is:
#define DFMAXDESEXPONENT 31
although it is also limited to the base 2 logarithm of the largest
power of two that is less than or equal to:
#define DFUSERBLOCKSPERDAR(darsize, filenodesperdar)
defaultiesexponent specifies the default index element size for
Licensed material--property of copyright holder(s) 3
fs(4) DG/UX 5.4R3.00 fs(4)
non-directory files. The default index element size in blocks is 2
raised to the default_ies_exponent power. The default value for this
field is:
#define DFDEFAULTDEFAULTIESEXPONENT 0
The maximum value is:
#define DFMAXIESEXPONENT 15
although it is also limited to the base 2 logarithm of the largest
power of two that is less than or equal to:
#define DFUSERBLOCKSPERDAR(darsize, filenodesperdar)
defaultdirdesexponent specifies the default data element size for
directories and CPDs. The default data element size in blocks is 2
raised to the default_dir_des_exponent power. The default value for
this field is:
#define DFDEFAULTDEFAULTDESEXPONENT 4
The maximum value is:
#define DFMAXDESEXPONENT 31
although it is also limited to the base 2 logarithm of the largest
power of two that is less than or equal to
#define DFUSERBLOCKSPERDAR(darsize, filenodesperdar)
defaultdiriesexponent specifies the default index element size for
directories and CPDs. The default index element size in blocks is 2
raised to the default_dir_ies_exponent power. The default value for
this field is:
#define DFDEFAULTDEFAULTIESEXPONENT 0
The maximum value is:
#define DFMAXIESEXPONENT 15
although it is also limited to the base 2 logarithm of the largest
power of two that is less than or equal to:
#define DFUSERBLOCKSPERDAR(darsize, filenodesperdar).
fssize is the number of blocks in the filesystem. fsck(1M) will
check this against the disk size as reported by the device driver.
spaceused is the total (user and system) space used on this
filesystem, including any space wasted at the end due to an
incomplete DAR.
Licensed material--property of copyright holder(s) 4
fs(4) DG/UX 5.4R3.00 fs(4)
numberofusedfilenodes is the number of file nodes used in the
file system, not including the wasted file nodes with node numbers 0
and 1.
firstanniversary is the first anniversary of each file in blocks.
When a file first consumes this much space, the filesystem should
change the DAR from which it gets space for the file. The minimum
value of this field is 2 raised to the default_des_exponent power;
the default value is:
#define DFDEFAULTFIRSTANNIVERSARY(darsize)
secondanniversary the second anniversary of each file in blocks. A
file should change the DAR from which the filesystem gets space each
time its space utilization crosses a multiple of the second
anniversary. The second anniversary must be greater than or equal to
the first anniversary. The default value of this field is:
#define DFDEFAULTSECONDANNIVERSARY(darsize)
firstloglda and secondloglda give the virtual disk address of the
two halves of the fast recovery log. They will be zero if the file
system was not mounted for fast recovery when the filesystem was last
mounted or if /f4fsck/fP has been run over the file system.
logsize is the size in 512-byte blocks of each half of the fast
recovery log.
shrinkoperationinprogress is set if the filesystem is in the
process of being shrunk.
growoperationinprogress is set if the filesystem is in the process
of being grown.
The Disk Allocation Region (DAR)
The DAR is similar to the BSD cylinder group; however, the DAR is not
necessarily associated with a physical disk cylinder as it is in BSD.
The purpose of the DAR is to spread files throughout the filesystem
while maintaining a locality between inodes and the data blocks
associated with them.
The DAR consists of three parts: a bitmap, a file node table, and the
data blocks allocated to files as they are needed.
The bitmap records the space allocation in the DAR. A bit in the
bitmap represents a block in the DAR (this includes the blocks
allocated for the bitmap and the file node table). If the bitmap
value is 1, it is used; otherwise, it is free. The size of the
bitmap is a function of the size of the DAR and is provided (in
blocks) by:
#define DFDARBITMAPSIZE(darsize)
The file node table contains entries for each file in the DAR. A
Licensed material--property of copyright holder(s) 5
fs(4) DG/UX 5.4R3.00 fs(4)
file node entry (called an inode) contains information about the
file. The first block of the table is after the bitmap. The number
of file nodes in the DAR is a field in the FMIA. The number of
blocks allocated to the table (in blocks) is:
#define DFDARFILENODETABLESIZE(filenodesperdar)
The file node table element (the inode) is discussed in inode(4).
The data blocks take up the remaining blocks of the DAR.
With the exception of the blocks of the DAR Information Area and the
Secondary FMIA, all blocks in the file system are contained in DAR's.
The number of DAR's in a file system is a function of the size of the
file system, the size of each DAR, and the file nodes contained in
each DAR. This is provided by:
#define DFNUMBEROFDARS(fssize, darsize, nodesperdar)
The last DAR of the file system may be the smaller than the other
DAR's. If the space before the DAR Information Area and the
Secondary FMIA is large enough to contain the DAR's bitmap and file
node table, then the DAR will be created; otherwise, the space
between the end of the last DAR and the beginning of the DAR
Information Area is wasted. Since the bitmap in the last DAR is the
same size as the other DAR's, if the last DAR is smaller the bitmap
will have bits indicating the allocation of data blocks that do not
exist (in fact it is legal for no data blocks to exist in the last
DAR). In this case, the non-existent blocks are marked as allocated.
The following macros provide values associated with the space before
the DAR Information Area:
#define DFLASTDARSIZE(fssize, darsize, nodesperdar)
#define DFFSWASTEDSPACE(fssize, darsize, nodesperdar)
The DAR Information Area
At the end of the file system, a table of entries exist for each DAR
in the file system. It is located such that its last block of
entries is before the last block of the file system containing the
Secondary FMIA. This location is provided by:
#define DFDARETABLEADDRESS(fssize,darsize,filenodesperdar)
A definition for a DAR entry is:
typedef struct
{
uint32etype filenodesused;
uint32etype spaceused;
uint32etype directoriesused;
dffilenodenumbertype freefilenodenumber;
byte8etype reserved[DFRESERVEDBYTESPERDAR];
} dfdarentrytype;
Licensed material--property of copyright holder(s) 6
fs(4) DG/UX 5.4R3.00 fs(4)
filenodesused Number of file_nodes in use from the DAR the entry
represents.
spaceused is the number of data blocks in use from the DAR. This
explicitly excludes DAR Information Area blocks, the block containing
the Secondary FMIA, and blocks marked as allocated in the last DAR
but do not exist. This field includes the following system blocks:
the Primary FMIA for the first DAR only, the DAR's bitmap blocks and
the DAR's file node blocks.
directoriesused is the number of directories in the DAR.
freefilenodenumber is the file node number of next free file node
in the DAR. This functions as the head of the DAR's free file node
list.
SEE ALSO
fstatfs(2), mount(2), statfs(2), inode(4). frec(1M), fsck(1M),
labelit(1M), mkfs(1M), volcopy(1M).
Licensed material--property of copyright holder(s) 7