Skip to content

DocStatBlocks

Jared Yanovich edited this page Jun 25, 2015 · 3 revisions

Disk usage accounting

Overview

This document describes the implementation of support for the struct stat member st_blocks via the stat(2) system call of a file.

When CRC updates are sent from the I/O server, sliod(8) tacks the value of the stat(2) member st_blocks for the object file residing on his backing file system into the RPC to the MDS.

When received by the MDS, the MDS takes the following actions:

  • the new file size sent by the I/O server is checked to see if it extends the current file size as currently known to the MDS.
  • the index for the IOS sending the update is looked up in the file's replication table.
  • a delta between the current ino_repl_nblks[iosidx] value previously recorded for this IOS and the new value as sent by sliod in this RPC is calculated and this difference is added to the sst_blocks aggregate value for this FID.
  • at this time, the fcmh_sstb are written similar to a SETATTR operation into the MDFS without journaling.
  • the ino_repl_nblks[iosidx] value of this IOS for this FID is updated and the inode/inox is written into the MDFS without journaling.
  • the bmap CRCs are updated to the new values specified in the RPC and a journal entry is written containing:
    • these CRC values
    • the new file size
    • whether the file size constituted an extending
    • the IOS replica table index
    • the new ino_repl_nblks[iosidx] value
    • the new aggregate sst_blocks value.

On replay, these same steps are (essentially) taken to recover any loss.

Clone this wiki locally