STRUCT BLK_STAT_CALLBACK(9)
π struct blk_stat_callback(9) π
okay so this is the Kernel API Manual, and todayβs main character is struct blk_stat_callback β block stats callback representation, no cap β¨
β¨ NAME β¨
struct blk_stat_callback β Block statistics callback. Thatβs the whole name section bestie, short and iconic π
β¨ SYNOPSIS β¨
struct blk_stat_callback {
struct list_head list;
struct timer_list timer;
struct blk_rq_stat __percpu *cpu_stat;
int (*bucket_fn)(const struct request *);
unsigned int buckets;
struct blk_rq_stat *stat;
void (*timer_fn)(struct blk_stat_callback *);
void *data;
struct rcu_head rcu;
};
Thatβs the struct, laid out exactly like that β copy it, respect it, donβt freestyle it π«Ά
π«Ά Members π«Ά
listβ the RCU list of callbacks for astruct request_queue.timerβ the timer for the next callback invocation β°cpu_statβ the per-cpu statistics buckets πbucket_fnβ given a request, returns which statistics bucket it should be accounted under; return-1for no bucket for this request.bucketsβ the number of statistics buckets.statβ the array of statistics buckets.timer_fnβ the callback function.dataβ a private pointer for the user.rcuβ therculist head.
πΈ Description πΈ
Hereβs the tea: a struct blk_stat_callback is associated with a struct request_queue π
While timer is active, that queueβs request completion latencies are sorted into buckets by bucket_fn and added to a per-cpu buffer, cpu_stat. When the timer fires, cpu_stat is flushed to stat and timer_fn is invoked. Literally the whole flow, and it ate π₯
π₯ SEE ALSO π₯
Kernel file ./block/blk-stat.h β also go read blk_stat_alloc_callback(9), blk_stat_add_callback(9), blk_stat_remove_callback(9), blk_stat_free_callback(9), blk_stat_is_active(9), blk_stat_activate_nsecs(9), and blk_stat_activate_msecs(9) π
source/version: ./block Β· date: October 2026 Β· page: struct blk_stat_callback(9) β signing off with maximum main character energy, 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