Skip to content

Commit 981b327

Browse files
yangdongshengkawasaki
authored andcommitted
dm-pcache: add cache_req
Introduce cache_req.c, the high-level engine that drives I/O requests through dm-pcache. It decides whether data is served from the cache or fetched from the backing device, allocates new cache space on writes, and flushes dirty ksets when required. * Read path - Traverses the striped RB-trees to locate cached extents. - Generates backing READ requests for gaps and inserts placeholder “empty” keys to avoid duplicate fetches. - Copies valid data directly from pmem into the caller’s bio; CRC and generation checks guard against stale segments. * Write path - Allocates space in the current data segment via cache_data_alloc(). - Copies data from the bio into pmem, then inserts or updates keys, splitting or trimming overlapped ranges as needed. - Adds each new key to the active kset; forces kset close when FUA is requested or the kset is full. * Miss handling - create_cache_miss_req() builds a backing READ, optionally attaching an empty key. - miss_read_end_req() replaces the placeholder with real data once the READ completes, or deletes it on error. * Flush support - cache_flush() iterates over all ksets and forces them to close, ensuring data durability when REQ_PREFLUSH is received. Signed-off-by: Dongsheng Yang <[email protected]>
1 parent 5939e46 commit 981b327

1 file changed

Lines changed: 840 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)