STRUCT MTD_PAIRING_SCHEME(9)
π struct mtd_pairing_scheme π
okay bestie, welcome to the Kernel API Manual page for struct mtd_pairing_scheme β the page pairing scheme description thatβs giving βNAND but make it organizedβ β¨ no cap.
π NAME π
struct mtd_pairing_scheme β page pairing scheme description. Thatβs the whole name-and-short-desc moment, cute and exact π
β¨ SYNOPSIS β¨
hereβs the struct in all its glory, copy-paste energy:
struct mtd_pairing_scheme {
int ngroups;
int (*get_info)(struct mtd_info *mtd, int wunit, struct
mtd_pairing_info *info);
int (*get_wunit)(struct mtd_info *mtd, const struct mtd_pairing_info
*info);
};
π«Ά Members π«Ά
okay so these are the members, and yes every single one matters:
ngroupsβ how many groups there are. It should be related to the number of bits per cell. Thatβs the vibe check: groups β bits per cell π«get_infoβ takes a write-unit (the page number inside an erase block) and turns it intomtd_pairinginformation (pair + group). It should fill theinfoparameter based on thewunitindex, or return-EINVALif thewunitparameter is invalid. Translation: give it a wunit, it fills in the pairing tea βget_wunitβ the reverse glow-up: converts pairing information into a write-unit (page) number. It should return thewunitindex pointed by the pairing information described in theinfoargument. If thereβs no wunit corresponding to the passed pairing information, it should return-EINVAL. So if the pairing info has no matching wunit? boom,-EINVALπ«
πΈ Description πΈ
See the mtd_pairing_info documentation for a detailed explanation of the pair and group concepts. Thatβs where the lore lives π
The mtd_pairing_scheme structure provides a generic solution to represent NAND page pairing scheme. Instead of exposing two big tables to do the write-unit <-> (pair + group) conversions, we ask the MTD drivers to implement the ->get_info and ->get_wunit functions. iconic design choice, honestly π
MTD users will then be able to query these information by using the mtd_pairing_info_to_wunit and mtd_wunit_to_pairing_info helpers. bestie, the helpers are literally right there π«Ά
ngroups is here to help MTD users iterating over all the pages in a given pair. This value can be retrieved by MTD users using the mtd_pairing_groups helper. yes, thereβs a helper for the group count too π
Examples are given in the mtd_pairing_info_to_wunit and mtd_wunit_to_pairing_info documentation. go peek, iykyk π
π SEE ALSO π
the whole friend group is here:
- Kernel file
./include/linux/mtd/mtd.hβ plus:struct mtd_oob_ops(9),struct mtd_oob_region(9),struct mtd_pairing_info(9),struct mtd_debug_info(9),struct mtd_part(9),struct mtd_master(9),mtd_align_erase_req(9)β¨
π source path./include/linux/mtdΒ· October 2026 Β·struct mtd_pairing_scheme(9)β thatβs the whole page, bestie, 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