fiemap · shipping · also FS_IOC_FIEMAP

FIEMAP

A Linux ioctl interface that reports file extent mappings and associated state flags over a requested logical byte range.

FIEMAP_FLAG_SYNC synchronizes before mapping, so the query can alter the observed state. DELALLOC also sets UNKNOWN; UNWRITTEN instead describes allocated zero-reading storage. Mappings can change between calls and are not permission to access a mounted filesystem through its block device. Record request flags and check for a full output buffer. Hesela's linked observation compares unsynchronized queries with explicit fsync and FIEMAP synchronization. In upstream Linux v6.8, fiemap_prep uses filemap_write_and_wait rather than fsync for this flag; it is not a substitute for a metadata-durability barrier.

FIEMAP_FLAG_XATTR selects extended attributes, not the file-data tree. An empty attribute map does not prove absent file-data allocation. For range accounting, intersect returned logical extents with the requested interval; this gives logical overlap, not physical space saved. [4]

Hesela's single-file Linux/ext4 observation returned an empty attribute map alongside a nonempty data map. The data result marked LAST before the file's end. This is a recorded host-specific case, not an all-filesystem guarantee. [6] The LAST flag may mark the range endpoint; a count query followed by a mapping query is not a snapshot. [4]

Sharing result: FIEMAP_EXTENT_SHARED (0x2000) is returned in fe_flags, not requested through fm_flags. It reports shared storage rather than asking for a clone. The ABI provides no reference count, so this bit alone cannot quantify deletion savings. [7] [8]

Relations

related
File extent, Delayed allocation, Unwritten extent, fsync, Btrfs filesystem du

Limitations

  • A count-only query is not a stable snapshot for the following mapping call.
  • Returned extents may cross the requested range; LAST can be range-scoped on some implementations.

Citations

  1. Linux v6.18 FIEMAP: XATTR query domain and returned extents crossing requested bounds (accessed 2026-10-23)
  2. Hesela: single-file FIEMAP query-domain observation, environment and source hash (accessed 2026-10-23)
  3. Linux v6.12: FIEMAP request flags, returned extent flags and SHARED bit (accessed 2026-11-21)
  4. Linux v6.12: iomap_to_fiemap translates IOMAP_F_SHARED into a result flag (accessed 2026-11-21)

Further reading

  1. Linux 6.12: FIEMAP ioctl, flags and access restrictions (accessed 2026-10-16)
  2. Hesela: measured FIEMAP observer intervention (accessed 2026-10-16)
  3. Linux v6.8 fs/ioctl.c: fiemap_prep writeback implementation (accessed 2026-10-16)
  4. Hesela: FIEMAP query domains and exact logical-range example (accessed 2026-10-23)
Sources & caveats
  • The SHARED interpretation is checked against the pinned UAPI and iomap implementation; the documentation's request wording is misleading.
  • The lack of a reference count is an ABI observation; the deletion-savings limitation is an inference, not a measured filesystem result.

JSON: /data/terms/fiemap.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. FIEMAP. Hesela. 2026-11-21. https://hesela.dev/terms/fiemap/