Documentation/admin-guide/device-mapper/cache.rst

Source file repositories/reference/linux-study-clean/Documentation/admin-guide/device-mapper/cache.rst

File Facts

System
Linux kernel
Corpus path
Documentation/admin-guide/device-mapper/cache.rst
Extension
.rst
Size
13262 bytes
Lines
338
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

=====
Cache
=====

Introduction
============

dm-cache is a device mapper target written by Joe Thornber, Heinz
Mauelshagen, and Mike Snitzer.

It aims to improve performance of a block device (eg, a spindle) by
dynamically migrating some of its data to a faster, smaller device
(eg, an SSD).

This device-mapper solution allows us to insert this caching at
different levels of the dm stack, for instance above the data device for
a thin-provisioning pool.  Caching solutions that are integrated more
closely with the virtual memory system should give better performance.

The target reuses the metadata library used in the thin-provisioning
library.

The decision as to what data to migrate and when is left to a plug-in
policy module.  Several of these have been written as we experiment,
and we hope other people will contribute others for specific io
scenarios (eg. a vm image server).

Glossary
========

  Migration
	       Movement of the primary copy of a logical block from one
	       device to the other.
  Promotion
	       Migration from slow device to fast device.
  Demotion
	       Migration from fast device to slow device.

The origin device always contains a copy of the logical block, which
may be out of date or kept in sync with the copy on the cache device
(depending on policy).

Design
======

Sub-devices
-----------

The target is constructed by passing three devices to it (along with
other parameters detailed later):

1. An origin device - the big, slow one.

2. A cache device - the small, fast one.

3. A small metadata device - records which blocks are in the cache,
   which are dirty, and extra hints for use by the policy object.
   This information could be put on the cache device, but having it
   separate allows the volume manager to configure it differently,
   e.g. as a mirror for extra robustness.  This metadata device may only
   be used by a single cache device.

Fixed block size
----------------

The origin is divided up into blocks of a fixed size.  This block size
is configurable when you first create the cache.  Typically we've been
using block sizes of 256KB - 1024KB.  The block size must be between 64
sectors (32KB) and 2097152 sectors (1GB) and a multiple of 64 sectors (32KB).

Annotation

Implementation Notes