drivers/md/dm-exception-store.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-exception-store.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-exception-store.h- Extension
.h- Size
- 5435 bytes
- Lines
- 207
- 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/blkdev.hlinux/list_bl.hlinux/device-mapper.h
Detected Declarations
struct dm_exceptionstruct dm_exception_storestruct dm_exception_store_typestruct dm_snapshotstruct dm_exception_storefunction dm_chunk_numberfunction dm_consecutive_chunk_countfunction dm_consecutive_chunk_count_incfunction dm_consecutive_chunk_count_decfunction get_dev_sizefunction sector_to_chunk
Annotated Snippet
struct dm_exception {
struct hlist_node hash_list;
chunk_t old_chunk;
chunk_t new_chunk;
};
/*
* Abstraction to handle the meta/layout of exception stores (the
* COW device).
*/
struct dm_exception_store;
struct dm_exception_store_type {
const char *name;
struct module *module;
int (*ctr)(struct dm_exception_store *store, char *options);
/*
* Destroys this object when you've finished with it.
*/
void (*dtr)(struct dm_exception_store *store);
/*
* The target shouldn't read the COW device until this is
* called. As exceptions are read from the COW, they are
* reported back via the callback.
*/
int (*read_metadata)(struct dm_exception_store *store,
int (*callback)(void *callback_context,
chunk_t old, chunk_t new),
void *callback_context);
/*
* Find somewhere to store the next exception.
*/
int (*prepare_exception)(struct dm_exception_store *store,
struct dm_exception *e);
/*
* Update the metadata with this exception.
*/
void (*commit_exception)(struct dm_exception_store *store,
struct dm_exception *e, int valid,
void (*callback)(void *, int success),
void *callback_context);
/*
* Returns 0 if the exception store is empty.
*
* If there are exceptions still to be merged, sets
* *last_old_chunk and *last_new_chunk to the most recent
* still-to-be-merged chunk and returns the number of
* consecutive previous ones.
*/
int (*prepare_merge)(struct dm_exception_store *store,
chunk_t *last_old_chunk, chunk_t *last_new_chunk);
/*
* Clear the last n exceptions.
* nr_merged must be <= the value returned by prepare_merge.
*/
int (*commit_merge)(struct dm_exception_store *store, int nr_merged);
/*
* The snapshot is invalid, note this in the metadata.
*/
void (*drop_snapshot)(struct dm_exception_store *store);
unsigned int (*status)(struct dm_exception_store *store,
status_type_t status, char *result,
unsigned int maxlen);
/*
* Return how full the snapshot is.
*/
void (*usage)(struct dm_exception_store *store,
sector_t *total_sectors, sector_t *sectors_allocated,
sector_t *metadata_sectors);
/* For internal device-mapper use only. */
struct list_head list;
};
struct dm_snapshot;
struct dm_exception_store {
struct dm_exception_store_type *type;
struct dm_snapshot *snap;
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/list_bl.h`, `linux/device-mapper.h`.
- Detected declarations: `struct dm_exception`, `struct dm_exception_store`, `struct dm_exception_store_type`, `struct dm_snapshot`, `struct dm_exception_store`, `function dm_chunk_number`, `function dm_consecutive_chunk_count`, `function dm_consecutive_chunk_count_inc`, `function dm_consecutive_chunk_count_dec`, `function get_dev_size`.
- 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.