The stat() system call

The stat() system call returns data on the size and parameters associated with a file. The call is issued by the ls -l command and other similar functions.

The data required to satisfy the stat() system call is contained in the inode. GPFS processing of the stat() system call differs from other file systems in that it supports handling of stat() calls on all nodes without funneling the calls through a server.

This requires that GPFS obtain tokens that protect the accuracy of the metadata. To maximize parallelism, GPFS locks inodes individually and fetches individual inodes. In cases where a pattern can be detected, such as an attempt to stat() all of the files in a larger directory, inodes are fetched in parallel in anticipation of their use.

Inodes are cached within GPFS in two forms:
  • Full inode
  • Limited stat cache form

The full inode is required to perform data I/O against the file.

The stat cache form is smaller than the full inode, but is sufficient to open the file and satisfy a stat() call. It is intended to aid functions such as ls -l, du, and certain backup programs that scan entire directories looking for modification times and file sizes.

These caches and the requirement for individual tokens on inodes are the reason why a second invocation of directory scanning applications might run faster than the first.