nilfs_free_segments(9)
π
nilfs_free_segments β Kernel API Manual π
okay so section 9 bestie, welcome to the Kernel API Manual β this page is about nilfs_free_segments, and itβs giving cleanup icon energy. literally obsessed. π§β¨
πΈ NAME πΈ
nilfs_free_segments β frees the segments given by an array of segment numbers. no cap, thatβs the whole name-vibe, periodt. π
β¨ SYNOPSIS β¨
hereβs the signature, exactly as it shows up β copy/paste safe, fr fr:
int nilfs_free_segments (struct the_nilfs *nilfs , __u64 *segnumv ,
size_t nsegs );
π ARGUMENTS π
nilfsβ thenilfsobject. your main character π«Άsegnumvβ array of segment numbers to be freed. yes bestie, the whole array πnsegsβ number of segments to be freed insegnumv. count βem π
π DESCRIPTION π
okay so hereβs the tea: nilfs_free_segments wraps nilfs_sufile_freev and nilfs_sufile_cancel_freev, and it edits the segment usage metadata file (sufile) to free all segments given by segnumv and nsegs at once. one shot, all the segments, slay. β¨
if it fails midway, it cancels the changes so that none of the segments are freed. highkey all-or-nothing, no half-freed mess. π
if nsegs is 0, this function does nothing. itβs a vibe check and then a nap. π€
the freeing of segments is not finalized until the writing of a log with a super root block containing this sufile change is complete, and it can be canceled with nilfs_sufile_cancel_freev until then. so yeah: not done until that log finishes writing. π₯
π RETURN π
0 on success, or one of the following negative error codes on failure:
-EINVALβ Invalid segment number.-EIOβ I/O error (including metadata corruption).-ENOMEMβ Insufficient memory available.
π₯ SEE ALSO π₯
Kernel file ./fs/nilfs2/segment.c β and these linked besties, in order, iykyk:
nilfs_transaction_begin(9)nilfs_transaction_commit(9)nilfs_segctor_reset_segment_buffer(9)nilfs_segctor_zeropad_segsum(9)nilfs_write_root_mdt_inode(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)
sign-off: from ./fs/nilfs2, dated October 2026, answering to the name nilfs_free_segments(9) β mwah πβ¨
π¦ 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