nilfs_transaction_begin(9)
π nilfs_transaction_begin(9) π
okay so bestie, welcome to the Kernel API Manual entry for nilfs_transaction_begin β yes the page header says nilfs_transaction_begin(9) twice, that's just how manpages are, they're extra like that β¨
πΈ NAME πΈ
nilfs_transaction_begin β start indivisible file operations. literally the "no cutting in line" function, periodt π
π¦ SYNOPSIS π¦
int nilfs_transaction_begin (struct super_block *sb , struct
nilfs_transaction_info *ti , int vacancy_check );
π ARGUMENTS π
sbβ the super block, she's the main character here πtiβ anilfs_transaction_info, the little context carriervacancy_checkβ flags for vacancy rate checks, iykyk π«Ά
β¨ DESCRIPTION β¨
so what does she actually do? nilfs_transaction_begin acquires a reader/writer semaphore β it's called the segment semaphore β to make a segment construction and write tasks exclusive. gatekeeping? no, just semaphore-ing π
The function is used with nilfs_transaction_commit in pairs, they're literally a duo, a package deal, fr fr. The region enclosed by these two functions can be nested β yes she can go inside herself, we love a recursive-ish queen π§
β οΈ but bestie, to avoid a deadlock, the semaphore is only acquired or released in the outermost call. only the outer layer gets to touch it, no cap π
This function allocates a nilfs_transaction_info struct to keep context information on it. It is initialized and hooked onto the current task in the outermost call. If a pre-allocated struct is given to ti, it is used instead; otherwise a new struct is assigned from a slab. so either you hand her a struct or she grabs one from the slab, very self-sufficient π
When the vacancy_check flag is set, this function will check the amount of free space, and will wait for the GC to reclaim disk space if low capacity. low space? she waits for GC to clean up the vibes β¨
π₯ RETURN π₯
0 on success π, or one of the following negative error codes on failure:
-ENOMEMβ Insufficient memory available π-ENOSPCβ No space left on device (if checking free space) π
π SEE ALSO π
Kernel file ./fs/nilfs2/segment.c
nilfs_transaction_commit(9)nilfs_segctor_reset_segment_buffer(9)nilfs_segctor_zeropad_segsum(9)nilfs_write_root_mdt_inode(9)nilfs_free_segments(9)nilfs_segctor_begin_construction(9)nilfs_prepare_write_logs(9)nilfs_segctor_start_timer(9)nilfs_construct_segment(9)nilfs_construct_dsync_segment(9)nilfs_segctor_accept(9)nilfs_segctor_notify(9)nilfs_segctor_construct(9)nilfs_log_write_required(9)nilfs_segctor_thread(9)nilfs_segctor_destroy(9)nilfs_attach_log_writer(9)nilfs_detach_log_writer(9)
like, read them all, she's thorough π π
kay that's the whole page bestie, go forth and transact π«Ά
source dir ./fs/nilfs2, dated October 2026, and the page signs off as nilfs_transaction_begin(9) β slay, bye πβ
π¦ 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