ubifs_compress_folio(9)
π ubifs_compress_folio (Kernel API Manual, bestie) π
Okay so real talk, this one is from the Kernel API Manual and it's genuinely so useful once it clicks. Strap in π
β¨ NAME β¨
ubifs_compress_folio β compress folio. That's the whole vibe. It compresses a folio, no cap. π¦
πΈ SYNOPSIS πΈ
void ubifs_compress_folio (const struct ubifs_info *c , struct folio
*in_folio , size_t in_offset , int in_len , void *out_buf , int *out_len
, int *compr_type );
Yes it returns void, yes there are seven arguments, and yes we're gonna go through every single one of them because that's just who I am π
π§ ARGUMENTS π§
cβ the UBIFS file-system description object. Your whole filesystem's little identity card, basically πin_folioβ the data to compress. The main character of this function, fr π«Άin_offsetβ offset intoin_folio. Like, where in the folio we actually start looking.in_lenβ length of the data to compress. How much of it we're grabbing.out_bufβ output buffer where the compressed data should be stored. The destination, the moment, the slay β¨out_lenβ output buffer length is returned here. So you hand it a pointer and it writes the length back. It's giving "I'll tell you how big it ended up being" πcompr_typeβ type of compression to use on enter, and the actually used compression type on exit. Lowkey a two-way street, it reads it on the way in and rewrites it on the way out π₯
π DESCRIPTION π
So what does it do? It compresses the input folio in_folio of length in_len, and it stores the result in the output buffer out_buf plus the resulting length in out_len. Iconic behavior, truly. π
But here's the part everyone forgets: if the input buffer does not compress, it's just copied to out_buf. No drama, no error, it just gets yeeted straight through as-is. And the exact same thing happens if compr_type is UBIFS_COMPR_NONE β or if a compression error occurred. So like, three different roads, all leading to "fine, we copy it then" π
Note, and this is the important bit bestie: if the input buffer was not compressed, it is copied to the output buffer andUBIFS_COMPR_NONEis returned incompr_type. So always checkcompr_typeafter, iykyk π
π SEE ALSO π
Kernel file ./fs/ubifs/compress.c, plus the whole friend group:
ubifs_compress(9)ubifs_decompress(9)ubifs_decompress_folio(9)compr_init(9)compr_exit(9)ubifs_compressors_init(9)ubifs_compressors_exit(9)
And that's the page! π Huge thanks to ./fs/ubifs for existing, dated October 2026, and to this manual page itself for being ubifs_compress_folio(9) β go compress something, bestie, you got this πβ¨
π¦ 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