fs(4) DG/UX 4.30 fs(4)
NAME
fs - file system format
SYNOPSIS
#include <ufs/diskformat.h>
DESCRIPTION
There is a at most one filesystem for each logical 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 logical
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
{
df_self_id_type self_id;
df_fsid_type fsid;
uint32e_type minor_device_number;
uint32e_type dar_size;
uint32e_type file_nodes_per_dar;
boolean16e_type fsck_required;
uint16e_type revision;
byte8e_type fname[DF_FS_LABEL_SIZE];
byte8e_type fpack[DF_FS_LABEL_SIZE];
uint8e_type default_des_exponent;
uint8e_type default_ies_exponent;
uint8e_type default_dir_des_exponent;
uint8e_type default_dir_ies_exponent;
uint32e_type first_anniversary;
uint32e_type second_anniversary;
uint32e_type fs_size;
uint32e_type space_used;
uint32e_type number_of_used_file_nodes;
byte8e_type pad_to_block[DF_PADDING_PER_FMIA_BLOCK];
} df_fmia_block_type ;
self_id is the self-identification information. The block
kind is DF_FMIA_BLOCK. The block number is:
Licensed material--property of copyright holder(s) Page 1
fs(4) DG/UX 4.30 fs(4)
#define DF_PRIMARY_FMIA_ADDRESS 0
The file node number is:
#define DF_NODE_NUMBER_FOR_NON_FILES 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.
minor_device_number 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.
dar_size is the size of a DAR in blocks. The minimum value
for this field is:
#define DF_MIN_DAR_SIZE 4032
and the maximum value is:
#define DF_MAX_DAR_SIZE(fs_size)
mkfs(1M) defines the default for this field; for efficiency,
it should be a multiple of:
#define DF_BITS_PER_BITMAP_BLOCK 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.
file_nodes_per_dar is the number of file nodes for each DAR.
This value must be a multiple of:
#define DF_FILE_NODE_MULTIPLE_REQUIREMENT 64
The minimum value for this field is
#define DF_MIN_FILE_NODES_PER_DAR 64
and the maximum value is:
Licensed material--property of copyright holder(s) Page 2
fs(4) DG/UX 4.30 fs(4)
#define DF_MAX_FILE_NODES_PER_DAR(dar_size)
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.
fsck_required 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).
default_des_exponent 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 DF_DEFAULT_DEFAULT_DES_EXPONENT 4
Licensed material--property of copyright holder(s) Page 3
fs(4) DG/UX 4.30 fs(4)
The maximum value is:
#define DF_MAX_DES_EXPONENT 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 DF_USER_BLOCKS_PER_DAR(dar_size, file_nodes_per_dar)
default_ies_exponent specifies the default index element
size for 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 DF_DEFAULT_DEFAULT_IES_EXPONENT 0
The maximum value is:
#define DF_MAX_IES_EXPONENT 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 DF_USER_BLOCKS_PER_DAR(dar_size, file_nodes_per_dar)
default_dir_des_exponent 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 DF_DEFAULT_DEFAULT_DES_EXPONENT 4
The maximum value is:
#define DF_MAX_DES_EXPONENT 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 DF_USER_BLOCKS_PER_DAR(dar_size, file_nodes_per_dar)
default_dir_ies_exponent 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 DF_DEFAULT_DEFAULT_IES_EXPONENT 0
The maximum value is:
#define DF_MAX_IES_EXPONENT 15
Licensed material--property of copyright holder(s) Page 4
fs(4) DG/UX 4.30 fs(4)
although it is also limited to the base 2 logarithm of the
largest power of two that is less than or equal to:
#define DF_USER_BLOCKS_PER_DAR(dar_size, file_nodes_per_dar).
fs_size is the number of blocks in the filesystem. fsck(1M)
will check this against the disk size as reported by the
device driver.
space_used is the total (user and system) space used on this
filesystem, including any space wasted at the end due to an
incomplete DAR.
number_of_used_file_nodes is the number of file nodes used
in the file system, not including the wasted file nodes with
node numbers 0 and 1.
first_anniversary 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 DF_DEFAULT_FIRST_ANNIVERSARY(dar_size)
second_anniversary 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 DF_DEFAULT_SECOND_ANNIVERSARY(dar_size)
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
Licensed material--property of copyright holder(s) Page 5
fs(4) DG/UX 4.30 fs(4)
of the DAR and is provided (in blocks) by:
#define DF_DAR_BITMAP_SIZE(dar_size)
The file node table contains entries for each file in the
DAR. A 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 DF_DAR_FILE_NODE_TABLE_SIZE(file_nodes_per_dar)
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 DF_NUMBER_OF_DARS(fs_size, dar_size, nodes_per_dar)
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 DF_LAST_DAR_SIZE(fs_size, dar_size, nodes_per_dar)
#define DF_FS_WASTED_SPACE(fs_size, dar_size, nodes_per_dar)
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 DF_DARE_TABLE_ADDRESS(fs_size,dar_size,file_nodes_per_dar)
Licensed material--property of copyright holder(s) Page 6
fs(4) DG/UX 4.30 fs(4)
A definition for a DAR entry is:
typedef struct
{
uint32e_type file_nodes_used;
uint32e_type space_used;
uint32e_type directories_used;
df_file_node_number_type free_file_node_number;
byte8e_type reserved[DF_RESERVED_BYTES_PER_DAR];
} df_dar_entry_type;
file_nodes_used Number of file_nodes in use from the DAR the
entry represents.
space_used 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.
directories_used is the number of directories in the DAR.
free_file_node_number 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
mount(2), statfs(2), fstatfs(2), inode(4). mkfs(1M),
fsck(1M), inode(4), statfs(2), fstatfs(2), labelit(1M),
volcopy(1M), frec(1M) in the System Manager's Reference for
the DG/UX System.
Licensed material--property of copyright holder(s) Page 7