Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lfs_bmapv(2) [netbsd man page]

LFS_BMAPV(2)						      BSD System Calls Manual						      LFS_BMAPV(2)

NAME
lfs_bmapv -- retrieve disk addresses for arrays of blocks LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <ufs/lfs/lfs.h> int lfs_bmapv(fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt); DESCRIPTION
lfs_bmapv() fills in the bi_daddr field for every block listed in the block array blkiov with the disk address corresponding to the logical block bi_lbn of the file with inode bi_inode. If bi_lbn is LFS_UNUSED_LBN, the disk location of the inode block containing the file's inode will be returned in bi_daddr instead. The fsidp argument contains the id of the file system to which the inodes and blocks belong. The blkiov argument is an array of BLOCK_INFO structures (see below). The blkcnt argument determines the size of the blkiov array. typedef struct block_info { ino_t bi_inode; /* inode # */ ufs_daddr_t bi_lbn; /* logical block w/in file */ ufs_daddr_t bi_daddr; /* disk address of block */ time_t bi_segcreate; /* origin segment create time */ int bi_version; /* file version number */ void *bi_bp; /* data buffer */ int bi_size; /* size of the block (if fragment) */ } BLOCK_INFO; RETURN VALUES
lfs_bmapv() returns 0 on success, or -1 on error. ERRORS
An error return from lfs_bmapv() indicates: [EFAULT] fsidp points outside the process's allocated address space. [EINVAL] *fsidp does not specify a valid file system. SEE ALSO
lfs_markv(2), lfs_segclean(2), lfs_segwait(2), lfs_cleanerd(8) HISTORY
The lfs_bmapv() function call appeared in 4.4BSD. BSD
May 23, 2000 BSD

Check Out this Related Man Page

fs(4)							     Kernel Interfaces Manual							     fs(4)

NAME
fs, inode - Specifies the format of the file system volume SYNOPSIS
#include <sys/types.h> #include <sys/fs.h> #include <ufs/inode.h> DESCRIPTION
Every file system storage volume (disk, nine-track tape, for instance) has a common format for certain vital information. Each such volume is divided into a certain number of blocks. The block size is a parameter of the file system. Sectors beginning at BBLOCK and continuing for BBSIZE are used to contain a label and for some hardware primary and secondary bootstrapping programs. Each disk drive contains some number of file systems. A file system consists of a number of cylinder groups. Each cylinder group has inodes and data. A file system is described by its superblock, which in turn describes the cylinder groups. The superblock is critical data and is repli- cated in each cylinder group to protect against loss of data. This is done at file system creation time and the critical superblock data does not change, so the copies need not be referenced further until necessary. Addresses stored in inodes are capable of addressing fragments of blocks. File system blocks of at most MAXBSIZE size can be optionally broken into 2, 4, or 8 pieces, each of which is addressable; these pieces may be DEV_BSIZE, or some multiple of a DEV_BSIZE unit. Large files consist exclusively of large data blocks. To avoid wasted disk space, the last data block of a small file is allocated only as many fragments of a large block as are necessary. The file system format retains only a single pointer to such a fragment, which is a piece of a single large block that has been divided. The size of such a fragment is determined from information in the inode, using the blksize(fs, ip, lbn) macro. The file system records space availability at the fragment level; to determine block availability, aligned fragments are examined. The root inode is the root of the file system. Inode 0 (zero) can't be used for normal purposes and, historically, bad blocks were linked to inode 1. Thus, the root inode is 2 (inode 1 is no longer used for this purpose, but numerous dump tapes make this assumption). Some fields to the fs structure are as follows: Gives the minimum acceptable percentage of file system blocks that may be free. If the freelist drops below this level only the superuser may continue to allocate blocks. The fs_minfree field may be set to 0 (zero) if no reserve of free blocks is deemed necessary. However, severe performance degradations will be observed if the file system is run at greater than 90% full; thus the default value of the fs_minfree field is 10%. Empirically the best trade-off between block fragmentation and overall disk utilization at a loading of 90% comes with a fragmenta- tion of 8, thus the default fragment size is an eighth of the block size. Specifies whether the file system should try to minimize the time spent allocating blocks, or if it should attempt to minimize the space fragmentation on the disk. If the value of fs_min- free is less than 10%, then the file system defaults to optimizing for space to avoid running out of full sized blocks. If the value of fs_minfree is greater than or equal to 10%, fragmentation is unlikely to be problematical, and the file system defaults to optimizing for time. Cylinder group related limits: Each cylinder keeps track of the availability of blocks at different positions of rotation, so that sequential blocks can be laid out with minimum rotational latency. With the default of 8 distinguished rotational positions, the resolution of the summary information is 2 milliseconds for a typical 3600 rpm drive. Gives the minimum number of milliseconds to initiate another disk transfer on the same cylinder. The fs_rotdelay field is used in determining the rotationally optimal layout for disk blocks within a file; the default value for fs_rotdelay is 2 milliseconds. Each file system has a statically allocated number of inodes. An inode is allocated for each NBPI bytes of disk space. The inode alloca- tion strategy is extremely conservative. MINBSIZE is the smallest allowable block size. With a MINBSIZE of 4096 it is possible to create files of size 232 with only two levels of indirection. MINBSIZE must be big enough to hold a cylinder group block, thus changes to struct cg must keep its size within MINBSIZE. Note that superblocks are never more than size SBSIZE. The pathname on which the file system is mounted is maintained in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in the superblock for this name. The limit on the amount of summary information per file system is defined by MAXCSBUFS. For a 4096 byte block size, it is currently parameterized for a maximum of two million cylinders. Per cylinder group information is summarized in blocks allocated from the first cylinder group's data blocks. These blocks are read in from fs_csaddr (size fs_cssize) in addition to the superblock. Superblock for a file system: The size of the rotational layout tables is limited by the fact that the superblock is of size SBSIZE. The size of these tables is inversely proportional to the block size of the file system. The size of the tables is increased when sector sizes are not powers of two, as this increases the number of cylinders included before the rotational pattern repeats (fs_cpc). The size of the rotational layout tables is derived from the number of bytes remaining in (struct fs). The number of blocks of data per cylinder group is limited because cylinder groups are at most one block. The inode and free block tables must fit into a single block after deducting space for the cylinder group structure struct cg. Inode: The inode is the focus of all file activity in the UNIX file system. There is a unique inode allocated for each active file, each current directory, each mounted-on file, text file, and the root. An inode is `named' by its device/i-number pair. NOTES
sizeof (struct csum) must be a power of two in order for the fs_cs macro to work. delim off fs(4)
Man Page