[Previous] [Contents] [Next]

Fsys

Filesystem manager (QNX)

Syntax:

Fsys [options] &

Options:

-a
Perform all system writes (inodes, bitmap, etc.) asynchronously.
-A
Don't update access times if nothing else about the file (mode, owner, data etc.) changed. If this option is used, the filesystem will not behave in the manner required by POSIX. Utilities and scripts which rely on time of last access will not behave as would be expected on a POSIX system. The advantage of -A is that it is slightly faster on a heavily loaded server.
-C num_names
Number of pathname components to cache. The default is 1.5x the number of in-memory inodes (specified by -i). If you increase this value, you may also need to increase -i accordingly.
-c cache_size[m|k|b|%]
The size of the cache. Units are assumed to be 1K unless the units are specified as follows:
Char Unit
m or M megabytes
k or K kilobytes
b or B 512-byte blocks
% Percentage of system RAM
The default cache size is 1/8 of the total memory.
-d delay
The write-behind ("hold-off") delay applied to asynchronous writes, specified in seconds (default is 3 seconds). If the asynchronous write queue is empty, this delay is applied when the first block is placed in the queue. As a result, the queue is likely to contain many blocks before the driver is called to drain the queue.
-F
Don't use priority float (i.e. always run at fixed priority). The default is to float to client-driven priority.
-f ocb
The maximum number of open control blocks that may be open at one time in the filesystem (default is equal to the maximum number of processes Proc has been configured for. See "Proc -pprocs").
-H heap_size
The size of heap to use; see "Heap size," below.
-i inode_table_size
The maximum number of distinct files that may be open at any time (default is twice the maximum number of processes).
-l lock_table_size
("el") The number of locks that can be simultaneously outstanding (default is equal to the maximum number of processes).
-O
Process requests in time order, not priority order.
-P percentage
Reserve this percentage of the cache for segmented LRU replacement. Default is 20% if the cache size is the default or larger. If the cache specified is smaller than the default cache, the reserved percentage is decreased. -P0 effectively results in pure LRU caching.
-r ramdisk_size
The size of an optional ramdisk, in units of 1K. The minimum size is 4K; the maximum size is limited by available memory. There is no default size. A block special file called /dev/ram is created.
-t threads
The number of threads (default is 4, minimum is 1)
-T
Disable threaded operation in driver.
-v level
The verbosity level (default is 1; 0 disables verbosity).

Description:

The Filesystem Manager (Fsys) provides a standardized means of storing and accessing data on disk subsystems. Fsys is responsible for handling all requests to open, close, read, and write to files.

The Fsys manager lets you define ramdisks. A ramdisk is a block of memory that's accessed by the filesystem as if it were a disk drive. It can be effectively used for temporary files or to augment the cache by storing frequently used data, such as programs or tables. Only one ramdisk is supported by each Filesystem Manager process.

The ramdisk is defined as a block special file with the name /dev/ram. To define the root name for the filesystem on the ramdisk, you use the mount utility. But to use the ramdisk as a QNX filesystem, you must first dinit it. For example:

Fsys -r 1048
dinit /dev/ram
mount /dev/ram  /ram

Remember that since a ramdisk is entirely RAM-based, its contents are lost when the system is rebooted.

The maximum number of distinct files that may be open at any time may be less than the total number of open files, since files with links have only one entry and the same file opened by several processes at the same time has only one entry.

Heap size

Fsys requires data memory for the filesystem buffer cache (an in-memory copy of LRU disk sectors, since memory is much faster than disk) and for data structures such as open files, inodes, locks, name caching, and so on. It also stores summary bitmap information about free and used blocks on mounted filesystems.

Fsys and the Fsys.* disk drivers share a memory segment to give the drivers direct access to the filesystem buffer cache that Fsys manages (for no-copy physical data transfer, so a sector can be transferred directly between the disk and the cache without the need for intermediate buffering in the disk driver).

Under QNX 4, once a memory segment has been shared, it can't be resized. Thus, Fsys must initially allocate a maximal heap to itself before any Fsys.* drivers register. It knows the amount of cache, open files, and so on from the defaults or command-line overrides (-c, -f, -i, -l, -t, and -C). However, at this point it doesn't know the size of any attached disks, or the number of partitions or filesystems they may contain, or even the number of Fsys.* drivers that will attach to it.

So Fsys makes a guess as to those disk-related unknowns (a certain number of drivers, each with a certain number of disks and partitions, of a certain size). Historically it was a reasonable estimate, but with the increase in modern disk sizes, it's often too low.

If the Fsys heap runs out, the symptoms are primarily spurious ENFILE ("too many open files") or ENOMEM ("not enough memory") errors. Note that as the allocations are being performed from the pregrown Fsys heap (and can't be satisfied from the OS by growing the data segment), these errors bear no relationship to the actual amount of free memory in the system itself.

Whenever Fsys can't allocate memory for a filesystem object, it places an entry into the traceinfo log as follows:

00003024 internal heap exhaustion (nbytes=d/t) (object=s)

If you see this message, the amount of memory estimated or preallocated to Fsys is insufficient for the actual size of the attached disks/filesystems. In this case, use the Fsys -H option to override or augment the heap size.

Version 4.24Y or later of Fsys supports the syntax -H diskx, where x is the total size (in GB) of all disks drives in the system (e.g. -Hdisk40 for 40 GB). This sets an amount (12 KB for every 1 GB of disk) to be added to the known memory requirements and estimations for drivers/partitions.

Otherwise, you can use the syntax -H x to set the amount of heap memory over and above the known requirements. In this case, the value must also include the memory needed for drivers, disks, and partitions, as well as the bitmap summary information for mounted filesystems. You can use the information in the traceinfo log to calculate a suitable value. The two numeric values logged are the size of the guess made for disk-related usage (d) and the total size of the preallocated heap (t). The difference is thus the amount of memory for known requirements, such as open files, inodes, and so on. What you're specifying with the -H parameter in this case overrides that first numeric value (d).


Note: If you start Fsys from the boot image, don't forget to rebuild the image and copy it to .boot for the new -H value to take effect.

Driver shutdown

If you need to shut down a filesystem driver, follow these steps:


Caution: Don't use slay to shut down a filesystem driver! If you do, new drivers may not be able to load properly and Fsys itself may experience internal errors.

  1. Unmount (umount) all mounted partitions.
  2. Unmount (umount) all partition tables that had been read via umount on the device. For example, if you've done: mount -p /dev/hd0 you'll need to do: umount /dev/hd0.
  3. Remove all devices owned by the driver you want to shut down -- these are block special files that reside under /dev. For example: rm /dev/hd0.

When the block special files have been removed, the driver that handles them will go away.

Examples:

Start the filesystem manager with default settings:

    Fsys &

Files:

Fsys closes its standard input, standard output, and standard error after initialization has been completed. Error messages during initialization will be written to standard error, except when Fsys isn't being run by root, in which case a message is written to standard output.

Fsys adopts block-special files under /dev and adopts other files under the filesystem mountpoints specified to the mount utility.

Exit status:

Fsys normally will not terminate. However, it is possible for it to exit if it encounters errors on startup.

1
Not being run by root or failed to allocate internal process table (memory)
2
Failed to allocate thread space (memory)
3
Failed to allocate cache (memory)
4
Failed to allocate file descriptions (memory)
5
Failed to allocate inodes (memory)
7
Failed to allocate lock table (memory)
8
Failed to allocate ramdisk (memory)
9
Failed during init_fd()
10
Failed to attach name
11
Failed to obtain driver proxy
12
Failed to obtain timer proxy
13
Failed to create timer
14
Failed to obtain major device number
15
Failed to allocate (reserve) heap (memory)

Caveats:

Although the -a option may speed up certain operations, its use, especially with a large delay (option -d), can seriously affect the reliability of the filesystem in the event of an unplanned shutdown, such as a power failure. You should use the -a option with extreme caution only after experimentation has shown that its use is necessary and only on a reliable system (possibly equipped with a UPS -- uninterruptible power supply).

See also:

Blkfsys, Dosfsys, Fsys.*, Iso9660fsys, mount, Pipe


[Previous] [Contents] [Next]