drivers/md/dm-pcache/segment.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-pcache/segment.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-pcache/segment.h- Extension
.h- Size
- 1977 bytes
- Lines
- 75
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bio.hlinux/bitfield.hpcache_internal.h
Detected Declarations
struct pcache_segment_infostruct pcache_segment_posstruct pcache_segment_init_optionsstruct pcache_segmentfunction segment_info_has_nextfunction segment_info_set_typefunction segment_info_get_typefunction segment_pos_advance
Annotated Snippet
struct pcache_segment_info {
struct pcache_meta_header header;
__u32 flags;
__u32 next_seg;
};
#define PCACHE_SEG_INFO_FLAGS_HAS_NEXT BIT(0)
#define PCACHE_SEG_INFO_FLAGS_TYPE_MASK GENMASK(4, 1)
#define PCACHE_SEGMENT_TYPE_CACHE_DATA 1
static inline bool segment_info_has_next(struct pcache_segment_info *seg_info)
{
return (seg_info->flags & PCACHE_SEG_INFO_FLAGS_HAS_NEXT);
}
static inline void segment_info_set_type(struct pcache_segment_info *seg_info, u8 type)
{
seg_info->flags &= ~PCACHE_SEG_INFO_FLAGS_TYPE_MASK;
seg_info->flags |= FIELD_PREP(PCACHE_SEG_INFO_FLAGS_TYPE_MASK, type);
}
static inline u8 segment_info_get_type(struct pcache_segment_info *seg_info)
{
return FIELD_GET(PCACHE_SEG_INFO_FLAGS_TYPE_MASK, seg_info->flags);
}
struct pcache_segment_pos {
struct pcache_segment *segment; /* Segment associated with the position */
u32 off; /* Offset within the segment */
};
struct pcache_segment_init_options {
u8 type;
u32 seg_id;
u32 data_off;
struct pcache_segment_info *seg_info;
};
struct pcache_segment {
struct pcache_cache_dev *cache_dev;
void *data;
u32 data_size;
u32 seg_id;
struct pcache_segment_info *seg_info;
};
int segment_copy_to_bio(struct pcache_segment *segment,
u32 data_off, u32 data_len, struct bio *bio, u32 bio_off);
int segment_copy_from_bio(struct pcache_segment *segment,
u32 data_off, u32 data_len, struct bio *bio, u32 bio_off);
static inline void segment_pos_advance(struct pcache_segment_pos *seg_pos, u32 len)
{
BUG_ON(seg_pos->off + len > seg_pos->segment->data_size);
seg_pos->off += len;
}
void pcache_segment_init(struct pcache_cache_dev *cache_dev, struct pcache_segment *segment,
struct pcache_segment_init_options *options);
#endif /* _PCACHE_SEGMENT_H */
Annotation
- Immediate include surface: `linux/bio.h`, `linux/bitfield.h`, `pcache_internal.h`.
- Detected declarations: `struct pcache_segment_info`, `struct pcache_segment_pos`, `struct pcache_segment_init_options`, `struct pcache_segment`, `function segment_info_has_next`, `function segment_info_set_type`, `function segment_info_get_type`, `function segment_pos_advance`.
- Atlas domain: Driver Families / drivers/md.
- 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.