An unwritten extent is an extent which has been marked as "not yet written" ondisk.
Unwritten extents can be created by preallocating file space using:
XFS specific interfaces (xfsctl(3)
)
sys_fallocate
on kernels >= 2.6.23
posix_fallocate(3)
on recent glibc
fallocate(1)
on newer glibc versions
Through direct IOs of specific alignment (such as stripe boundaries)
Unwritten extents apply only to regular files.
The unwritten state prevents the uninitialised data in the extent from being exposed to the user.
Once such an extent is written to, or partially written to, a transaction is issued to convert the written part into a regular written extent, and mark the remaining (up to 2) extents as unwritten.
Use the -p option to xfs_bmap to view unwritten extents.
# xfs_io -f -c 'resvsp 0 10m' -c 'bmap -vp' /tmp/foo