Skip to content

Commit f0ba437

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: convert docs to ReST and rename to *.rst
The conversion is actually: - add blank lines and indentation in order to identify paragraphs; - fix tables markups; - add some lists markups; - mark literal blocks; - adjust title markups. At its new index.rst, let's add a :orphan: while this is not linked to the main index.rst file, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 8ea6188 commit f0ba437

36 files changed

Lines changed: 1142 additions & 814 deletions

Documentation/device-mapper/cache-policies.txt renamed to Documentation/device-mapper/cache-policies.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
=============================
12
Guidance for writing policies
23
=============================
34

@@ -30,7 +31,7 @@ multiqueue (mq)
3031

3132
This policy is now an alias for smq (see below).
3233

33-
The following tunables are accepted, but have no effect:
34+
The following tunables are accepted, but have no effect::
3435

3536
'sequential_threshold <#nr_sequential_ios>'
3637
'random_threshold <#nr_random_ios>'
@@ -56,7 +57,9 @@ mq policy's hints to be dropped. Also, performance of the cache may
5657
degrade slightly until smq recalculates the origin device's hotspots
5758
that should be cached.
5859

59-
Memory usage:
60+
Memory usage
61+
^^^^^^^^^^^^
62+
6063
The mq policy used a lot of memory; 88 bytes per cache block on a 64
6164
bit machine.
6265

@@ -69,7 +72,9 @@ cache block).
6972
All this means smq uses ~25bytes per cache block. Still a lot of
7073
memory, but a substantial improvement nontheless.
7174

72-
Level balancing:
75+
Level balancing
76+
^^^^^^^^^^^^^^^
77+
7378
mq placed entries in different levels of the multiqueue structures
7479
based on their hit count (~ln(hit count)). This meant the bottom
7580
levels generally had the most entries, and the top ones had very
@@ -94,7 +99,9 @@ is used to decide which blocks to promote. If the hotspot queue is
9499
performing badly then it starts moving entries more quickly between
95100
levels. This lets it adapt to new IO patterns very quickly.
96101

97-
Performance:
102+
Performance
103+
^^^^^^^^^^^
104+
98105
Testing smq shows substantially better performance than mq.
99106

100107
cleaner
@@ -105,16 +112,19 @@ The cleaner writes back all dirty blocks in a cache to decommission it.
105112
Examples
106113
========
107114

108-
The syntax for a table is:
115+
The syntax for a table is::
116+
109117
cache <metadata dev> <cache dev> <origin dev> <block size>
110118
<#feature_args> [<feature arg>]*
111119
<policy> <#policy_args> [<policy arg>]*
112120

113-
The syntax to send a message using the dmsetup command is:
121+
The syntax to send a message using the dmsetup command is::
122+
114123
dmsetup message <mapped device> 0 sequential_threshold 1024
115124
dmsetup message <mapped device> 0 random_threshold 8
116125

117-
Using dmsetup:
126+
Using dmsetup::
127+
118128
dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \
119129
/dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8"
120130
creates a 128GB large mapped device named 'blah' with the
Lines changed: 120 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
=====
2+
Cache
3+
=====
4+
15
Introduction
26
============
37

@@ -24,10 +28,13 @@ scenarios (eg. a vm image server).
2428
Glossary
2529
========
2630

27-
Migration - Movement of the primary copy of a logical block from one
31+
Migration
32+
Movement of the primary copy of a logical block from one
2833
device to the other.
29-
Promotion - Migration from slow device to fast device.
30-
Demotion - Migration from fast device to slow device.
34+
Promotion
35+
Migration from slow device to fast device.
36+
Demotion
37+
Migration from fast device to slow device.
3138

3239
The origin device always contains a copy of the logical block, which
3340
may be out of date or kept in sync with the copy on the cache device
@@ -169,45 +176,53 @@ Target interface
169176
Constructor
170177
-----------
171178

172-
cache <metadata dev> <cache dev> <origin dev> <block size>
173-
<#feature args> [<feature arg>]*
174-
<policy> <#policy args> [policy args]*
179+
::
180+
181+
cache <metadata dev> <cache dev> <origin dev> <block size>
182+
<#feature args> [<feature arg>]*
183+
<policy> <#policy args> [policy args]*
175184

176-
metadata dev : fast device holding the persistent metadata
177-
cache dev : fast device holding cached data blocks
178-
origin dev : slow device holding original data blocks
179-
block size : cache unit size in sectors
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
180190

181-
#feature args : number of feature arguments passed
182-
feature args : writethrough or passthrough (The default is writeback.)
191+
#feature args number of feature arguments passed
192+
feature args writethrough or passthrough (The default is writeback.)
183193

184-
policy : the replacement policy to use
185-
#policy args : an even number of arguments corresponding to
186-
key/value pairs passed to the policy
187-
policy args : key/value pairs passed to the policy
188-
E.g. 'sequential_threshold 1024'
189-
See cache-policies.txt for details.
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+
================ =======================================================
190201

191202
Optional feature arguments are:
192-
writethrough : write through caching that prohibits cache block
193-
content from being different from origin block content.
194-
Without this argument, the default behaviour is to write
195-
back cache block contents later for performance reasons,
196-
so they may differ from the corresponding origin blocks.
197-
198-
passthrough : a degraded mode useful for various cache coherency
199-
situations (e.g., rolling back snapshots of
200-
underlying storage). Reads and writes always go to
201-
the origin. If a write goes to a cached origin
202-
block, then the cache block is invalidated.
203-
To enable passthrough mode the cache must be clean.
204-
205-
metadata2 : use version 2 of the metadata. This stores the dirty bits
206-
in a separate btree, which improves speed of shutting
207-
down the cache.
208-
209-
no_discard_passdown : disable passing down discards from the cache
210-
to the origin's data device.
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+
==================== ========================================================
211226

212227
A policy called 'default' is always registered. This is an alias for
213228
the policy we currently think is giving best all round performance.
@@ -218,54 +233,61 @@ the characteristics of a specific policy, always request it by name.
218233
Status
219234
------
220235

221-
<metadata block size> <#used metadata blocks>/<#total metadata blocks>
222-
<cache block size> <#used cache blocks>/<#total cache blocks>
223-
<#read hits> <#read misses> <#write hits> <#write misses>
224-
<#demotions> <#promotions> <#dirty> <#features> <features>*
225-
<#core args> <core args>* <policy name> <#policy args> <policy args>*
226-
<cache metadata mode>
227-
228-
metadata block size : Fixed block size for each metadata block in
229-
sectors
230-
#used metadata blocks : Number of metadata blocks used
231-
#total metadata blocks : Total number of metadata blocks
232-
cache block size : Configurable block size for the cache device
233-
in sectors
234-
#used cache blocks : Number of blocks resident in the cache
235-
#total cache blocks : Total number of cache blocks
236-
#read hits : Number of times a READ bio has been mapped
237-
to the cache
238-
#read misses : Number of times a READ bio has been mapped
239-
to the origin
240-
#write hits : Number of times a WRITE bio has been mapped
241-
to the cache
242-
#write misses : Number of times a WRITE bio has been
243-
mapped to the origin
244-
#demotions : Number of times a block has been removed
245-
from the cache
246-
#promotions : Number of times a block has been moved to
247-
the cache
248-
#dirty : Number of blocks in the cache that differ
249-
from the origin
250-
#feature args : Number of feature args to follow
251-
feature args : 'writethrough' (optional)
252-
#core args : Number of core arguments (must be even)
253-
core args : Key/value pairs for tuning the core
254-
e.g. migration_threshold
255-
policy name : Name of the policy
256-
#policy args : Number of policy arguments to follow (must be even)
257-
policy args : Key/value pairs e.g. sequential_threshold
258-
cache metadata mode : ro if read-only, rw if read-write
259-
In serious cases where even a read-only mode is deemed unsafe
260-
no further I/O will be permitted and the status will just
261-
contain the string 'Fail'. The userspace recovery tools
262-
should then be used.
263-
needs_check : 'needs_check' if set, '-' if not set
264-
A metadata operation has failed, resulting in the needs_check
265-
flag being set in the metadata's superblock. The metadata
266-
device must be deactivated and checked/repaired before the
267-
cache can be made fully operational again. '-' indicates
268-
needs_check is not set.
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+
========================= =====================================================
269291

270292
Messages
271293
--------
@@ -274,11 +296,12 @@ Policies will have different tunables, specific to each one, so we
274296
need a generic way of getting and setting these. Device-mapper
275297
messages are used. (A sysfs interface would also be possible.)
276298

277-
The message format is:
299+
The message format is::
278300

279301
<key> <value>
280302

281-
E.g.
303+
E.g.::
304+
282305
dmsetup message my_cache 0 sequential_threshold 1024
283306

284307

@@ -290,11 +313,12 @@ of values from 5 to 9. Each cblock must be expressed as a decimal
290313
value, in the future a variant message that takes cblock ranges
291314
expressed in hexadecimal may be needed to better support efficient
292315
invalidation of larger caches. The cache must be in passthrough mode
293-
when invalidate_cblocks is used.
316+
when invalidate_cblocks is used::
294317

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

297-
E.g.
320+
E.g.::
321+
298322
dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789
299323

300324
Examples
@@ -304,8 +328,10 @@ The test suite can be found here:
304328

305329
https://github.com/jthornber/device-mapper-test-suite
306330

307-
dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
308-
/dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0'
309-
dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
310-
/dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \
311-
mq 4 sequential_threshold 1024 random_threshold 8'
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'
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
========
12
dm-delay
23
========
34

45
Device-Mapper's "delay" target delays reads and/or writes
56
and maps them to different devices.
67

7-
Parameters:
8+
Parameters::
9+
810
<device> <offset> <delay> [<write_device> <write_offset> <write_delay>
911
[<flush_device> <flush_offset> <flush_delay>]]
1012

@@ -14,15 +16,16 @@ Delays are specified in milliseconds.
1416

1517
Example scripts
1618
===============
17-
[[
18-
#!/bin/sh
19-
# Create device delaying rw operation for 500ms
20-
echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed
21-
]]
22-
23-
[[
24-
#!/bin/sh
25-
# Create device delaying only write operation for 500ms and
26-
# splitting reads and writes to different devices $1 $2
27-
echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed
28-
]]
19+
20+
::
21+
22+
#!/bin/sh
23+
# Create device delaying rw operation for 500ms
24+
echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed
25+
26+
::
27+
28+
#!/bin/sh
29+
# Create device delaying only write operation for 500ms and
30+
# splitting reads and writes to different devices $1 $2
31+
echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed

0 commit comments

Comments
 (0)