block/blk-throttle.h
Source file repositories/reference/linux-study-clean/block/blk-throttle.h
File Facts
- System
- Linux kernel
- Corpus path
block/blk-throttle.h- Extension
.h- Size
- 6597 bytes
- Lines
- 210
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
blk-cgroup-rwstat.h
Detected Declarations
struct throtl_qnodestruct throtl_service_queuestruct throtl_grpenum tg_state_flagsfunction blk_throtl_exitfunction blk_throtl_cancel_biosfunction blk_throtl_activatedfunction blk_should_throtlfunction blk_throtl_bio
Annotated Snippet
struct throtl_qnode {
struct list_head node; /* service_queue->queued[] */
struct bio_list bios_bps; /* queued bios for bps limit */
struct bio_list bios_iops; /* queued bios for iops limit */
struct throtl_grp *tg; /* tg this qnode belongs to */
};
struct throtl_service_queue {
struct throtl_service_queue *parent_sq; /* the parent service_queue */
/*
* Bios queued directly to this service_queue or dispatched from
* children throtl_grp's.
*/
struct list_head queued[2]; /* throtl_qnode [READ/WRITE] */
unsigned int nr_queued_bps[2]; /* number of queued bps bios */
unsigned int nr_queued_iops[2]; /* number of queued iops bios */
/*
* RB tree of active children throtl_grp's, which are sorted by
* their ->disptime.
*/
struct rb_root_cached pending_tree; /* RB tree of active tgs */
unsigned int nr_pending; /* # queued in the tree */
unsigned long first_pending_disptime; /* disptime of the first tg */
struct timer_list pending_timer; /* fires on first_pending_disptime */
};
enum tg_state_flags {
THROTL_TG_PENDING = 1 << 0, /* on parent's pending tree */
THROTL_TG_WAS_EMPTY = 1 << 1, /* bio_lists[] became non-empty */
/*
* The sq's iops queue is empty, and a bio is about to be enqueued
* to the first qnode's bios_iops list.
*/
THROTL_TG_IOPS_WAS_EMPTY = 1 << 2,
THROTL_TG_CANCELING = 1 << 3, /* starts to cancel bio */
};
struct throtl_grp {
/* must be the first member */
struct blkg_policy_data pd;
/* active throtl group service_queue member */
struct rb_node rb_node;
/* throtl_data this group belongs to */
struct throtl_data *td;
/* this group's service queue */
struct throtl_service_queue service_queue;
/*
* qnode_on_self is used when bios are directly queued to this
* throtl_grp so that local bios compete fairly with bios
* dispatched from children. qnode_on_parent is used when bios are
* dispatched from this throtl_grp into its parent and will compete
* with the sibling qnode_on_parents and the parent's
* qnode_on_self.
*/
struct throtl_qnode qnode_on_self[2];
struct throtl_qnode qnode_on_parent[2];
/*
* Dispatch time in jiffies. This is the estimated time when group
* will unthrottle and is ready to dispatch more bio. It is used as
* key to sort active groups in service tree.
*/
unsigned long disptime;
unsigned int flags;
/* are there any throtl rules between this group and td? */
bool has_rules_bps[2];
bool has_rules_iops[2];
/* bytes per second rate limits */
uint64_t bps[2];
/* IOPS limits */
unsigned int iops[2];
/*
* Number of bytes/bio's dispatched in current slice.
* When new configuration is submitted while some bios are still throttled,
* first calculate the carryover: the amount of bytes/IOs already waited
* under the previous configuration. Then, [bytes/io]_disp are represented
* as the negative of the carryover, and they will be used to calculate the
* wait time under the new configuration.
*/
Annotation
- Immediate include surface: `blk-cgroup-rwstat.h`.
- Detected declarations: `struct throtl_qnode`, `struct throtl_service_queue`, `struct throtl_grp`, `enum tg_state_flags`, `function blk_throtl_exit`, `function blk_throtl_cancel_bios`, `function blk_throtl_activated`, `function blk_should_throtl`, `function blk_throtl_bio`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.