DCDR(9) Hyra Kernel Developer’s Manual DCDR(9)
NAME
dcdr - drive cache descriptor ring
SYNOPSIS
#include <dev/dcdr/cache.h>
struct dcdr *
dcdr_alloc(size_t bsize, size_t cap);
struct dcd *
dcdr_cachein(struct dcdr *dcdr, void *block, off_t lba);
struct dcd *
dcdr_lbc_cachein(struct dcdr *dcdr, void *block, off_t lba);
int
dcdr_lookup(struct dcdr *dcdr, off_t lba, struct dcdr_lookup *res);
int
dcdr_invldcd(struct dcdr *dcdr, off_t lba);
DESCRIPTION
The Drive Cache Descriptor Ring (DCDR) framework is used for caching of read/write operations for LBA-based storage media (e.g., certain SSDs and HDDs).
The dcd (drive cache descriptor) structure describes a single logical block within some storage media.
The dcdr structure describes a drive cache descriptor ring (DCDR). When a logical block is cached, a drive cache descriptor (DCD) is created and added to the DCDR.
The dcdr_alloc function allocates and returns a new DCDR. The size of each logical block is denoted by bsize. And the maximum capacity of the DCDR is denoted by cap.
The dcdr_cachein function caches a logical block into a DCDR pointed to by dcdr. The block argument points to a buffer holding the data contained within some logical block. It is recommended for this pointer to be aligned by the storage device’s block size. The lba argument is the Logical Block Address (LBA) this data exists at within the storage device.
DCDR implements a concept called Logical Block Coalescing (LBC) which is a method to optimize caching by combining a pair of adjacent logical blocks into a single DCD. In other words, two consecutive logical blocks can be represented by a single DCD. To cache a block with LBC, the dcdr_lbc_cachein function can be used.
The dcdr argument points to the target DCDR.
The block argument points to the first logical block. This creates a DCD that describes the first and next logical block.
The lba argument is the LBA this data exists at within the storage device.
The dcdr_lbc_cacheinp function searches the DCDR for a logical block at the LBA denoted by lba. The result is returned in a structure pointed to by res.
The dcdr_invldcd function invalidates a single DCD from a DCDR pointed to by dcdr. The lba argument denotes the Logical Block Address to be searched for.
AUTHORS
Ian Moffett <ian@osmora.org>
Hyra Dec 16 2024 Hyra