← Documents Documentation/admin-guide/device-mapper/cache.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Device Mapper

dm-cache target

빠른 device를 block cache로 사용하는 dm-cache의 설계, operating mode, metadata, constructor·status·message interface를 설명합니다.

Source pathDocumentation/admin-guide/device-mapper/cache.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

구성과 data lifecycle

cache.rst:1-172

Origin·cache·metadata device, block 크기, 세 operating mode, migration과 metadata 일관성 모델을 정리합니다.

Target interface

cache.rst:173-337

Constructor, status field, policy message, cache-block invalidation과 dmsetup 예제를 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =====
2 Cache
3 =====
4
5 Introduction
6 ============
7
8 dm-cache is a device mapper target written by Joe Thornber, Heinz
9 Mauelshagen, and Mike Snitzer.
10
11 It aims to improve performance of a block device (eg, a spindle) by
12 dynamically migrating some of its data to a faster, smaller device
13 (eg, an SSD).
14
15 This device-mapper solution allows us to insert this caching at
16 different levels of the dm stack, for instance above the data device for
17 a thin-provisioning pool. Caching solutions that are integrated more
18 closely with the virtual memory system should give better performance.
19
20 The target reuses the metadata library used in the thin-provisioning
21 library.
22
23 The decision as to what data to migrate and when is left to a plug-in
24 policy module. Several of these have been written as we experiment,
25 and we hope other people will contribute others for specific io
26 scenarios (eg. a vm image server).
27
28 Glossary
29 ========
30
31 Migration
32 Movement of the primary copy of a logical block from one
33 device to the other.
34 Promotion
35 Migration from slow device to fast device.
36 Demotion
37 Migration from fast device to slow device.
38
39 The origin device always contains a copy of the logical block, which
40 may be out of date or kept in sync with the copy on the cache device
41 (depending on policy).
42
43 Design
44 ======
45
46 Sub-devices
47 -----------
48
49 The target is constructed by passing three devices to it (along with
50 other parameters detailed later):
51
52 1. An origin device - the big, slow one.
53
54 2. A cache device - the small, fast one.
55
56 3. A small metadata device - records which blocks are in the cache,
57 which are dirty, and extra hints for use by the policy object.
58 This information could be put on the cache device, but having it
59 separate allows the volume manager to configure it differently,
60 e.g. as a mirror for extra robustness. This metadata device may only
61 be used by a single cache device.
62
63 Fixed block size
64 ----------------
65
66 The origin is divided up into blocks of a fixed size. This block size
67 is configurable when you first create the cache. Typically we've been
68 using block sizes of 256KB - 1024KB. The block size must be between 64
69 sectors (32KB) and 2097152 sectors (1GB) and a multiple of 64 sectors (32KB).
70
71 Having a fixed block size simplifies the target a lot. But it is
72 something of a compromise. For instance, a small part of a block may be
73 getting hit a lot, yet the whole block will be promoted to the cache.
74 So large block sizes are bad because they waste cache space. And small
75 block sizes are bad because they increase the amount of metadata (both
76 in core and on disk).
77
78 Cache operating modes
79 ---------------------
80
81 The cache has three operating modes: writeback, writethrough and
82 passthrough.
83
84 If writeback, the default, is selected then a write to a block that is
85 cached will go only to the cache and the block will be marked dirty in
86 the metadata.
87
88 If writethrough is selected then a write to a cached block will not
89 complete until it has hit both the origin and cache devices. Clean
90 blocks should remain clean.
91
92 If passthrough is selected, useful when the cache contents are not known
93 to be coherent with the origin device, then all reads are served from
94 the origin device (all reads miss the cache) and all writes are
95 forwarded to the origin device; additionally, write hits cause cache
96 block invalidates. To enable passthrough mode the cache must be clean.
97 Passthrough mode allows a cache device to be activated without having to
98 worry about coherency. Coherency that exists is maintained, although
99 the cache will gradually cool as writes take place. If the coherency of
100 the cache can later be verified, or established through use of the
101 "invalidate_cblocks" message, the cache device can be transitioned to
102 writethrough or writeback mode while still warm. Otherwise, the cache
103 contents can be discarded prior to transitioning to the desired
104 operating mode.
105
106 A simple cleaner policy is provided, which will clean (write back) all
107 dirty blocks in a cache. Useful for decommissioning a cache or when
108 shrinking a cache. Shrinking the cache's fast device requires all cache
109 blocks, in the area of the cache being removed, to be clean. If the
110 area being removed from the cache still contains dirty blocks the resize
111 will fail. Care must be taken to never reduce the volume used for the
112 cache's fast device until the cache is clean. This is of particular
113 importance if writeback mode is used. Writethrough and passthrough
114 modes already maintain a clean cache. Future support to partially clean
115 the cache, above a specified threshold, will allow for keeping the cache
116 warm and in writeback mode during resize.
117
118 Migration throttling
119 --------------------
120
121 Migrating data between the origin and cache device uses bandwidth.
122 The user can set a throttle to prevent more than a certain amount of
123 migration occurring at any one time. Currently we're not taking any
124 account of normal io traffic going to the devices. More work needs
125 doing here to avoid migrating during those peak io moments.
126
127 For the time being, a message "migration_threshold <#sectors>"
128 can be used to set the maximum number of sectors being migrated,
129 the default being 2048 sectors (1MB).
130
131 Updating on-disk metadata
132 -------------------------
133
134 On-disk metadata is committed every time a FLUSH or FUA bio is written.
135 If no such requests are made then commits will occur every second. This
136 means the cache behaves like a physical disk that has a volatile write
137 cache. If power is lost you may lose some recent writes. The metadata
138 should always be consistent in spite of any crash.
139
140 The 'dirty' state for a cache block changes far too frequently for us
141 to keep updating it on the fly. So we treat it as a hint. In normal
142 operation it will be written when the dm device is suspended. If the
143 system crashes all cache blocks will be assumed dirty when restarted.
144
145 Per-block policy hints
146 ----------------------
147
148 Policy plug-ins can store a chunk of data per cache block. It's up to
149 the policy how big this chunk is, but it should be kept small. Like the
150 dirty flags this data is lost if there's a crash so a safe fallback
151 value should always be possible.
152
153 Policy hints affect performance, not correctness.
154
155 Policy messaging
156 ----------------
157
158 Policies will have different tunables, specific to each one, so we
159 need a generic way of getting and setting these. Device-mapper
160 messages are used. Refer to cache-policies.txt.
161
162 Discard bitset resolution
163 -------------------------
164
165 We can avoid copying data during migration if we know the block has
166 been discarded. A prime example of this is when mkfs discards the
167 whole block device. We store a bitset tracking the discard state of
168 blocks. However, we allow this bitset to have a different block size
169 from the cache blocks. This is because we need to track the discard
170 state for all of the origin device (compare with the dirty bitset
171 which is just for the smaller cache device).
172
173 Target interface
174 ================
175
176 Constructor
177 -----------
178
179 ::
180
181 cache <metadata dev> <cache dev> <origin dev> <block size>
182 <#feature args> [<feature arg>]*
183 <policy> <#policy args> [policy args]*
184
185 ================ =======================================================
186 metadata dev fast device holding the persistent metadata
187 cache dev fast device holding cached data blocks
188 origin dev slow device holding original data blocks
189 block size cache unit size in sectors
190
191 #feature args number of feature arguments passed
192 feature args writethrough or passthrough (The default is writeback.)
193
194 policy the replacement policy to use
195 #policy args an even number of arguments corresponding to
196 key/value pairs passed to the policy
197 policy args key/value pairs passed to the policy
198 E.g. 'sequential_threshold 1024'
199 See cache-policies.txt for details.
200 ================ =======================================================
201
202 Optional feature arguments are:
203
204
205 ==================== ========================================================
206 writethrough write through caching that prohibits cache block
207 content from being different from origin block content.
208 Without this argument, the default behaviour is to write
209 back cache block contents later for performance reasons,
210 so they may differ from the corresponding origin blocks.
211
212 passthrough a degraded mode useful for various cache coherency
213 situations (e.g., rolling back snapshots of
214 underlying storage). Reads and writes always go to
215 the origin. If a write goes to a cached origin
216 block, then the cache block is invalidated.
217 To enable passthrough mode the cache must be clean.
218
219 metadata2 use version 2 of the metadata. This stores the dirty
220 bits in a separate btree, which improves speed of
221 shutting down the cache.
222
223 no_discard_passdown disable passing down discards from the cache
224 to the origin's data device.
225 ==================== ========================================================
226
227 A policy called 'default' is always registered. This is an alias for
228 the policy we currently think is giving best all round performance.
229
230 As the default policy could vary between kernels, if you are relying on
231 the characteristics of a specific policy, always request it by name.
232
233 Status
234 ------
235
236 ::
237
238 <metadata block size> <#used metadata blocks>/<#total metadata blocks>
239 <cache block size> <#used cache blocks>/<#total cache blocks>
240 <#read hits> <#read misses> <#write hits> <#write misses>
241 <#demotions> <#promotions> <#dirty> <#features> <features>*
242 <#core args> <core args>* <policy name> <#policy args> <policy args>*
243 <cache metadata mode>
244
245
246 ========================= =====================================================
247 metadata block size Fixed block size for each metadata block in
248 sectors
249 #used metadata blocks Number of metadata blocks used
250 #total metadata blocks Total number of metadata blocks
251 cache block size Configurable block size for the cache device
252 in sectors
253 #used cache blocks Number of blocks resident in the cache
254 #total cache blocks Total number of cache blocks
255 #read hits Number of times a READ bio has been mapped
256 to the cache
257 #read misses Number of times a READ bio has been mapped
258 to the origin
259 #write hits Number of times a WRITE bio has been mapped
260 to the cache
261 #write misses Number of times a WRITE bio has been
262 mapped to the origin
263 #demotions Number of times a block has been removed
264 from the cache
265 #promotions Number of times a block has been moved to
266 the cache
267 #dirty Number of blocks in the cache that differ
268 from the origin
269 #feature args Number of feature args to follow
270 feature args 'writethrough' (optional)
271 #core args Number of core arguments (must be even)
272 core args Key/value pairs for tuning the core
273 e.g. migration_threshold
274 policy name Name of the policy
275 #policy args Number of policy arguments to follow (must be even)
276 policy args Key/value pairs e.g. sequential_threshold
277 cache metadata mode ro if read-only, rw if read-write
278
279 In serious cases where even a read-only mode is
280 deemed unsafe no further I/O will be permitted and
281 the status will just contain the string 'Fail'.
282 The userspace recovery tools should then be used.
283 needs_check 'needs_check' if set, '-' if not set
284 A metadata operation has failed, resulting in the
285 needs_check flag being set in the metadata's
286 superblock. The metadata device must be
287 deactivated and checked/repaired before the
288 cache can be made fully operational again.
289 '-' indicates needs_check is not set.
290 ========================= =====================================================
291
292 Messages
293 --------
294
295 Policies will have different tunables, specific to each one, so we
296 need a generic way of getting and setting these. Device-mapper
297 messages are used. (A sysfs interface would also be possible.)
298
299 The message format is::
300
301 <key> <value>
302
303 E.g.::
304
305 dmsetup message my_cache 0 sequential_threshold 1024
306
307
308 Invalidation is removing an entry from the cache without writing it
309 back. Cache blocks can be invalidated via the invalidate_cblocks
310 message, which takes an arbitrary number of cblock ranges. Each cblock
311 range's end value is "one past the end", meaning 5-10 expresses a range
312 of values from 5 to 9. Each cblock must be expressed as a decimal
313 value, in the future a variant message that takes cblock ranges
314 expressed in hexadecimal may be needed to better support efficient
315 invalidation of larger caches. The cache must be in passthrough mode
316 when invalidate_cblocks is used::
317
318 invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]*
319
320 E.g.::
321
322 dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789
323
324 Examples
325 ========
326
327 The test suite can be found here:
328
329 https://github.com/jthornber/device-mapper-test-suite
330
331 ::
332
333 dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
334 /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0'
335 dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
336 /dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \
337 mq 4 sequential_threshold 1024 random_threshold 8'
338

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

dm-cache 목적과 policy 분리

1-27

`dm-cache`는 Joe Thornber, Heinz Mauelshagen, Mike Snitzer가 작성한 device-mapper target입니다. Spindle 같은 block device의 일부 data를 SSD 같은 더 작고 빠른 device로 동적으로 옮겨 성능을 높이는 것이 목적입니다.

Device-mapper 방식이므로 thin-provisioning pool의 data device 위처럼 DM stack의 여러 level에 cache를 끼워 넣을 수 있습니다. Virtual memory system과 더 밀접하게 통합된 cache solution이 더 나은 성능을 낼 수 있습니다.

Target은 thin-provisioning library가 쓰는 metadata library를 재사용합니다. 어떤 data를 언제 migration할지는 plug-in policy module에 맡깁니다. 여러 실험 policy가 작성되었고, VM image server 같은 특정 I/O scenario용 policy도 기여할 수 있습니다.

dm-cache 기본 배치
Application I/ODevice-mapper stackdm-cache targetPolicy decisionOrigin or cache device

큰 origin의 일부 logical block을 작은 fast cache에 동적으로 배치합니다.

Migration, promotion, demotion

28-42
dm-cache 용어
용어의미
MigrationLogical block의 primary copy를 한 device에서 다른 device로 이동
PromotionSlow origin device에서 fast cache device로 migration
DemotionFast cache device에서 slow origin device로 migration

Logical block의 primary copy가 어느 방향으로 이동하는지를 구분합니다.

Origin device에는 logical block의 copy가 항상 남습니다. Policy에 따라 그 copy는 cache device의 copy보다 오래된 상태일 수도 있고, cache copy와 계속 동기화될 수도 있습니다.

Origin, cache, metadata device

43-62

Cache target은 뒤에서 설명할 parameter와 함께 origin device, cache device, metadata device의 세 device를 받아 구성합니다.

dm-cache의 세 sub-device
Device역할특징
Origin원본 logical block 보관크고 느린 device
Cache선택된 block의 빠른 copy 보관작고 빠른 device
MetadataCached/dirty block과 policy hint 기록별도 구성 가능, 한 cache device만 사용
undefinedundefined

Data와 persistent state를 역할별 device에 나눕니다.

고정 cache block 크기의 절충

63-77

Origin은 처음 cache를 만들 때 정한 고정 크기 block으로 나뉩니다. 보통 256KB에서 1024KB를 사용합니다. 허용 범위는 64 sector(32KB)에서 `2097152` sector(1GB)이고, 64 sector(32KB)의 배수여야 합니다.

고정 block 크기는 target을 크게 단순화하지만 절충이 필요합니다. Block 일부만 자주 접근되어도 전체 block을 promotion합니다. 큰 block은 cache 공간을 낭비하고, 작은 block은 memory와 disk 양쪽의 metadata 양을 늘립니다.

Cache block 크기 선택
크기장점비용
큰 blockMetadata entry 감소부분 hotspot도 전체 promotion, 공간 낭비
작은 blockHot data를 세밀하게 cacheCore/disk metadata 증가
허용 범위32KB-1GB32KB 단위

Workload와 metadata 비용 사이의 절충입니다.

writeback, writethrough, passthrough

78-117

Cache에는 `writeback`, `writethrough`, `passthrough` 세 operating mode가 있습니다.

Cache operating mode
ModeRead/Write 동작Dirty 상태와 용도
`writeback`Cached block write는 cache에만 기록기본값, metadata에서 dirty로 표시
`writethrough`Origin과 cache 모두에 도달해야 write 완료Clean block은 clean 유지
`passthrough`모든 read/write를 origin으로 전달Write hit는 cache block 무효화, 시작 시 cache가 clean해야 함

Write 처리와 origin/cache coherence 방식이 다릅니다.

Passthrough는 cache 내용이 origin과 coherent한지 알 수 없을 때 유용합니다. 현재 coherence는 유지되지만 write가 진행될수록 cache는 점차 식습니다. 나중에 coherence를 검증하거나 `invalidate_cblocks` message로 확립하면 warm 상태를 유지한 채 writethrough나 writeback으로 바꿀 수 있습니다. 그렇지 않으면 원하는 mode로 바꾸기 전에 cache 내용을 버려야 합니다.

단순한 `cleaner` policy는 dirty block을 모두 writeback합니다. Cache를 폐기하거나 줄일 때 유용합니다. Fast device에서 제거할 영역의 cache block이 모두 clean하지 않으면 resize가 실패하므로 cache가 clean해지기 전에는 fast volume을 절대 줄이면 안 됩니다. 특히 writeback mode에서 중요하며, writethrough와 passthrough는 이미 clean cache를 유지합니다. 향후에는 지정 threshold 위쪽만 부분적으로 clean해 resize 중에도 cache를 warm writeback 상태로 유지할 수 있도록 할 예정입니다.

Cache 축소 전 cleaner 절차
Plan cache shrinkSelect cleaner policyWrite back dirty blocksVerify removal area is cleanReduce fast volume

제거할 fast-device 영역에 dirty block이 남지 않도록 먼저 정리합니다.

Migration throttle과 on-disk metadata

118-144

Origin과 cache 사이의 data migration은 bandwidth를 씁니다. 동시에 이동할 sector 수를 제한하는 throttle을 설정할 수 있습니다. 현재는 device로 향하는 일반 I/O traffic을 고려하지 않으므로 peak I/O 시간의 migration을 피하는 개선이 필요합니다.

현재는 `migration_threshold <#sectors>` message로 동시에 migration할 최대 sector 수를 정하며 기본값은 2048 sector(1MB)입니다.

FLUSH 또는 FUA bio가 write될 때마다 on-disk metadata를 commit합니다. 그런 request가 없으면 1초마다 commit합니다. 따라서 volatile write cache가 있는 물리 disk처럼 동작하며, 전원을 잃으면 최근 write 일부를 잃을 수 있지만 crash 뒤에도 metadata 자체는 일관되어야 합니다.

Cache block의 `dirty` 상태는 너무 자주 바뀌므로 매번 즉시 disk에 갱신하지 않고 hint로 취급합니다. 정상 동작에서는 DM device를 suspend할 때 기록합니다. System이 crash하면 restart 시 모든 cache block을 dirty로 간주합니다.

Metadata commit과 crash recovery
FLUSH/FUA bioCommit metadataPersistent mapping remains consistent
No FLUSH/FUAPeriodic 1-second commitPower loss may drop recent writes
Crash before dirty hint flushRestartAssume every cache block dirty

정상 commit trigger와 dirty hint의 보수적 복구 방식입니다.

Policy hint, message와 discard bitset

145-172

Policy plug-in은 cache block마다 작은 data chunk를 저장할 수 있습니다. 크기는 policy가 정하지만 작게 유지해야 합니다. Dirty flag처럼 crash 시 사라지므로 항상 안전한 fallback 값을 만들 수 있어야 합니다. Policy hint는 correctness가 아니라 performance에만 영향을 줍니다.

Policy마다 tunable이 다르므로 이를 읽고 설정하는 generic mechanism으로 device-mapper message를 사용합니다. 자세한 내용은 `cache-policies.txt`를 참고합니다.

Block이 discard되었음을 알면 migration 때 data copy를 생략할 수 있습니다. 대표적으로 `mkfs`가 block device 전체를 discard하는 경우가 있습니다. 이를 위해 block의 discard state를 bitset으로 추적합니다.

Discard bitset은 cache block과 다른 block 크기를 쓸 수 있습니다. Dirty bitset은 더 작은 cache device만 추적하지만 discard state는 origin device 전체를 추적해야 하기 때문입니다.

Discard-aware migration
Origin block marked discardedDiscard bitset records stateMigration requestedSkip data copyUpdate cache mapping

Discard state가 알려진 영역은 불필요한 data copy를 건너뜁니다.

Cache target constructor

173-232

Cache target의 constructor table 형식은 다음과 같습니다.

   cache <metadata dev> <cache dev> <origin dev> <block size>
         <#feature args> [<feature arg>]*
         <policy> <#policy args> [policy args]*
Constructor 기본 field
Field의미
`metadata dev`Persistent metadata를 보관하는 fast device
`cache dev`Cached data block을 보관하는 fast device
`origin dev`Original data block을 보관하는 slow device
`block size`Sector 단위 cache unit 크기
`#feature args`뒤따르는 feature argument 수
`feature args``writethrough` 또는 `passthrough`; 기본은 writeback
`policy`사용할 replacement policy
`#policy args`Policy key/value argument의 짝수 개수
`policy args`예: `sequential_threshold 1024`

Device, block size, feature와 policy를 순서대로 지정합니다.

선택 feature argument
Feature동작
`writethrough`Cache block과 origin block 내용이 달라지지 않도록 write-through 수행
`passthrough`Read/write를 origin으로 보내고 write hit의 cache block을 무효화; clean cache 필요
`metadata2`Dirty bit를 별도 btree에 저장해 cache shutdown 속도 향상
`no_discard_passdown`Cache에서 origin data device로 discard 전달을 비활성화

Constructor에서 cache의 coherence와 metadata 동작을 조정합니다.

`default`라는 policy는 항상 등록되며 현재 가장 전반적인 성능이 좋다고 판단한 policy의 alias입니다. Kernel에 따라 default가 바뀔 수 있으므로 특정 policy 특성에 의존한다면 이름을 명시해야 합니다.

Status 출력과 복구 신호

233-291

Cache target status는 metadata/cache 사용량, hit/miss, migration, dirty block, feature와 policy, metadata mode를 다음 순서로 출력합니다.

  <metadata block size> <#used metadata blocks>/<#total metadata blocks>
  <cache block size> <#used cache blocks>/<#total cache blocks>
  <#read hits> <#read misses> <#write hits> <#write misses>
  <#demotions> <#promotions> <#dirty> <#features> <features>*
  <#core args> <core args>* <policy name> <#policy args> <policy args>*
  <cache metadata mode>
Cache status field
Field설명
`metadata block size`Sector 단위 고정 metadata block 크기
`#used metadata blocks`사용 중인 metadata block 수
`#total metadata blocks`전체 metadata block 수
`cache block size`Sector 단위 configurable cache block 크기
`#used cache blocks`Cache에 resident한 block 수
`#total cache blocks`전체 cache block 수
`#read hits`READ bio가 cache로 map된 횟수
`#read misses`READ bio가 origin으로 map된 횟수
`#write hits`WRITE bio가 cache로 map된 횟수
`#write misses`WRITE bio가 origin으로 map된 횟수
`#demotions`Cache에서 block을 제거한 횟수
`#promotions`Block을 cache로 옮긴 횟수
`#dirty`Origin과 내용이 다른 cache block 수
`#feature args`뒤따르는 feature argument 수
`feature args`선택적 `writethrough` 등
`#core args`뒤따르는 짝수 개 core argument 수
`core args``migration_threshold` 같은 core tuning key/value
`policy name`Policy 이름
`#policy args` / `policy args`짝수 개 policy key/value
`cache metadata mode`Read-only는 `ro`, read-write는 `rw`
`needs_check`설정되면 `needs_check`, 아니면 `-`
undefinedundefined
undefinedundefined

Status line의 각 field가 나타내는 값입니다.

Policy message, cache block 무효화와 생성 예

292-337

서로 다른 policy tunable을 generic하게 읽고 설정하기 위해 device-mapper message를 사용합니다. Sysfs interface도 가능하지만 이 target은 message 형식을 사용합니다.

   <key> <value>

예를 들어 다음 명령으로 sequential threshold를 설정합니다.

   dmsetup message my_cache 0 sequential_threshold 1024

Invalidation은 cache entry를 writeback하지 않고 제거하는 동작입니다. `invalidate_cblocks` message는 임의 개수의 cache-block range를 받습니다. Range의 end는 포함하지 않는 one-past-the-end 값이므로 `5-10`은 5부터 9까지입니다. 각 cblock은 decimal로 써야 하며, 큰 cache를 효율적으로 무효화하려면 향후 hexadecimal range variant가 필요할 수 있습니다. 이 message를 사용할 때 cache는 passthrough mode여야 합니다.

   invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]*

아래 예는 cblock `2345`, `3456-4566`, `5678-6788`을 무효화합니다.

   dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789

Test suite는 `https://github.com/jthornber/device-mapper-test-suite`에 있습니다. 다음 두 constructor 예는 각각 block size 512의 default policy와 block size 1024의 mq policy를 사용합니다.

  dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
	  /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0'
  dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
	  /dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \
	  mq 4 sequential_threshold 1024 random_threshold 8'
invalidate_cblocks 처리
Switch clean cache to passthroughSend decimal cblock rangesInterpret end as one-past-the-endInvalidate entries without writeback

Passthrough mode에서 지정 cache block을 writeback 없이 제거합니다.