FSCTL(7) FSCTL(7)
fsctl - operations on a mounted file system
/dev/fsctl
fsctl presents a device interface for performing low-level operations on
a mounted file system. This driver is used by the file system
reorganizer, fsr.
WARNING: this driver does NOT copy or otherwise operate on data within
file system blocks. This can be done through the raw device interface to
the file system.
Only the superuser can open /dev/fsctl. Only one process at a time can
open this device.
The following operations are available as ioctl(2) calls on a file
descriptor opened on this device. The second argument to ioctl(2) is the
command name. The third argument is a pointer to a struct fscarg with
the specified fields appropriately set. The command names and the
structure are defined in /usr/include/sys/fsctl.h.
ILOCK dev inum [Toc] [Back]
Locks the inode, synchronously updates the physical disk with
the current state of the in-core inode, synchronously updates
the file's data blocks to disk, and invalidates any cached
pages for this inode. This is an inode lock which will cause
any system call from any process to block until released by an
IUNLOCK.
[EFAULT] Failed to copy in argument to ioctl(2).
[EBUSY] Another inode is already locked by this device, or
the specified inode is in use.
[ENOENT] The file system was unmounted before the inode could
be read from the disk and locked.
[EINVAL] The device is not a mounted file system, or the inode
is not a regular file.
[EFBIG] Failed to read in indirect extents.
IUNLOCK dev inum [Toc] [Back]
Unlocks the inode.
[EFAULT] Failed to copy in argument to ioctl(2).
Page 1
FSCTL(7) FSCTL(7)
[EINVAL] The specified inode is not currently ILOCK'ed.
ICOMMIT dev inum ne ex ni ix [Toc] [Back]
This commits the new direct and indirect extents, and
synchronously updates the new inode and indirect extents to
disk. The state of the inode is otherwise unchanged -- ICOMMIT
does not update the inode ctime, or mtime, for example. ne is
the number of direct extents. ex is a pointer to the direct
extents. nie is the number of indirect extents. ix is the
pointer to the indirect extents. A check is made that all
blocks described in the new extent and indirect extents are
valid and allocated data blocks. This does NOT copy the
contents of any data blocks in the implied move as a result of
ICOMMIT'ing new extents, nor does ICOMMIT automatically free
any blocks which are now no longer described by the file's
extents. If ICOMMIT fails for any reason the inode and its
data remain intact and unchanged.
[EFAULT] Failed to copy in argument to ioctl(2).
[EINVAL] The specified inode is not ILOCK'ed.
[EINVAL] The extent information is not valid. The extent and
indirect extent information must be consistent and
the blocks they describe must be allocated.
[EFAULT] Failed to copy in argument to ioctl(2) or the extent
lists to which this points.
BALLOC/BFREE dev bn len
Allocates/frees the specified blocks.
[EFAULT] Failed to copy in argument to ioctl(2).
[EINVAL] There is currently no ILOCK'ed inode in the specified
device.
[EINVAL] The specified data blocks are not valid data blocks.
[EEXIST] The specified data blocks are not currently
free/allocated.
TSTALLOC/TSTFREE dev bn
Returns the number of cylinder group data blocks allocated/free
on the specified dev starting at block bn.
[EFAULT] Failed to copy in argument to ioctl(2).
[EINVAL] There is currently no ILOCK'ed inode in the specified
device.
Page 2
FSCTL(7) FSCTL(7)
[EINVAL] The block number is not a valid data block number.
The reorganizer, fsr, uses /dev/fsctl as follows:
open(/dev/fsctl)
for each file system
for each regular file
ILOCK
find better location using TSTFREE/TSTALLOC
BALLOC new bn+len
copy blocks to new bn+len using fs device
ICOMMIT new extents using new bn+len
BFREE old bn+len
IUNLOCK
close(/dev/fsctl)
/usr/include/sys/fsctl.h
fsr(1M).
These ioctl(2)'s all return -1 on error. Otherwise, all commands except
TSTALLOC and TSTFREE return 0.
PPPPaaaaggggeeee 3333 [ Back ]
|