crush_do_rule(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ crush_do_rule(9) ✨

okay so bestie, you've wandered into the Kernel API Manual πŸ’… and this page is genuinely iconic β€” it's crush_do_rule(9), the actual kernel-side baddie that does the math. sit down, hydrate, let's get into it 🫢


🌸 NAME 🌸

crush_do_rule β€” calculate a mapping with the given input and rule

like, that's the whole vibe: you hand it an input and a rule, and it goes and computes you a mapping. no cap, that's the job. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

int crush_do_rule (const struct crush_map *map , int ruleno , int x ,
int *result , int result_max , const __u32 *weight , int weight_max ,
void *cwin , const struct crush_choose_arg *choose_args );

yes she takes nine arguments and yes she's highkey living her main character era. type it exactly like that, ok? πŸ”₯


πŸŽ€ ARGUMENTS πŸŽ€

okay so here's the cast of characters, going one by one, no skipping, periodt:

  • map β€” the crush_map. literally the map. it's giving "the whole world, in struct form." 🌈
  • ruleno β€” the rule id. which rule are we running? that's the number, bestie, you pick it. πŸ’…
  • x β€” hash input. this is the thing getting hashed. it's the seed of the whole situation. ✨
  • result β€” pointer to result vector. this is where the output lands. the Cinderella slipper of the function, if you will. πŸŽ€
  • result_max β€” maximum result size. the capacity, the limit, the "know your lane" of the result vector. πŸ¦‹
  • weight β€” weight vector (for map leaves). leaves only, iykyk. πŸ“
  • weight_max β€” size of weight vector. because a vector without a size is just chaos, and not the fun kind. 😭
  • cwin β€” pointer to at least crush_work_size bytes of memory. at least, bestie β€” don't be out here handing it 12 bytes and hoping for the best. πŸ™ˆ
  • choose_args β€” weights and ids for each known bucket. buckets get their own little weights-and-ids moment, and this is it. 🧚
ngl, that cwin one is the classic "must be big enough" situation β€” the page says at least crush_work_size bytes, so take that literally, fr fr. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

if you're nosy (we love a curious queen), go look at:

the whole friend group, together at last 🫢


okay that's the whole page, you ate that πŸ’– also for the record this one's from ./net/ceph/crush, dated October 2026 β€” so mark your calendar and stan responsibly, bestie. slay! 🌟

πŸ“¦ where this page comes from