ubifs_find_dirty_leb(9)
π
ubifs_find_dirty_leb(9) β Kernel API Manual π
okay bestie, welcome to the Kernel API Manual page for ubifs_find_dirty_leb(9). This one is all about the Garbage Collector finding a dirty LEB, and it's lowkey iconic. Let's get into it π
β¨ NAME β¨
ubifs_find_dirty_leb β find a dirty LEB for the Garbage Collector.
π SYNOPSIS π
Here's the signature, exactly as it appears, bestie β do not freestyle it:
int ubifs_find_dirty_leb (struct ubifs_info *c , struct ubifs_lprops
*ret_lp , int min_space , int pick_free );
π ARGUMENTS π
cβ the UBIFS file-system description object. It's giving main character energy for the whole operation π«Άret_lpβ LEB properties are returned here on exit. So this is where the goods land β¨min_spaceβ minimum amount free plus dirty space the returned LEB has to have. Like the bar for entry, no cap πpick_freeβ controls whether it is OK to pick empty or index LEBs. This little argument is the vibe check for free/freeable LEBs π
π¦ DESCRIPTION π¦
Okay so this function tries to find a dirty logical eraseblock which has at least min_space free and dirty space. It prefers to take an LEB from the dirty or dirty index heap, and it falls-back to LPT scanning if the heaps are empty or do not have an LEB which satisfies the min_space criteria. Obsessed with a fallback plan, honestly.
π¨ Note: LEBs which have less than dead watermark of free + dirty space are never picked by this function. Not even a little. Not even for you, bestie.
The additional pick_free argument controls if this function has to return a free or freeable LEB if one is present. For example, GC must set it to 1 when called from the journal space reservation function, because the appearance of free space may coincide with the loss of enough dirty space for GC to succeed anyway. It's giving "don't get fooled by a free-looking LEB" energy π
In contrast, if the Garbage Collector is called from budgeting, it should just make free space, not return LEBs which are already free or freeable. Periodt. Budgeting GC is not here to hand you a free LEB, it's here to make free space π
In addition pick_free is set to 2 by the recovery process in order to recover gc_lnum, in which case an index LEB must not be returned. That's the special recovery mode, and the index LEB rule is non-negotiable π«
This function returns zero and the LEB properties of found dirty LEB in case of success, -ENOSPC if no dirty LEB was found and a negative error code in case of other failures. The returned LEB is marked as "taken". So yeah: success means zero plus the found dirty LEB's props, no dirty LEB means -ENOSPC, and other failures throw a negative error code. The taken mark is the little "claimed" sticker π
π₯ SEE ALSO π₯
Kernel file ./fs/ubifs/find.c, plus the whole friend group:
struct scan_data(9)valuable(9)scan_for_dirty_cb(9)scan_for_dirty(9)scan_for_free_cb(9)do_find_free_space(9)ubifs_find_free_space(9)scan_for_idx_cb(9)scan_for_leb_for_idx(9)ubifs_find_free_leb_for_idx(9)ubifs_save_dirty_idx_lnums(9)scan_dirty_idx_cb(9)find_dirty_idx_leb(9)get_idx_gc_leb(9)find_dirtiest_idx_leb(9)ubifs_find_dirty_idx_leb(9)
π That's the whole page, bestie! Source/version: ./fs/ubifs; date: October 2026; page: ubifs_find_dirty_leb(9). Slay π
β¨
π¦ 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