An application reads the FCL file through the vxfs_fcl_read
function. vxfs_fcl_read
performs the following tasks:
Each fcl_record
structure represents a logical event recorded in the FCL. It is defined as the following:
uint32_t fr_reclen; /* Record length */
uint16_t fr_op; /* Operation type. */
uint16_t fr_unused1; /* unused field */
uint32_t fr_acsinfovalid : 1; /* fr_acsinfo field valid */
uint32_t fr_newnmvalid : 1; /* fr_newfilename field is valid */
uint32_t fr_pinogenvalid : 1; /* fr_fr_pinogen field is valid */
uint32_t fr_unused2 : 29; /* Future use */
uint64_t fr_inonum; /* Inode Number. */
uint32_t fr_inogen; /* Inode Generation Count. */
fcl_time_t fr_time; /* Time. */
struct fcl_evmaskinfo fv_evmask;
uint64_t fr_tdino; /* Target dir ino */
char *fr_newfilename; /* For rename */
struct fcl_acsinfo *fr_acsinfo; /* Access Info */
uint64_t fn_pinonum; /* Parent Inode Number. */
uint32_t fn_pinogen; /* Parent Inode Gen cnt. */
uint64_t oldmask; /* Old event mask. */
uint64_t newmask; /* New event mask. */
These defines are provided for easier access:
VxFS 5.0 gathers file I/O statistics such as the number of reads /writes occurring on a file. The gathered statistics are maintained in a per-file in-core structure and the File Change Log acts as a persistent backing store for the statistics. The stats are written to the FCL under the following circumstances:
These statistics can be read from the FCL as VX_FCL_FILESTAT
records. Each record contains information as defined by the following fcl_iostat
structure:
uint64_t nbytesread; /* Number of bytes read from the file*/
uint64_t nbyteswrite; /* Number of bytes written to the file*/
uint32_t nreads; /* Number of reads from the file */
uint32_t nwrites; /* Number of writes to the file */
uint32_t readtime; /* Total time in seconds for the reads */
uint32_t writetime; /* Total time in seconds for the writes */
} lastreset; /* Last reset time for the stats */
uint32_t nodeid; /* Node from which the record was written */
uint32_t reset; /* Stats have been written due to a reset */
Each iostat record in the FCL contains I/O statistics accumulated over the time interval from the lastreset
time to the next lastreset
time. Over a period of time, the cumulative statistics and aggregate can be computed by the following:
For example, computing the aggregate for the total number of reads over a period of time requires traversing a set of FCL files to obtain I/O statistics records. This informations contains a sequence of records of the type VX_FCL_FILESTATS
with the same lastreset
time followed by another sequence of records with a later lastreset
time for a specific file.
The aggregation considers values only from the latest record from records with the same lastreset
time and then sums up the number of reads for each such record.
When tracking access-info is enabled, VxFS logs the access information such as:
When the application reads the FCL, the information is returned in the fr_acsinfo
field. The fr_acsinfo
points to an FCL_acsinfo
structure, defined as follows:
Note
The accessinfo
is not returned as a separate record type but as additional information along with the other records. In addition, the accessinfo
information is not always present with every record (if it is not enabled). However, even when accessinfo
is enabled in some file system internal operations, (such as truncating a file), the access information may not always be present. To help determine if access information is available, the FCL record contains a flag called fcl_acsinfovalid
which is non-zero only if the accessinfo
is present with a particular record.
Several of the fields in the fcl_acsinfo
structure are pointers and need memory to store the actual contents. This is handled by storing the actual data immediately after the FCL record, and updating the pointer to point to the data. The record length fr_reclen
field is updated to account for the whole data. Thus, each FCL record returned by vxfs_fcl_read
is a variable size record, whose length is indicated by fr_reclen_field
. Sample link record shows how the data is laid out in a sample link record.
Click the thumbnail above to view full-sized image.
Sample link record
The following code sample traverses the set of records returned by a call to vxfs_fcl_read
and prints the user ID:
error = vxfs_fcl_read(fh, buf, &bufsz,
fr = (struct fcl_record *)tbuf;
printf("Uid %ld\n", fr->fr_acsinfo->uid;
Note
FCL_ALL_V4_EVENTS
are event masks.
See "vxfs_fcl_read" on page 29.
FCL record structure fields briefly describes each field of the fcl_record
structure and indicates the record types for which it is valid.