nilfs_free_segments(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the nilfs object. your main character 🫢
  • segnumv β€” array of segment numbers to be freed. yes bestie, the whole array πŸ’…
  • nsegs β€” number of segments to be freed in segnumv. 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:

sign-off: from ./fs/nilfs2, dated October 2026, answering to the name nilfs_free_segments(9) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from