gfs2_fsync(9)
π gfs2_fsync(9) β like, the Kernel API Manual one, bestie β¨
okay so picture this: it's a Kernel API Manual page, the vibe is very kernel-core, and the function is gfs2_fsync. sit down, we're learning π
πΈ NAME πΈ
gfs2_fsync β syncs the dirty data for a file, and yeah it does it across the cluster π¦
β¨ SYNOPSIS β¨
int gfs2_fsync (struct file *file , loff_t start , loff_t end , int datasync );
that's it, that's the whole signature, no notes π
π ARGUMENTS π
fileβ the file that points to the dentry π«Άstartβ where in the file we're starting the sync, position-wiseendβ where in the file the sync stopsdatasyncβ gets set when we're allowed to just ignore timestamp changes π
π₯ DESCRIPTION π₯
so here's the main character energy: we split the data flushing right here, on purpose, so that we don't sit around waiting for the data until after we've also sent the metadata to disk. iconic scheduling behavior, honestly β¨
lowkey important caveat tho β for data=ordered, we will write & wait for the data at the log flush stage anyway, so this is unlikely to make much of a difference except in the data=writeback case. so like, don't expect fireworks π
and now the plot twist π β if the fdatawrite fails due to any reason except -EIO, we will continue the remainder of the fsync, although we'll still report the error at the end. why? to match filemap_write_and_wait_range behaviour. consistency slay π
π RETURN π
errno β that's the whole answer, no cap
π SEE ALSO π
the kernel file is ./fs/gfs2/file.c, and then the whole friend group shows up:
gfs2_llseek(9)gfs2_readdir(9)do_gfs2_set_flags(9)gfs2_size_hint(9)gfs2_allocate_folio_backing(9)gfs2_page_mkwrite(9)gfs2_mmap(9)gfs2_open_common(9)gfs2_open(9)gfs2_release(9)gfs2_file_write_iter(9)calc_max_reserv(9)gfs2_lock(9)gfs2_flock(9)
ngl, if you got this far you're genuinely built different π§ go touch some struct file * π
okay that's the whole page, mwah π β it lives in ./fs/gfs2, it's dated October 2026, and yes the page name is still gfs2_fsync(9) because we don't rebrand things here π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms