Initial revision
[reactos.git] / reactos / doc / cacheman.txt
1 - Cache Manager
3 This document describes the current implementation of the cache manager.
5 - Description
7 In its current state the CM (cache manager) only includes primitives to
8 cache disk blocks, this is useful for filesystem metadata but it requires an
9 additional copy operation when reading files from cache. This will be fixed.
11 Each disk drive with data in the cache has an associated DCCB (Device Cache
12 Control Block) which details all the blocks from the device in memory. If a
13 filesystem requires cache services for a device it must call CbInitDccb to
14 initialize this structure.
16 Each block with data from a device has an associated CCB (Cache Control
17 Block) with a pointer to the physical memory used to hold the block, and
18 various state and locking information. When a filesystem requires a block
19 from the device it calls CbAcquireForRead or CbAcquireForWrite which ensure
20 the data for the block is uptodate (loading it from disk if necessary) and
21 return a pointer to the associated CCB. When a filesystem has finished with
22 a block it calls CbReleaseFromRead or CbReleaseFromWrite, it is important to
23 call these functions because the CM can only release blocks from the cache
24 if they have no active readers or writers. The CM also enforces cache
25 consistency by ensuring that while multiple threads can be reading a block
26 simultaneously, there is only ever one active writers.
28 The CM provides no support for deadlock prevention/detection as it has no
29 knowledge of the layout of a a filesystem (nor should it have).
31 - TODO