Performance

QNX SDP8.0System ArchitectureDeveloperUser

The Copy on Write (COW) method has some drawbacks:
  • Each change to user data can cause up to a dozen blocks to be copied and modified, because the filesystem never modifies the inode and indirect block pointers in place; it has to copy the blocks to a new location and modify the copies. Thus, write operations are longer.
  • When taking a snapshot, the filesystem must force all blocks fully to disk before it commits the superblock.
However:
  • There's no constraint on the order in which the blocks (aside from the superblock) can be written.
  • The new blocks can be allocated from any free, contiguous space.

The performance of the filesystem depends on how much buffer cache is available, and on the frequency of the snapshots. Snapshots occur periodically (every 10 seconds, or as specified by the snapshot option to fs-qnx6.so), and when you call sync() for the entire filesystem, or fsync() for a single file.

Note:
Synchronization is at the filesystem level, not at that of individual files, so fsync() is potentially an expensive operation; the Power-Safe filesystem ignores the O_SYNC flag.
You can also turn snapshots off if you're doing some long operation, and the intermediate states aren't useful to you. For example, suppose you're copying a very large file into a Power-Safe filesystem. The cp utility is really just a sequence of basic operations:
  • an open(O_CREAT|O_TRUNC) to make the file
  • a bunch of write() operations to copy the data
  • a close(), chmod(), and chown() to copy the metadata
If the file is big enough so that copying it spans snapshots, you have on-disk views that include the file not existing, the file existing at a variety of sizes, and finally the complete file copied and its IDs and permissions set:

Timeline of cp operations and snapshots

Each snapshot is a valid point-in-time view of the filesystem (i.e., if you've copied 50 MB, the size is 50 MB, and all data up to 50 MB is also correctly copied and available). If there's a power failure, the filesystem is restored to the most recent snapshot. But the filesystem has no concept that the sequence of open(), write(), and close() operations is really one higher-level operation, cp. If you want the higher-level semantics, disable the snapshots around the cp, and then the middle snapshots won't happen, and if a power failure occurs, the file will be either complete or not there at all.

For information about using this filesystem, see Power-Safe filesystem in the Working with Filesystems chapter of the QNX OS User's Guide.

Page updated: