drivers/md/md-bitmap.h
Source file repositories/reference/linux-study-clean/drivers/md/md-bitmap.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/md-bitmap.h- Extension
.h- Size
- 6393 bytes
- Lines
- 199
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct md_bitmap_statsstruct bitmap_operationsenum bitmap_statefunction md_bitmap_registeredfunction md_bitmap_enabledfunction md_bitmap_start_syncfunction md_bitmap_end_syncfunction md_bitmap_initfunction md_bitmap_exitfunction md_llbitmap_initfunction md_llbitmap_exit
Annotated Snippet
struct md_bitmap_stats {
u64 events_cleared;
int behind_writes;
bool behind_wait;
unsigned long missing_pages;
unsigned long file_pages;
unsigned long sync_size;
unsigned long pages;
struct file *file;
};
typedef void (md_bitmap_fn)(struct mddev *mddev, sector_t offset,
unsigned long sectors);
struct bitmap_operations {
struct md_submodule_head head;
bool (*enabled)(void *data, bool flush);
int (*create)(struct mddev *mddev);
int (*resize)(struct mddev *mddev, sector_t blocks, int chunksize);
int (*load)(struct mddev *mddev);
void (*destroy)(struct mddev *mddev);
void (*flush)(struct mddev *mddev);
void (*write_all)(struct mddev *mddev);
void (*dirty_bits)(struct mddev *mddev, unsigned long s,
unsigned long e);
void (*unplug)(struct mddev *mddev, bool sync);
void (*daemon_work)(struct mddev *mddev);
void (*start_behind_write)(struct mddev *mddev);
void (*end_behind_write)(struct mddev *mddev);
void (*wait_behind_writes)(struct mddev *mddev);
md_bitmap_fn *start_write;
md_bitmap_fn *end_write;
md_bitmap_fn *start_discard;
md_bitmap_fn *end_discard;
sector_t (*skip_sync_blocks)(struct mddev *mddev, sector_t offset);
bool (*blocks_synced)(struct mddev *mddev, sector_t offset);
bool (*start_sync)(struct mddev *mddev, sector_t offset,
sector_t *blocks, bool degraded);
void (*end_sync)(struct mddev *mddev, sector_t offset, sector_t *blocks);
void (*cond_end_sync)(struct mddev *mddev, sector_t sector, bool force);
void (*close_sync)(struct mddev *mddev);
void (*update_sb)(void *data);
int (*get_stats)(void *data, struct md_bitmap_stats *stats);
void (*sync_with_cluster)(struct mddev *mddev,
sector_t old_lo, sector_t old_hi,
sector_t new_lo, sector_t new_hi);
void *(*get_from_slot)(struct mddev *mddev, int slot);
int (*copy_from_slot)(struct mddev *mddev, int slot, sector_t *lo,
sector_t *hi, bool clear_bits);
void (*set_pages)(void *data, unsigned long pages);
void (*free)(void *data);
const struct attribute_group **groups;
};
/* the bitmap API */
static inline bool md_bitmap_registered(struct mddev *mddev)
{
return mddev->bitmap_ops != NULL;
}
static inline bool md_bitmap_enabled(struct mddev *mddev, bool flush)
{
/* bitmap_ops must be registered before creating bitmap. */
if (!md_bitmap_registered(mddev))
return false;
if (!mddev->bitmap)
return false;
return mddev->bitmap_ops->enabled(mddev->bitmap, flush);
}
static inline bool md_bitmap_start_sync(struct mddev *mddev, sector_t offset,
sector_t *blocks, bool degraded)
{
/* always resync if no bitmap */
if (!md_bitmap_enabled(mddev, false)) {
*blocks = 1024;
return true;
}
Annotation
- Detected declarations: `struct md_bitmap_stats`, `struct bitmap_operations`, `enum bitmap_state`, `function md_bitmap_registered`, `function md_bitmap_enabled`, `function md_bitmap_start_sync`, `function md_bitmap_end_sync`, `function md_bitmap_init`, `function md_bitmap_exit`, `function md_llbitmap_init`.
- 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.