block/blk-cgroup.h
Source file repositories/reference/linux-study-clean/block/blk-cgroup.h
File Facts
- System
- Linux kernel
- Corpus path
block/blk-cgroup.h- Extension
.h- Size
- 15670 bytes
- Lines
- 507
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/blk-cgroup.hlinux/cgroup.hlinux/kthread.hlinux/blk-mq.hlinux/llist.hblk.h
Detected Declarations
struct blkcg_gqstruct blkg_policy_datastruct blkg_iostatstruct blkg_iostat_setstruct blkcg_gqstruct blkcgstruct blkg_policy_datastruct blkcg_policy_datastruct blkcg_policystruct blkg_conf_ctxstruct blkg_policy_datastruct blkcg_policy_datastruct blkcg_policystruct blkcgenum blkg_iostat_typefunction bio_issue_as_root_blkgfunction blkg_getfunction blkg_trygetfunction blkg_putfunction blkcg_unuse_delayfunction blkcg_clear_delayfunction blkcg_clear_delayfunction blk_cgroup_mergeablefunction blkcg_policy_enabledfunction blkg_init_queuefunction blkcg_exit_diskfunction blkcg_policy_unregisterfunction blkcg_deactivate_policyfunction blkg_get
Annotated Snippet
struct blkg_iostat {
u64 bytes[BLKG_IOSTAT_NR];
u64 ios[BLKG_IOSTAT_NR];
};
struct blkg_iostat_set {
struct u64_stats_sync sync;
struct blkcg_gq *blkg;
struct llist_node lnode;
int lqueued; /* queued in llist */
struct blkg_iostat cur;
struct blkg_iostat last;
};
/* association between a blk cgroup and a request queue */
struct blkcg_gq {
/* Pointer to the associated request_queue */
struct request_queue *q;
struct list_head q_node;
struct hlist_node blkcg_node;
struct blkcg *blkcg;
/* all non-root blkcg_gq's are guaranteed to have access to parent */
struct blkcg_gq *parent;
/* reference count */
struct percpu_ref refcnt;
/* is this blkg online? protected by both blkcg and q locks */
bool online;
struct blkg_iostat_set __percpu *iostat_cpu;
struct blkg_iostat_set iostat;
struct blkg_policy_data *pd[BLKCG_MAX_POLS];
#ifdef CONFIG_BLK_CGROUP_PUNT_BIO
spinlock_t async_bio_lock;
struct bio_list async_bios;
#endif
union {
struct work_struct async_bio_work;
struct work_struct free_work;
};
atomic_t use_delay;
atomic64_t delay_nsec;
atomic64_t delay_start;
u64 last_delay;
int last_use;
struct rcu_head rcu_head;
};
struct blkcg {
struct cgroup_subsys_state css;
spinlock_t lock;
refcount_t online_pin;
/* If there is block congestion on this cgroup. */
atomic_t congestion_count;
struct radix_tree_root blkg_tree;
struct blkcg_gq __rcu *blkg_hint;
struct hlist_head blkg_list;
struct blkcg_policy_data *cpd[BLKCG_MAX_POLS];
struct list_head all_blkcgs_node;
/*
* List of updated percpu blkg_iostat_set's since the last flush.
*/
struct llist_head __percpu *lhead;
#ifdef CONFIG_BLK_CGROUP_FC_APPID
char fc_app_id[FC_APPID_LEN];
#endif
#ifdef CONFIG_CGROUP_WRITEBACK
struct list_head cgwb_list;
#endif
};
static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css)
{
return css ? container_of(css, struct blkcg, css) : NULL;
}
/*
* A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a
* request_queue (q). This is used by blkcg policies which need to track
* information per blkcg - q pair.
Annotation
- Immediate include surface: `linux/blk-cgroup.h`, `linux/cgroup.h`, `linux/kthread.h`, `linux/blk-mq.h`, `linux/llist.h`, `blk.h`.
- Detected declarations: `struct blkcg_gq`, `struct blkg_policy_data`, `struct blkg_iostat`, `struct blkg_iostat_set`, `struct blkcg_gq`, `struct blkcg`, `struct blkg_policy_data`, `struct blkcg_policy_data`, `struct blkcg_policy`, `struct blkg_conf_ctx`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.