{
  "slug": "multigrain-timestamps",
  "term": "Multigrain timestamps",
  "aliases": [
    "multigrain inode timestamps",
    "FS_MGTIME"
  ],
  "definition": "Multigrain timestamps are a Linux filesystem mechanism that selectively refines inode timestamp updates after modification or change times have been queried.",
  "note": "In Linux v7.2, fill_mg_cmtime marks an inode queried when STATX_CTIME or STATX_MTIME is requested; a request for neither does not set the marker or clear an earlier mark. inode_set_ctime_current uses fine time when the marker is set and coarse time would not advance ctime. Values are still truncated to the filesystem's supported granularity. [multigrain-stat] [multigrain-inode]\n\nA global floor prevents a later coarse timestamp from falling behind an earlier fine timestamp during non-overlapping modifications, assuming no backward realtime-clock jump. Equality remains possible; operations that overlap have no submission-order guarantee. The floor uses monotonic time internally but exported timestamps remain realtime values. [multigrain-doc]\n\nLocal filesystems opt in through FS_MGTIME and the required timestamp paths. This is not a universal promise for every mount. The refinement concerns mtime and ctime, not atime. [multigrain-doc]\n\nFor synchronization, this mechanism cannot prevent an authorized caller from restoring mtime with utimensat. Default rsync selection compares size and mtime and ignores nanoseconds; --modify-window=-1 can compare nanoseconds with a sufficiently recent receiver. Even that comparison can miss changed bytes with an exactly restored mtime. [utimensat] [rsync-manual]\n\nNFS connection: local filesystem timestamp refinement can improve the ctime values used by a server's change-attribute fallback. Network filesystems that mirror server timestamps do not acquire local FS_MGTIME semantics merely because the client runs this kernel. Inspect the server's backing filesystem and returned attributes. [multigrain-doc]",
  "related": [
    "file-modification-time",
    "inode-change-time",
    "file-access-time",
    "rsync-quick-check",
    "lazytime",
    "nfs-storage",
    "nfs-change-attribute"
  ],
  "citations": [
    {
      "id": "multigrain-doc",
      "title": "Linux 7.2: Multigrain Timestamps, ordering, floor and filesystem opt-in",
      "url": "https://docs.kernel.org/7.2/filesystems/multigrain-ts.html",
      "accessed": "2026-11-29"
    },
    {
      "id": "multigrain-stat",
      "title": "Linux v7.2 fs/stat.c: fill_mg_cmtime and requested timestamp fields",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v7.2/fs/stat.c",
      "accessed": "2026-11-29"
    },
    {
      "id": "multigrain-inode",
      "title": "Linux v7.2 fs/inode.c: inode_set_ctime_current and timestamp_truncate",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v7.2/fs/inode.c",
      "accessed": "2026-11-29"
    },
    {
      "id": "utimensat",
      "title": "Linux utimensat(2): explicit timestamp assignment and ctime updates",
      "url": "https://man7.org/linux/man-pages/man2/utimensat.2.html",
      "accessed": "2026-11-29"
    },
    {
      "id": "rsync-manual",
      "title": "Rsync manual: quick check and modify-window timestamp precision",
      "url": "https://rsync.samba.org/ftp/rsync/rsync.1",
      "accessed": "2026-11-29"
    },
    {
      "id": "hesela-rsync",
      "title": "Hesela: timestamp comparison and rsync file selection",
      "url": "https://hesela.com/analyses/rsync-delta-shifted-blocks/#file-times",
      "accessed": "2026-11-29"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-29",
  "advantages": [
    {
      "text": "Makes queried timestamp changes easier to distinguish without requiring fine timestamps for every update.",
      "citationIds": [
        "multigrain-stat",
        "multigrain-inode"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A timestamp is not a content hash, a snapshot or a receipt for durable storage.",
      "citationIds": [
        "utimensat",
        "hesela-rsync"
      ]
    }
  ],
  "provenance": [
    "Source synthesis pinned to Linux v7.2. No native multigrain experiment, kernel introduction-date claim or measured performance gain. Earlier rsync fixtures are separate observations, not tests of this kernel mechanism."
  ]
}
