netfs_buffer..._iter_locked(9)
netfs_buffer..._iter_locked(9) π
πΈ NAME πΈ
netfs_buffered_write_iter_locked β write data to a file. Bestie, this is from the Kernel API Manual and it's giving βthe actual write-work functionβ energy β¨
β¨ SYNOPSIS β¨
ssize_t netfs_buffered_write_iter_locked (struct kiocb *iocb , struct iov_iter *from , struct netfs_group *netfs_group );
π ARGUMENTS π
iocbβ IO state structure (file, offset, etc.) π«Άfromβiov_iterwith data to writenetfs_groupβ grouping for dirty folios (eg.ceph snaps).
π DESCRIPTION π
Okay so this function literally does all the work needed for actually writing data to a file. It does all the basic checks, removes SUID from the file, updates modification times, and calls the proper subroutines depending on whether we do direct IO or a standard buffered write. Slay π
The caller must hold appropriate locks around this function and have called generic_write_checks already. The caller is also responsible for doing any necessary syncing afterwards. Important bestie note π«Ά
This function does not take care of syncing data in case of O_SYNC write. A caller has to handle it. This is mainly due to the fact that we want to avoid syncing under i_rwsem. Periodt π
π«Ά RETURN π«Ά
- number of bytes written, even for truncated writes
- negative error code if no data has been written at all
π SEE ALSO π
Kernel file ./fs/netfs/buffered_write.c netfs_perform_write(9), netfs_file_write_iter(9).
later bestie β source/version: ./fs/netfs, date: October 2026 π¦π
π¦ 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