drivers/md/dm-pcache/backing_dev.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-pcache/backing_dev.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-pcache/backing_dev.h- Extension
.h- Size
- 2950 bytes
- Lines
- 128
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device-mapper.hpcache_internal.h
Detected Declarations
struct pcache_backing_dev_reqstruct pcache_requeststruct pcache_backing_dev_reqstruct pcache_backing_devstruct dm_pcachestruct pcache_backing_dev_req_optsfunction backing_dev_req_coalesced_max_len
Annotated Snippet
struct pcache_backing_dev_req {
u8 type;
struct bio bio;
struct pcache_backing_dev *backing_dev;
void *priv_data;
backing_req_end_fn_t end_req;
struct list_head node;
int ret;
union {
struct {
struct pcache_request *upper_req;
u32 bio_off;
} req;
struct {
struct bio_vec inline_bvecs[BACKING_DEV_REQ_INLINE_BVECS];
struct bio_vec *bvecs;
u32 n_vecs;
} kmem;
};
};
struct pcache_backing_dev {
struct pcache_cache *cache;
struct dm_dev *dm_dev;
mempool_t req_pool;
mempool_t bvec_pool;
struct list_head submit_list;
spinlock_t submit_lock;
struct work_struct req_submit_work;
struct list_head complete_list;
spinlock_t complete_lock;
struct work_struct req_complete_work;
atomic_t inflight_reqs;
wait_queue_head_t inflight_wq;
u64 dev_size;
};
struct dm_pcache;
int backing_dev_start(struct dm_pcache *pcache);
void backing_dev_stop(struct dm_pcache *pcache);
struct pcache_backing_dev_req_opts {
u32 type;
union {
struct {
struct pcache_request *upper_req;
u32 req_off;
u32 len;
} req;
struct {
void *data;
blk_opf_t opf;
u32 len;
u64 backing_off;
} kmem;
};
gfp_t gfp_mask;
backing_req_end_fn_t end_fn;
void *priv_data;
};
static inline u32 backing_dev_req_coalesced_max_len(const void *data, u32 len)
{
const void *p = data;
u32 done = 0, in_page, to_advance;
struct page *first_page, *next_page;
if (!is_vmalloc_addr(data))
return len;
first_page = vmalloc_to_page(p);
advance:
in_page = PAGE_SIZE - offset_in_page(p);
to_advance = min_t(u32, in_page, len - done);
done += to_advance;
p += to_advance;
if (done == len)
return done;
Annotation
- Immediate include surface: `linux/device-mapper.h`, `pcache_internal.h`.
- Detected declarations: `struct pcache_backing_dev_req`, `struct pcache_request`, `struct pcache_backing_dev_req`, `struct pcache_backing_dev`, `struct dm_pcache`, `struct pcache_backing_dev_req_opts`, `function backing_dev_req_coalesced_max_len`.
- Atlas domain: Driver Families / drivers/md.
- 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.