file_attr(2type)

πŸ“¦ version 6.20, in arch rolling, nixpkgs unstable

✨ file_attr(2type) ✨

okay so bestie, this one is a type page (a 2type page, if we're being precise πŸ’…) from section 2 of the Linux man-pages, and it's literally just the ✨glow-up✨ of a struct. no functions, no syscall, just a little bundle of fields that the kernel hands back and forth. it's giving "supporting cast member with main character energy" πŸŽ€


🌸 NAME 🌸

file_attr β€” filesystem file attributes πŸ¦‹


πŸ’– SYNOPSIS πŸ’–

okay so first you gotta pull in the header:

#include <linux/fs.h>

and then here's the whole struct, character for character, no edits, we do not touch the struct, the struct is sacred πŸ‘‘

struct file_attr {
     u64  fa_xflags;      // Extended flags
     u32  fa_extsize;     // Extent size hint
     u32  fa_nextents;    // Number of extents (read-only)
     u32  fa_projid;      // Project identifier
     u32  fa_cowextsize;  // CoW extent size hint
};

🌈 DESCRIPTION 🌈

so like, this whole thing describes filesystem file attributes, and its literal job in life is to be the payload for two syscalls: file_getattr(2) and file_setattr(2). one reads it, one writes it. iconic teamwork fr fr 🫢

here's the field-by-field breakdown, no skips, no shortcuts:

  • .fa_xflags β€” this is where the file attribute flags live. it's a bit mask, meaning it's zero or more of the FS_XFLAG_* flags OR'd together. the full menu is down in Flags below, iykyk ✨
  • .fa_extsize β€” the extent size allocator hint, measured in bytes. basically it's a lil suggestion like "hey, for new allocations for this file, maybe prefer extents around this big?" a vibe check for the allocator, if you will πŸ’…
  • .fa_nextents β€” the number of data extents in the file, and bestie this one is read-only. file_getattr(2) fills it in for you; file_setattr(2) straight up ignores it. you don't write to this one, periodt 🚫
  • .fa_projid β€” the project identifier. quota systems use it (quotactl(2)) to group files that belong together, like a lil friend group for accounting purposes 🌸
  • .fa_cowextsize β€” the Copy-on-Write (CoW) extent size hint, in bytes. same deal as fa_extsize but specifically suggesting a preferred extent size for CoW operations πŸ¦‹

πŸŽ€ Flags πŸŽ€

here come the FS_XFLAG_* flags ok, deep breath, there's a bunch and we love them all:

  • FS_XFLAG_REALTIME β€” data is stored in a realtime volume.
  • FS_XFLAG_IMMUTABLE β€” file cannot be modified. (not "shouldn't", cannot. it's locked in πŸ”’)
  • FS_XFLAG_APPEND β€” all writes must append to the end of the file.
  • FS_XFLAG_SYNC β€” all writes are synchronous.
  • FS_XFLAG_NOATIME β€” do not update file access time on reads.
  • FS_XFLAG_NODUMP β€” do not include file in backups.
  • FS_XFLAG_DAX β€” use Direct Access (DAX) for I/O operations.
  • FS_XFLAG_NODEFRAG β€” exclude this file from defragmentation operations.
  • FS_XFLAG_FILESTREAM β€” use filestream allocator for this file.
  • FS_XFLAG_EXTSIZE β€” use the extent size hint from the fa_extsize field.
  • FS_XFLAG_COWEXTSIZE β€” use the CoW extent size hint from the fa_cowextsize field.

πŸ“ Directory-only flags:

these only make sense on directories, so don't come for them on files bestie:

  • FS_XFLAG_RTINHERIT β€” new files created in this directory inherit the realtime flag.
  • FS_XFLAG_NOSYMLINKS β€” disallow creation of symbolic links in this directory.
  • FS_XFLAG_EXTSZINHERIT β€” new files created in this directory inherit the extent size hint.
  • FS_XFLAG_PROJINHERIT β€” new files created in this directory inherit the project identifier.

πŸ‘€ Read-only flags:

  • FS_XFLAG_PREALLOC β€” file has preallocated extents.
  • FS_XFLAG_HASATTR β€” file has extended attributes.
  • FS_XFLAG_VERITY β€” file has fs-verity enabled.
  • FS_XFLAG_CASEFOLD β€” the filesystem performs case-insensitive lookups (file and directory name comparisons ignore case).
  • FS_XFLAG_CASENONPRESERVING β€” the filesystem does not preserve the case of file and directory names.
⚠️ and this part matters, so listen up: not all filesystems support all flags. setting unsupported flags may result in an error. so like, check before you go setting things, ok? don't just assume πŸ™ˆ

πŸ•°οΈ HISTORY πŸ•°οΈ

Linux v6.17

this structure is introduced. hello world, welcome to the kernel πŸ‘‘

Linux v7.2

the FS_XFLAG_CASEFOLD and FS_XFLAG_CASENONPRESERVING are introduced, and the whole reason is so that upper layers β€” like NFSD β€” can retrieve case sensitivity information. slay ✨


πŸ”— SEE ALSO πŸ”—

  • file_getattr(2)
  • file_setattr(2)

and that's the whole page bestie, no cap πŸ’– this was Linux man-pages 6.20, dated 2026-10-11, and it's giving thorough. go read file_getattr(2) and file_setattr(2) next, they're the ones actually doing stuff. mwah πŸ«ΆπŸ’…

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms