Filesystem manager (QNX)
Fsys [options] &
Char | Unit |
---|---|
m or M | megabytes |
k or K | kilobytes |
b or B | 512-byte blocks |
% | Percentage of system RAM |
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.
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).
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. |
If you need to shut down a filesystem driver, follow these steps:
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. |
When the block special files have been removed, the driver that handles them will go away.
Start the filesystem manager with default settings:
Fsys &
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.
Fsys normally will not terminate. However, it is possible for it to exit if it encounters errors on startup.
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).
Blkfsys, Dosfsys, Fsys.*, Iso9660fsys, mount, Pipe