drivers/md/raid5-ppl.c
Source file repositories/reference/linux-study-clean/drivers/md/raid5-ppl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/raid5-ppl.c- Extension
.c- Size
- 42426 bytes
- Lines
- 1522
- 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/kernel.hlinux/blkdev.hlinux/slab.hlinux/crc32c.hlinux/async_tx.hlinux/raid/md_p.hmd.hraid5.hraid5-log.h
Detected Declarations
struct ppl_confstruct ppl_logstruct ppl_io_unitfunction ops_run_partial_parityfunction ppl_io_pool_freefunction ppl_log_stripefunction ppl_write_stripefunction ppl_log_endiofunction list_for_each_entry_safefunction ppl_submit_iounit_biofunction ppl_submit_iounitfunction list_for_each_entryfunction ppl_submit_current_iofunction ppl_write_stripe_runfunction ppl_io_unit_finishedfunction ppl_flush_endiofunction ppl_do_flushfunction for_each_set_bitfunction ppl_no_io_unit_submittedfunction ppl_quiescefunction ppl_handle_flush_requestfunction ppl_stripe_write_finishedfunction ppl_xorfunction modifiedfunction ppl_recoverfunction ppl_write_empty_headerfunction ppl_load_distributedfunction ppl_loadfunction __ppl_exit_logfunction ppl_exit_logfunction ppl_validate_rdevfunction ppl_init_child_logfunction ppl_init_logfunction ppl_modify_logfunction ppl_write_hint_showfunction ppl_write_hint_store
Annotated Snippet
struct ppl_conf {
struct mddev *mddev;
/* array of child logs, one for each raid disk */
struct ppl_log *child_logs;
int count;
int block_size; /* the logical block size used for data_sector
* in ppl_header_entry */
u32 signature; /* raid array identifier */
atomic64_t seq; /* current log write sequence number */
struct kmem_cache *io_kc;
mempool_t io_pool;
struct bio_set bs;
struct bio_set flush_bs;
/* used only for recovery */
int recovered_entries;
int mismatch_count;
/* stripes to retry if failed to allocate io_unit */
struct list_head no_mem_stripes;
spinlock_t no_mem_stripes_lock;
unsigned short write_hint;
};
struct ppl_log {
struct ppl_conf *ppl_conf; /* shared between all log instances */
struct md_rdev *rdev; /* array member disk associated with
* this log instance */
struct mutex io_mutex;
struct ppl_io_unit *current_io; /* current io_unit accepting new data
* always at the end of io_list */
spinlock_t io_list_lock;
struct list_head io_list; /* all io_units of this log */
sector_t next_io_sector;
unsigned int entry_space;
bool use_multippl;
bool wb_cache_on;
unsigned long disk_flush_bitmap;
};
#define PPL_IO_INLINE_BVECS 32
struct ppl_io_unit {
struct ppl_log *log;
struct page *header_page; /* for ppl_header */
unsigned int entries_count; /* number of entries in ppl_header */
unsigned int pp_size; /* total size current of partial parity */
u64 seq; /* sequence number of this log write */
struct list_head log_sibling; /* log->io_list */
struct list_head stripe_list; /* stripes added to the io_unit */
atomic_t pending_stripes; /* how many stripes not written to raid */
atomic_t pending_flushes; /* how many disk flushes are in progress */
bool submitted; /* true if write to log started */
/* inline bio and its biovec for submitting the iounit */
struct bio bio;
struct bio_vec biovec[PPL_IO_INLINE_BVECS];
};
struct dma_async_tx_descriptor *
ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
struct dma_async_tx_descriptor *tx)
{
int disks = sh->disks;
struct page **srcs = percpu->scribble;
int count = 0, pd_idx = sh->pd_idx, i;
struct async_submit_ctl submit;
pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector);
/*
* Partial parity is the XOR of stripe data chunks that are not changed
* during the write request. Depending on available data
* (read-modify-write vs. reconstruct-write case) we calculate it
* differently.
*/
if (sh->reconstruct_state == reconstruct_state_prexor_drain_run) {
/*
* rmw: xor old data and parity from updated disks
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/blkdev.h`, `linux/slab.h`, `linux/crc32c.h`, `linux/async_tx.h`, `linux/raid/md_p.h`, `md.h`, `raid5.h`.
- Detected declarations: `struct ppl_conf`, `struct ppl_log`, `struct ppl_io_unit`, `function ops_run_partial_parity`, `function ppl_io_pool_free`, `function ppl_log_stripe`, `function ppl_write_stripe`, `function ppl_log_endio`, `function list_for_each_entry_safe`, `function ppl_submit_iounit_bio`.
- 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.