summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-12 13:52:43 -0400
committerJonathan Corbet <corbet@lwn.net>2019-06-14 16:21:04 -0400
commitf0ba43774cea3fc14732bb9243ce7238ae8a3202 (patch)
tree5579b300bfc410ed14bb3112586cef02750d7eb0
parent8ea618899b6b4fbe97c8462e7d769867307de011 (diff)
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>
-rw-r--r--Documentation/device-mapper/cache-policies.rst (renamed from Documentation/device-mapper/cache-policies.txt)24
-rw-r--r--Documentation/device-mapper/cache.rst (renamed from Documentation/device-mapper/cache.txt)214
-rw-r--r--Documentation/device-mapper/delay.rst (renamed from Documentation/device-mapper/delay.txt)29
-rw-r--r--Documentation/device-mapper/dm-crypt.rst (renamed from Documentation/device-mapper/dm-crypt.txt)61
-rw-r--r--Documentation/device-mapper/dm-flakey.rst (renamed from Documentation/device-mapper/dm-flakey.txt)45
-rw-r--r--Documentation/device-mapper/dm-init.rst (renamed from Documentation/device-mapper/dm-init.txt)75
-rw-r--r--Documentation/device-mapper/dm-integrity.rst (renamed from Documentation/device-mapper/dm-integrity.txt)62
-rw-r--r--Documentation/device-mapper/dm-io.rst (renamed from Documentation/device-mapper/dm-io.txt)14
-rw-r--r--Documentation/device-mapper/dm-log.rst (renamed from Documentation/device-mapper/dm-log.txt)5
-rw-r--r--Documentation/device-mapper/dm-queue-length.rst (renamed from Documentation/device-mapper/dm-queue-length.txt)25
-rw-r--r--Documentation/device-mapper/dm-raid.rst (renamed from Documentation/device-mapper/dm-raid.txt)225
-rw-r--r--Documentation/device-mapper/dm-service-time.rst (renamed from Documentation/device-mapper/dm-service-time.txt)76
-rw-r--r--Documentation/device-mapper/dm-uevent.rst110
-rw-r--r--Documentation/device-mapper/dm-uevent.txt97
-rw-r--r--Documentation/device-mapper/dm-zoned.rst (renamed from Documentation/device-mapper/dm-zoned.txt)10
-rw-r--r--Documentation/device-mapper/era.rst (renamed from Documentation/device-mapper/era.txt)36
-rw-r--r--Documentation/device-mapper/index.rst44
-rw-r--r--Documentation/device-mapper/kcopyd.rst (renamed from Documentation/device-mapper/kcopyd.txt)10
-rw-r--r--Documentation/device-mapper/linear.rst63
-rw-r--r--Documentation/device-mapper/linear.txt61
-rw-r--r--Documentation/device-mapper/log-writes.rst (renamed from Documentation/device-mapper/log-writes.txt)105
-rw-r--r--Documentation/device-mapper/persistent-data.rst (renamed from Documentation/device-mapper/persistent-data.txt)4
-rw-r--r--Documentation/device-mapper/snapshot.rst (renamed from Documentation/device-mapper/snapshot.txt)116
-rw-r--r--Documentation/device-mapper/statistics.rst (renamed from Documentation/device-mapper/statistics.txt)62
-rw-r--r--Documentation/device-mapper/striped.rst61
-rw-r--r--Documentation/device-mapper/striped.txt57
-rw-r--r--Documentation/device-mapper/switch.rst (renamed from Documentation/device-mapper/switch.txt)47
-rw-r--r--Documentation/device-mapper/thin-provisioning.rst (renamed from Documentation/device-mapper/thin-provisioning.txt)68
-rw-r--r--Documentation/device-mapper/unstriped.rst (renamed from Documentation/device-mapper/unstriped.txt)93
-rw-r--r--Documentation/device-mapper/verity.rst (renamed from Documentation/device-mapper/verity.txt)20
-rw-r--r--Documentation/device-mapper/writecache.rst (renamed from Documentation/device-mapper/writecache.txt)13
-rw-r--r--Documentation/device-mapper/zero.rst (renamed from Documentation/device-mapper/zero.txt)14
-rw-r--r--Documentation/filesystems/ubifs-authentication.md4
-rw-r--r--drivers/md/Kconfig2
-rw-r--r--drivers/md/dm-init.c2
-rw-r--r--drivers/md/dm-raid.c2
36 files changed, 1142 insertions, 814 deletions
diff --git a/Documentation/device-mapper/cache-policies.txt b/Documentation/device-mapper/cache-policies.rst
index 86786d87d9a8..b17fe352fc41 100644
--- a/Documentation/device-mapper/cache-policies.txt
+++ b/Documentation/device-mapper/cache-policies.rst
@@ -1,3 +1,4 @@
1=============================
1Guidance for writing policies 2Guidance for writing policies
2============================= 3=============================
3 4
@@ -30,7 +31,7 @@ multiqueue (mq)
30 31
31This policy is now an alias for smq (see below). 32This policy is now an alias for smq (see below).
32 33
33The following tunables are accepted, but have no effect: 34The following tunables are accepted, but have no effect::
34 35
35 'sequential_threshold <#nr_sequential_ios>' 36 'sequential_threshold <#nr_sequential_ios>'
36 'random_threshold <#nr_random_ios>' 37 'random_threshold <#nr_random_ios>'
@@ -56,7 +57,9 @@ mq policy's hints to be dropped. Also, performance of the cache may
56degrade slightly until smq recalculates the origin device's hotspots 57degrade slightly until smq recalculates the origin device's hotspots
57that should be cached. 58that should be cached.
58 59
59Memory usage: 60Memory usage
61^^^^^^^^^^^^
62
60The mq policy used a lot of memory; 88 bytes per cache block on a 64 63The mq policy used a lot of memory; 88 bytes per cache block on a 64
61bit machine. 64bit machine.
62 65
@@ -69,7 +72,9 @@ cache block).
69All this means smq uses ~25bytes per cache block. Still a lot of 72All this means smq uses ~25bytes per cache block. Still a lot of
70memory, but a substantial improvement nontheless. 73memory, but a substantial improvement nontheless.
71 74
72Level balancing: 75Level balancing
76^^^^^^^^^^^^^^^
77
73mq placed entries in different levels of the multiqueue structures 78mq placed entries in different levels of the multiqueue structures
74based on their hit count (~ln(hit count)). This meant the bottom 79based on their hit count (~ln(hit count)). This meant the bottom
75levels generally had the most entries, and the top ones had very 80levels 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
94performing badly then it starts moving entries more quickly between 99performing badly then it starts moving entries more quickly between
95levels. This lets it adapt to new IO patterns very quickly. 100levels. This lets it adapt to new IO patterns very quickly.
96 101
97Performance: 102Performance
103^^^^^^^^^^^
104
98Testing smq shows substantially better performance than mq. 105Testing smq shows substantially better performance than mq.
99 106
100cleaner 107cleaner
@@ -105,16 +112,19 @@ The cleaner writes back all dirty blocks in a cache to decommission it.
105Examples 112Examples
106======== 113========
107 114
108The syntax for a table is: 115The syntax for a table is::
116
109 cache <metadata dev> <cache dev> <origin dev> <block size> 117 cache <metadata dev> <cache dev> <origin dev> <block size>
110 <#feature_args> [<feature arg>]* 118 <#feature_args> [<feature arg>]*
111 <policy> <#policy_args> [<policy arg>]* 119 <policy> <#policy_args> [<policy arg>]*
112 120
113The syntax to send a message using the dmsetup command is: 121The syntax to send a message using the dmsetup command is::
122
114 dmsetup message <mapped device> 0 sequential_threshold 1024 123 dmsetup message <mapped device> 0 sequential_threshold 1024
115 dmsetup message <mapped device> 0 random_threshold 8 124 dmsetup message <mapped device> 0 random_threshold 8
116 125
117Using dmsetup: 126Using dmsetup::
127
118 dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \ 128 dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \
119 /dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8" 129 /dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8"
120 creates a 128GB large mapped device named 'blah' with the 130 creates a 128GB large mapped device named 'blah' with the
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.rst
index 8ae1cf8e94da..f15e5254d05b 100644
--- a/Documentation/device-mapper/cache.txt
+++ b/Documentation/device-mapper/cache.rst
@@ -1,3 +1,7 @@
1=====
2Cache
3=====
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -24,10 +28,13 @@ scenarios (eg. a vm image server).
24Glossary 28Glossary
25======== 29========
26 30
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
28 device to the other. 33 device to the other.
29 Promotion - Migration from slow device to fast device. 34 Promotion
30 Demotion - Migration from fast device to slow device. 35 Migration from slow device to fast device.
36 Demotion
37 Migration from fast device to slow device.
31 38
32The origin device always contains a copy of the logical block, which 39The origin device always contains a copy of the logical block, which
33may be out of date or kept in sync with the copy on the cache device 40may be out of date or kept in sync with the copy on the cache device
@@ -169,45 +176,53 @@ Target interface
169Constructor 176Constructor
170----------- 177-----------
171 178
172 cache <metadata dev> <cache dev> <origin dev> <block size> 179 ::
173 <#feature args> [<feature arg>]* 180
174 <policy> <#policy args> [policy args]* 181 cache <metadata dev> <cache dev> <origin dev> <block size>
182 <#feature args> [<feature arg>]*
183 <policy> <#policy args> [policy args]*
175 184
176 metadata dev : fast device holding the persistent metadata 185 ================ =======================================================
177 cache dev : fast device holding cached data blocks 186 metadata dev fast device holding the persistent metadata
178 origin dev : slow device holding original data blocks 187 cache dev fast device holding cached data blocks
179 block size : cache unit size in sectors 188 origin dev slow device holding original data blocks
189 block size cache unit size in sectors
180 190
181 #feature args : number of feature arguments passed 191 #feature args number of feature arguments passed
182 feature args : writethrough or passthrough (The default is writeback.) 192 feature args writethrough or passthrough (The default is writeback.)
183 193
184 policy : the replacement policy to use 194 policy the replacement policy to use
185 #policy args : an even number of arguments corresponding to 195 #policy args an even number of arguments corresponding to
186 key/value pairs passed to the policy 196 key/value pairs passed to the policy
187 policy args : key/value pairs passed to the policy 197 policy args key/value pairs passed to the policy
188 E.g. 'sequential_threshold 1024' 198 E.g. 'sequential_threshold 1024'
189 See cache-policies.txt for details. 199 See cache-policies.txt for details.
200 ================ =======================================================
190 201
191Optional feature arguments are: 202Optional feature arguments are:
192 writethrough : write through caching that prohibits cache block 203
193 content from being different from origin block content. 204
194 Without this argument, the default behaviour is to write 205 ==================== ========================================================
195 back cache block contents later for performance reasons, 206 writethrough write through caching that prohibits cache block
196 so they may differ from the corresponding origin blocks. 207 content from being different from origin block content.
197 208 Without this argument, the default behaviour is to write
198 passthrough : a degraded mode useful for various cache coherency 209 back cache block contents later for performance reasons,
199 situations (e.g., rolling back snapshots of 210 so they may differ from the corresponding origin blocks.
200 underlying storage). Reads and writes always go to 211
201 the origin. If a write goes to a cached origin 212 passthrough a degraded mode useful for various cache coherency
202 block, then the cache block is invalidated. 213 situations (e.g., rolling back snapshots of
203 To enable passthrough mode the cache must be clean. 214 underlying storage). Reads and writes always go to
204 215 the origin. If a write goes to a cached origin
205 metadata2 : use version 2 of the metadata. This stores the dirty bits 216 block, then the cache block is invalidated.
206 in a separate btree, which improves speed of shutting 217 To enable passthrough mode the cache must be clean.
207 down the cache. 218
208 219 metadata2 use version 2 of the metadata. This stores the dirty
209 no_discard_passdown : disable passing down discards from the cache 220 bits in a separate btree, which improves speed of
210 to the origin's data device. 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 ==================== ========================================================
211 226
212A policy called 'default' is always registered. This is an alias for 227A policy called 'default' is always registered. This is an alias for
213the policy we currently think is giving best all round performance. 228the 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.
218Status 233Status
219------ 234------
220 235
221<metadata block size> <#used metadata blocks>/<#total metadata blocks> 236::
222<cache block size> <#used cache blocks>/<#total cache blocks> 237
223<#read hits> <#read misses> <#write hits> <#write misses> 238 <metadata block size> <#used metadata blocks>/<#total metadata blocks>
224<#demotions> <#promotions> <#dirty> <#features> <features>* 239 <cache block size> <#used cache blocks>/<#total cache blocks>
225<#core args> <core args>* <policy name> <#policy args> <policy args>* 240 <#read hits> <#read misses> <#write hits> <#write misses>
226<cache metadata mode> 241 <#demotions> <#promotions> <#dirty> <#features> <features>*
227 242 <#core args> <core args>* <policy name> <#policy args> <policy args>*
228metadata block size : Fixed block size for each metadata block in 243 <cache metadata mode>
229 sectors 244
230#used metadata blocks : Number of metadata blocks used 245
231#total metadata blocks : Total number of metadata blocks 246========================= =====================================================
232cache block size : Configurable block size for the cache device 247metadata block size Fixed block size for each metadata block in
233 in sectors 248 sectors
234#used cache blocks : Number of blocks resident in the cache 249#used metadata blocks Number of metadata blocks used
235#total cache blocks : Total number of cache blocks 250#total metadata blocks Total number of metadata blocks
236#read hits : Number of times a READ bio has been mapped 251cache block size Configurable block size for the cache device
237 to the cache 252 in sectors
238#read misses : Number of times a READ bio has been mapped 253#used cache blocks Number of blocks resident in the cache
239 to the origin 254#total cache blocks Total number of cache blocks
240#write hits : Number of times a WRITE bio has been mapped 255#read hits Number of times a READ bio has been mapped
241 to the cache 256 to the cache
242#write misses : Number of times a WRITE bio has been 257#read misses Number of times a READ bio has been mapped
243 mapped to the origin 258 to the origin
244#demotions : Number of times a block has been removed 259#write hits Number of times a WRITE bio has been mapped
245 from the cache 260 to the cache
246#promotions : Number of times a block has been moved to 261#write misses Number of times a WRITE bio has been
247 the cache 262 mapped to the origin
248#dirty : Number of blocks in the cache that differ 263#demotions Number of times a block has been removed
249 from the origin 264 from the cache
250#feature args : Number of feature args to follow 265#promotions Number of times a block has been moved to
251feature args : 'writethrough' (optional) 266 the cache
252#core args : Number of core arguments (must be even) 267#dirty Number of blocks in the cache that differ
253core args : Key/value pairs for tuning the core 268 from the origin
254 e.g. migration_threshold 269#feature args Number of feature args to follow
255policy name : Name of the policy 270feature args 'writethrough' (optional)
256#policy args : Number of policy arguments to follow (must be even) 271#core args Number of core arguments (must be even)
257policy args : Key/value pairs e.g. sequential_threshold 272core args Key/value pairs for tuning the core
258cache metadata mode : ro if read-only, rw if read-write 273 e.g. migration_threshold
259 In serious cases where even a read-only mode is deemed unsafe 274policy name Name of the policy
260 no further I/O will be permitted and the status will just 275#policy args Number of policy arguments to follow (must be even)
261 contain the string 'Fail'. The userspace recovery tools 276policy args Key/value pairs e.g. sequential_threshold
262 should then be used. 277cache metadata mode ro if read-only, rw if read-write
263needs_check : 'needs_check' if set, '-' if not set 278
264 A metadata operation has failed, resulting in the needs_check 279 In serious cases where even a read-only mode is
265 flag being set in the metadata's superblock. The metadata 280 deemed unsafe no further I/O will be permitted and
266 device must be deactivated and checked/repaired before the 281 the status will just contain the string 'Fail'.
267 cache can be made fully operational again. '-' indicates 282 The userspace recovery tools should then be used.
268 needs_check is not set. 283needs_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========================= =====================================================
269 291
270Messages 292Messages
271-------- 293--------
@@ -274,11 +296,12 @@ Policies will have different tunables, specific to each one, so we
274need a generic way of getting and setting these. Device-mapper 296need a generic way of getting and setting these. Device-mapper
275messages are used. (A sysfs interface would also be possible.) 297messages are used. (A sysfs interface would also be possible.)
276 298
277The message format is: 299The message format is::
278 300
279 <key> <value> 301 <key> <value>
280 302
281E.g. 303E.g.::
304
282 dmsetup message my_cache 0 sequential_threshold 1024 305 dmsetup message my_cache 0 sequential_threshold 1024
283 306
284 307
@@ -290,11 +313,12 @@ of values from 5 to 9. Each cblock must be expressed as a decimal
290value, in the future a variant message that takes cblock ranges 313value, in the future a variant message that takes cblock ranges
291expressed in hexadecimal may be needed to better support efficient 314expressed in hexadecimal may be needed to better support efficient
292invalidation of larger caches. The cache must be in passthrough mode 315invalidation of larger caches. The cache must be in passthrough mode
293when invalidate_cblocks is used. 316when invalidate_cblocks is used::
294 317
295 invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]* 318 invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]*
296 319
297E.g. 320E.g.::
321
298 dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789 322 dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789
299 323
300Examples 324Examples
@@ -304,8 +328,10 @@ The test suite can be found here:
304 328
305https://github.com/jthornber/device-mapper-test-suite 329https://github.com/jthornber/device-mapper-test-suite
306 330
307dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \ 331::
308 /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0' 332
309dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \ 333 dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
310 /dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \ 334 /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0'
311 mq 4 sequential_threshold 1024 random_threshold 8' 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'
diff --git a/Documentation/device-mapper/delay.txt b/Documentation/device-mapper/delay.rst
index 6426c45273cb..917ba8c33359 100644
--- a/Documentation/device-mapper/delay.txt
+++ b/Documentation/device-mapper/delay.rst
@@ -1,10 +1,12 @@
1========
1dm-delay 2dm-delay
2======== 3========
3 4
4Device-Mapper's "delay" target delays reads and/or writes 5Device-Mapper's "delay" target delays reads and/or writes
5and maps them to different devices. 6and maps them to different devices.
6 7
7Parameters: 8Parameters::
9
8 <device> <offset> <delay> [<write_device> <write_offset> <write_delay> 10 <device> <offset> <delay> [<write_device> <write_offset> <write_delay>
9 [<flush_device> <flush_offset> <flush_delay>]] 11 [<flush_device> <flush_offset> <flush_delay>]]
10 12
@@ -14,15 +16,16 @@ Delays are specified in milliseconds.
14 16
15Example scripts 17Example scripts
16=============== 18===============
17[[ 19
18#!/bin/sh 20::
19# Create device delaying rw operation for 500ms 21
20echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed 22 #!/bin/sh
21]] 23 # Create device delaying rw operation for 500ms
22 24 echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed
23[[ 25
24#!/bin/sh 26::
25# Create device delaying only write operation for 500ms and 27
26# splitting reads and writes to different devices $1 $2 28 #!/bin/sh
27echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed 29 # Create device delaying only write operation for 500ms and
28]] 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
diff --git a/Documentation/device-mapper/dm-crypt.txt b/Documentation/device-mapper/dm-crypt.rst
index 3b3e1de21c9c..8f4a3f889d43 100644
--- a/Documentation/device-mapper/dm-crypt.txt
+++ b/Documentation/device-mapper/dm-crypt.rst
@@ -1,5 +1,6 @@
1========
1dm-crypt 2dm-crypt
2========= 3========
3 4
4Device-Mapper's "crypt" target provides transparent encryption of block devices 5Device-Mapper's "crypt" target provides transparent encryption of block devices
5using the kernel crypto API. 6using the kernel crypto API.
@@ -7,15 +8,20 @@ using the kernel crypto API.
7For a more detailed description of supported parameters see: 8For a more detailed description of supported parameters see:
8https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt 9https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
9 10
10Parameters: <cipher> <key> <iv_offset> <device path> \ 11Parameters::
12
13 <cipher> <key> <iv_offset> <device path> \
11 <offset> [<#opt_params> <opt_params>] 14 <offset> [<#opt_params> <opt_params>]
12 15
13<cipher> 16<cipher>
14 Encryption cipher, encryption mode and Initial Vector (IV) generator. 17 Encryption cipher, encryption mode and Initial Vector (IV) generator.
15 18
16 The cipher specifications format is: 19 The cipher specifications format is::
20
17 cipher[:keycount]-chainmode-ivmode[:ivopts] 21 cipher[:keycount]-chainmode-ivmode[:ivopts]
18 Examples: 22
23 Examples::
24
19 aes-cbc-essiv:sha256 25 aes-cbc-essiv:sha256
20 aes-xts-plain64 26 aes-xts-plain64
21 serpent-xts-plain64 27 serpent-xts-plain64
@@ -25,12 +31,17 @@ Parameters: <cipher> <key> <iv_offset> <device path> \
25 as for the first format type. 31 as for the first format type.
26 This format is mainly used for specification of authenticated modes. 32 This format is mainly used for specification of authenticated modes.
27 33
28 The crypto API cipher specifications format is: 34 The crypto API cipher specifications format is::
35
29 capi:cipher_api_spec-ivmode[:ivopts] 36 capi:cipher_api_spec-ivmode[:ivopts]
30 Examples: 37
38 Examples::
39
31 capi:cbc(aes)-essiv:sha256 40 capi:cbc(aes)-essiv:sha256
32 capi:xts(aes)-plain64 41 capi:xts(aes)-plain64
33 Examples of authenticated modes: 42
43 Examples of authenticated modes::
44
34 capi:gcm(aes)-random 45 capi:gcm(aes)-random
35 capi:authenc(hmac(sha256),xts(aes))-random 46 capi:authenc(hmac(sha256),xts(aes))-random
36 capi:rfc7539(chacha20,poly1305)-random 47 capi:rfc7539(chacha20,poly1305)-random
@@ -142,21 +153,21 @@ LUKS (Linux Unified Key Setup) is now the preferred way to set up disk
142encryption with dm-crypt using the 'cryptsetup' utility, see 153encryption with dm-crypt using the 'cryptsetup' utility, see
143https://gitlab.com/cryptsetup/cryptsetup 154https://gitlab.com/cryptsetup/cryptsetup
144 155
145[[ 156::
146#!/bin/sh 157
147# Create a crypt device using dmsetup 158 #!/bin/sh
148dmsetup create crypt1 --table "0 `blockdev --getsz $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0" 159 # Create a crypt device using dmsetup
149]] 160 dmsetup create crypt1 --table "0 `blockdev --getsz $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0"
150 161
151[[ 162::
152#!/bin/sh 163
153# Create a crypt device using dmsetup when encryption key is stored in keyring service 164 #!/bin/sh
154dmsetup create crypt2 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 :32:logon:my_prefix:my_key 0 $1 0" 165 # Create a crypt device using dmsetup when encryption key is stored in keyring service
155]] 166 dmsetup create crypt2 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 :32:logon:my_prefix:my_key 0 $1 0"
156 167
157[[ 168::
158#!/bin/sh 169
159# Create a crypt device using cryptsetup and LUKS header with default cipher 170 #!/bin/sh
160cryptsetup luksFormat $1 171 # Create a crypt device using cryptsetup and LUKS header with default cipher
161cryptsetup luksOpen $1 crypt1 172 cryptsetup luksFormat $1
162]] 173 cryptsetup luksOpen $1 crypt1
diff --git a/Documentation/device-mapper/dm-flakey.txt b/Documentation/device-mapper/dm-flakey.rst
index 9f0e247d0877..86138735879d 100644
--- a/Documentation/device-mapper/dm-flakey.txt
+++ b/Documentation/device-mapper/dm-flakey.rst
@@ -1,3 +1,4 @@
1=========
1dm-flakey 2dm-flakey
2========= 3=========
3 4
@@ -15,17 +16,26 @@ underlying devices.
15 16
16Table parameters 17Table parameters
17---------------- 18----------------
19
20::
21
18 <dev path> <offset> <up interval> <down interval> \ 22 <dev path> <offset> <up interval> <down interval> \
19 [<num_features> [<feature arguments>]] 23 [<num_features> [<feature arguments>]]
20 24
21Mandatory parameters: 25Mandatory parameters:
22 <dev path>: Full pathname to the underlying block-device, or a 26
23 "major:minor" device-number. 27 <dev path>:
24 <offset>: Starting sector within the device. 28 Full pathname to the underlying block-device, or a
25 <up interval>: Number of seconds device is available. 29 "major:minor" device-number.
26 <down interval>: Number of seconds device returns errors. 30 <offset>:
31 Starting sector within the device.
32 <up interval>:
33 Number of seconds device is available.
34 <down interval>:
35 Number of seconds device returns errors.
27 36
28Optional feature parameters: 37Optional feature parameters:
38
29 If no feature parameters are present, during the periods of 39 If no feature parameters are present, during the periods of
30 unreliability, all I/O returns errors. 40 unreliability, all I/O returns errors.
31 41
@@ -41,17 +51,24 @@ Optional feature parameters:
41 During <down interval>, replace <Nth_byte> of the data of 51 During <down interval>, replace <Nth_byte> of the data of
42 each matching bio with <value>. 52 each matching bio with <value>.
43 53
44 <Nth_byte>: The offset of the byte to replace. 54 <Nth_byte>:
45 Counting starts at 1, to replace the first byte. 55 The offset of the byte to replace.
46 <direction>: Either 'r' to corrupt reads or 'w' to corrupt writes. 56 Counting starts at 1, to replace the first byte.
47 'w' is incompatible with drop_writes. 57 <direction>:
48 <value>: The value (from 0-255) to write. 58 Either 'r' to corrupt reads or 'w' to corrupt writes.
49 <flags>: Perform the replacement only if bio->bi_opf has all the 59 'w' is incompatible with drop_writes.
50 selected flags set. 60 <value>:
61 The value (from 0-255) to write.
62 <flags>:
63 Perform the replacement only if bio->bi_opf has all the
64 selected flags set.
51 65
52Examples: 66Examples:
67
68Replaces the 32nd byte of READ bios with the value 1::
69
53 corrupt_bio_byte 32 r 1 0 70 corrupt_bio_byte 32 r 1 0
54 - replaces the 32nd byte of READ bios with the value 1 71
72Replaces the 224th byte of REQ_META (=32) bios with the value 0::
55 73
56 corrupt_bio_byte 224 w 0 32 74 corrupt_bio_byte 224 w 0 32
57 - replaces the 224th byte of REQ_META (=32) bios with the value 0
diff --git a/Documentation/device-mapper/dm-init.txt b/Documentation/device-mapper/dm-init.rst
index 130b3c3679c5..e5242ff17e9b 100644
--- a/Documentation/device-mapper/dm-init.txt
+++ b/Documentation/device-mapper/dm-init.rst
@@ -1,5 +1,6 @@
1================================
1Early creation of mapped devices 2Early creation of mapped devices
2==================================== 3================================
3 4
4It is possible to configure a device-mapper device to act as the root device for 5It is possible to configure a device-mapper device to act as the root device for
5your system in two ways. 6your system in two ways.
@@ -12,15 +13,17 @@ The second is to create one or more device-mappers using the module parameter
12 13
13The format is specified as a string of data separated by commas and optionally 14The format is specified as a string of data separated by commas and optionally
14semi-colons, where: 15semi-colons, where:
16
15 - a comma is used to separate fields like name, uuid, flags and table 17 - a comma is used to separate fields like name, uuid, flags and table
16 (specifies one device) 18 (specifies one device)
17 - a semi-colon is used to separate devices. 19 - a semi-colon is used to separate devices.
18 20
19So the format will look like this: 21So the format will look like this::
20 22
21 dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+] 23 dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
22 24
23Where, 25Where::
26
24 <name> ::= The device name. 27 <name> ::= The device name.
25 <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | "" 28 <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
26 <minor> ::= The device minor number | "" 29 <minor> ::= The device minor number | ""
@@ -29,7 +32,7 @@ Where,
29 <target_type> ::= "verity" | "linear" | ... (see list below) 32 <target_type> ::= "verity" | "linear" | ... (see list below)
30 33
31The dm line should be equivalent to the one used by the dmsetup tool with the 34The dm line should be equivalent to the one used by the dmsetup tool with the
32--concise argument. 35`--concise` argument.
33 36
34Target types 37Target types
35============ 38============
@@ -38,32 +41,34 @@ Not all target types are available as there are serious risks in allowing
38activation of certain DM targets without first using userspace tools to check 41activation of certain DM targets without first using userspace tools to check
39the validity of associated metadata. 42the validity of associated metadata.
40 43
41 "cache": constrained, userspace should verify cache device 44======================= =======================================================
42 "crypt": allowed 45`cache` constrained, userspace should verify cache device
43 "delay": allowed 46`crypt` allowed
44 "era": constrained, userspace should verify metadata device 47`delay` allowed
45 "flakey": constrained, meant for test 48`era` constrained, userspace should verify metadata device
46 "linear": allowed 49`flakey` constrained, meant for test
47 "log-writes": constrained, userspace should verify metadata device 50`linear` allowed
48 "mirror": constrained, userspace should verify main/mirror device 51`log-writes` constrained, userspace should verify metadata device
49 "raid": constrained, userspace should verify metadata device 52`mirror` constrained, userspace should verify main/mirror device
50 "snapshot": constrained, userspace should verify src/dst device 53`raid` constrained, userspace should verify metadata device
51 "snapshot-origin": allowed 54`snapshot` constrained, userspace should verify src/dst device
52 "snapshot-merge": constrained, userspace should verify src/dst device 55`snapshot-origin` allowed
53 "striped": allowed 56`snapshot-merge` constrained, userspace should verify src/dst device
54 "switch": constrained, userspace should verify dev path 57`striped` allowed
55 "thin": constrained, requires dm target message from userspace 58`switch` constrained, userspace should verify dev path
56 "thin-pool": constrained, requires dm target message from userspace 59`thin` constrained, requires dm target message from userspace
57 "verity": allowed 60`thin-pool` constrained, requires dm target message from userspace
58 "writecache": constrained, userspace should verify cache device 61`verity` allowed
59 "zero": constrained, not meant for rootfs 62`writecache` constrained, userspace should verify cache device
63`zero` constrained, not meant for rootfs
64======================= =======================================================
60 65
61If the target is not listed above, it is constrained by default (not tested). 66If the target is not listed above, it is constrained by default (not tested).
62 67
63Examples 68Examples
64======== 69========
65An example of booting to a linear array made up of user-mode linux block 70An example of booting to a linear array made up of user-mode linux block
66devices: 71devices::
67 72
68 dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0 73 dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
69 74
@@ -71,8 +76,8 @@ This will boot to a rw dm-linear target of 8192 sectors split across two block
71devices identified by their major:minor numbers. After boot, udev will rename 76devices identified by their major:minor numbers. After boot, udev will rename
72this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned. 77this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned.
73 78
74An example of multiple device-mappers, with the dm-mod.create="..." contents is shown here 79An example of multiple device-mappers, with the dm-mod.create="..." contents
75split on multiple lines for readability: 80is shown here split on multiple lines for readability::
76 81
77 dm-linear,,1,rw, 82 dm-linear,,1,rw,
78 0 32768 linear 8:1 0, 83 0 32768 linear 8:1 0,
@@ -84,30 +89,36 @@ split on multiple lines for readability:
84 89
85Other examples (per target): 90Other examples (per target):
86 91
87"crypt": 92"crypt"::
93
88 dm-crypt,,8,ro, 94 dm-crypt,,8,ro,
89 0 1048576 crypt aes-xts-plain64 95 0 1048576 crypt aes-xts-plain64
90 babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0 96 babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
91 /dev/sda 0 1 allow_discards 97 /dev/sda 0 1 allow_discards
92 98
93"delay": 99"delay"::
100
94 dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500 101 dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
95 102
96"linear": 103"linear"::
104
97 dm-linear,,,rw, 105 dm-linear,,,rw,
98 0 32768 linear /dev/sda1 0, 106 0 32768 linear /dev/sda1 0,
99 32768 1024000 linear /dev/sda2 0, 107 32768 1024000 linear /dev/sda2 0,
100 1056768 204800 linear /dev/sda3 0, 108 1056768 204800 linear /dev/sda3 0,
101 1261568 512000 linear /dev/sda4 0 109 1261568 512000 linear /dev/sda4 0
102 110
103"snapshot-origin": 111"snapshot-origin"::
112
104 dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2 113 dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
105 114
106"striped": 115"striped"::
116
107 dm-striped,,4,ro,0 1638400 striped 4 4096 117 dm-striped,,4,ro,0 1638400 striped 4 4096
108 /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0 118 /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
109 119
110"verity": 120"verity"::
121
111 dm-verity,,4,ro, 122 dm-verity,,4,ro,
112 0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256 123 0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
113 fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd 124 fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
diff --git a/Documentation/device-mapper/dm-integrity.txt b/Documentation/device-mapper/dm-integrity.rst
index d63d78ffeb73..a30aa91b5fbe 100644
--- a/Documentation/device-mapper/dm-integrity.txt
+++ b/Documentation/device-mapper/dm-integrity.rst
@@ -1,3 +1,7 @@
1============
2dm-integrity
3============
4
1The dm-integrity target emulates a block device that has additional 5The dm-integrity target emulates a block device that has additional
2per-sector tags that can be used for storing integrity information. 6per-sector tags that can be used for storing integrity information.
3 7
@@ -35,15 +39,16 @@ zeroes. If the superblock is neither valid nor zeroed, the dm-integrity
35target can't be loaded. 39target can't be loaded.
36 40
37To use the target for the first time: 41To use the target for the first time:
42
381. overwrite the superblock with zeroes 431. overwrite the superblock with zeroes
392. load the dm-integrity target with one-sector size, the kernel driver 442. load the dm-integrity target with one-sector size, the kernel driver
40 will format the device 45 will format the device
413. unload the dm-integrity target 463. unload the dm-integrity target
424. read the "provided_data_sectors" value from the superblock 474. read the "provided_data_sectors" value from the superblock
435. load the dm-integrity target with the the target size 485. load the dm-integrity target with the the target size
44 "provided_data_sectors" 49 "provided_data_sectors"
456. if you want to use dm-integrity with dm-crypt, load the dm-crypt target 506. if you want to use dm-integrity with dm-crypt, load the dm-crypt target
46 with the size "provided_data_sectors" 51 with the size "provided_data_sectors"
47 52
48 53
49Target arguments: 54Target arguments:
@@ -51,17 +56,20 @@ Target arguments:
511. the underlying block device 561. the underlying block device
52 57
532. the number of reserved sector at the beginning of the device - the 582. the number of reserved sector at the beginning of the device - the
54 dm-integrity won't read of write these sectors 59 dm-integrity won't read of write these sectors
55 60
563. the size of the integrity tag (if "-" is used, the size is taken from 613. the size of the integrity tag (if "-" is used, the size is taken from
57 the internal-hash algorithm) 62 the internal-hash algorithm)
58 63
594. mode: 644. mode:
60 D - direct writes (without journal) - in this mode, journaling is 65
66 D - direct writes (without journal)
67 in this mode, journaling is
61 not used and data sectors and integrity tags are written 68 not used and data sectors and integrity tags are written
62 separately. In case of crash, it is possible that the data 69 separately. In case of crash, it is possible that the data
63 and integrity tag doesn't match. 70 and integrity tag doesn't match.
64 J - journaled writes - data and integrity tags are written to the 71 J - journaled writes
72 data and integrity tags are written to the
65 journal and atomicity is guaranteed. In case of crash, 73 journal and atomicity is guaranteed. In case of crash,
66 either both data and tag or none of them are written. The 74 either both data and tag or none of them are written. The
67 journaled mode degrades write throughput twice because the 75 journaled mode degrades write throughput twice because the
@@ -178,9 +186,12 @@ and the reloaded target would be non-functional.
178 186
179 187
180The layout of the formatted block device: 188The layout of the formatted block device:
181* reserved sectors (they are not used by this target, they can be used for 189
182 storing LUKS metadata or for other purpose), the size of the reserved 190* reserved sectors
183 area is specified in the target arguments 191 (they are not used by this target, they can be used for
192 storing LUKS metadata or for other purpose), the size of the reserved
193 area is specified in the target arguments
194
184* superblock (4kiB) 195* superblock (4kiB)
185 * magic string - identifies that the device was formatted 196 * magic string - identifies that the device was formatted
186 * version 197 * version
@@ -192,40 +203,55 @@ The layout of the formatted block device:
192 metadata and padding). The user of this target should not send 203 metadata and padding). The user of this target should not send
193 bios that access data beyond the "provided data sectors" limit. 204 bios that access data beyond the "provided data sectors" limit.
194 * flags 205 * flags
195 SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used 206 SB_FLAG_HAVE_JOURNAL_MAC
196 SB_FLAG_RECALCULATING - recalculating is in progress 207 - a flag is set if journal_mac is used
197 SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty 208 SB_FLAG_RECALCULATING
198 blocks 209 - recalculating is in progress
210 SB_FLAG_DIRTY_BITMAP
211 - journal area contains the bitmap of dirty
212 blocks
199 * log2(sectors per block) 213 * log2(sectors per block)
200 * a position where recalculating finished 214 * a position where recalculating finished
201* journal 215* journal
202 The journal is divided into sections, each section contains: 216 The journal is divided into sections, each section contains:
217
203 * metadata area (4kiB), it contains journal entries 218 * metadata area (4kiB), it contains journal entries
204 every journal entry contains: 219
220 - every journal entry contains:
221
205 * logical sector (specifies where the data and tag should 222 * logical sector (specifies where the data and tag should
206 be written) 223 be written)
207 * last 8 bytes of data 224 * last 8 bytes of data
208 * integrity tag (the size is specified in the superblock) 225 * integrity tag (the size is specified in the superblock)
209 every metadata sector ends with 226
227 - every metadata sector ends with
228
210 * mac (8-bytes), all the macs in 8 metadata sectors form a 229 * mac (8-bytes), all the macs in 8 metadata sectors form a
211 64-byte value. It is used to store hmac of sector 230 64-byte value. It is used to store hmac of sector
212 numbers in the journal section, to protect against a 231 numbers in the journal section, to protect against a
213 possibility that the attacker tampers with sector 232 possibility that the attacker tampers with sector
214 numbers in the journal. 233 numbers in the journal.
215 * commit id 234 * commit id
235
216 * data area (the size is variable; it depends on how many journal 236 * data area (the size is variable; it depends on how many journal
217 entries fit into the metadata area) 237 entries fit into the metadata area)
218 every sector in the data area contains: 238
239 - every sector in the data area contains:
240
219 * data (504 bytes of data, the last 8 bytes are stored in 241 * data (504 bytes of data, the last 8 bytes are stored in
220 the journal entry) 242 the journal entry)
221 * commit id 243 * commit id
244
222 To test if the whole journal section was written correctly, every 245 To test if the whole journal section was written correctly, every
223 512-byte sector of the journal ends with 8-byte commit id. If the 246 512-byte sector of the journal ends with 8-byte commit id. If the
224 commit id matches on all sectors in a journal section, then it is 247 commit id matches on all sectors in a journal section, then it is
225 assumed that the section was written correctly. If the commit id 248 assumed that the section was written correctly. If the commit id
226 doesn't match, the section was written partially and it should not 249 doesn't match, the section was written partially and it should not
227 be replayed. 250 be replayed.
228* one or more runs of interleaved tags and data. Each run contains: 251
252* one or more runs of interleaved tags and data.
253 Each run contains:
254
229 * tag area - it contains integrity tags. There is one tag for each 255 * tag area - it contains integrity tags. There is one tag for each
230 sector in the data area 256 sector in the data area
231 * data area - it contains data sectors. The number of data sectors 257 * data area - it contains data sectors. The number of data sectors
diff --git a/Documentation/device-mapper/dm-io.txt b/Documentation/device-mapper/dm-io.rst
index 3b5d9a52cdcf..d2492917a1f5 100644
--- a/Documentation/device-mapper/dm-io.txt
+++ b/Documentation/device-mapper/dm-io.rst
@@ -1,3 +1,4 @@
1=====
1dm-io 2dm-io
2===== 3=====
3 4
@@ -7,7 +8,7 @@ version.
7 8
8The user must set up an io_region structure to describe the desired location 9The user must set up an io_region structure to describe the desired location
9of the I/O. Each io_region indicates a block-device along with the starting 10of the I/O. Each io_region indicates a block-device along with the starting
10sector and size of the region. 11sector and size of the region::
11 12
12 struct io_region { 13 struct io_region {
13 struct block_device *bdev; 14 struct block_device *bdev;
@@ -19,7 +20,7 @@ Dm-io can read from one io_region or write to one or more io_regions. Writes
19to multiple regions are specified by an array of io_region structures. 20to multiple regions are specified by an array of io_region structures.
20 21
21The first I/O service type takes a list of memory pages as the data buffer for 22The first I/O service type takes a list of memory pages as the data buffer for
22the I/O, along with an offset into the first page. 23the I/O, along with an offset into the first page::
23 24
24 struct page_list { 25 struct page_list {
25 struct page_list *next; 26 struct page_list *next;
@@ -35,7 +36,7 @@ the I/O, along with an offset into the first page.
35 36
36The second I/O service type takes an array of bio vectors as the data buffer 37The second I/O service type takes an array of bio vectors as the data buffer
37for the I/O. This service can be handy if the caller has a pre-assembled bio, 38for the I/O. This service can be handy if the caller has a pre-assembled bio,
38but wants to direct different portions of the bio to different devices. 39but wants to direct different portions of the bio to different devices::
39 40
40 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, 41 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where,
41 int rw, struct bio_vec *bvec, 42 int rw, struct bio_vec *bvec,
@@ -47,7 +48,7 @@ but wants to direct different portions of the bio to different devices.
47The third I/O service type takes a pointer to a vmalloc'd memory buffer as the 48The third I/O service type takes a pointer to a vmalloc'd memory buffer as the
48data buffer for the I/O. This service can be handy if the caller needs to do 49data buffer for the I/O. This service can be handy if the caller needs to do
49I/O to a large region but doesn't want to allocate a large number of individual 50I/O to a large region but doesn't want to allocate a large number of individual
50memory pages. 51memory pages::
51 52
52 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw, 53 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw,
53 void *data, unsigned long *error_bits); 54 void *data, unsigned long *error_bits);
@@ -55,11 +56,11 @@ memory pages.
55 void *data, io_notify_fn fn, void *context); 56 void *data, io_notify_fn fn, void *context);
56 57
57Callers of the asynchronous I/O services must include the name of a completion 58Callers of the asynchronous I/O services must include the name of a completion
58callback routine and a pointer to some context data for the I/O. 59callback routine and a pointer to some context data for the I/O::
59 60
60 typedef void (*io_notify_fn)(unsigned long error, void *context); 61 typedef void (*io_notify_fn)(unsigned long error, void *context);
61 62
62The "error" parameter in this callback, as well as the "*error" parameter in 63The "error" parameter in this callback, as well as the `*error` parameter in
63all of the synchronous versions, is a bitset (instead of a simple error value). 64all of the synchronous versions, is a bitset (instead of a simple error value).
64In the case of an write-I/O to multiple regions, this bitset allows dm-io to 65In the case of an write-I/O to multiple regions, this bitset allows dm-io to
65indicate success or failure on each individual region. 66indicate success or failure on each individual region.
@@ -72,4 +73,3 @@ always available in order to avoid unnecessary waiting while performing I/O.
72When the user is finished using the dm-io services, they should call 73When the user is finished using the dm-io services, they should call
73dm_io_put() and specify the same number of pages that were given on the 74dm_io_put() and specify the same number of pages that were given on the
74dm_io_get() call. 75dm_io_get() call.
75
diff --git a/Documentation/device-mapper/dm-log.txt b/Documentation/device-mapper/dm-log.rst
index c155ac569c44..ba4fce39bc27 100644
--- a/Documentation/device-mapper/dm-log.txt
+++ b/Documentation/device-mapper/dm-log.rst
@@ -1,3 +1,4 @@
1=====================
1Device-Mapper Logging 2Device-Mapper Logging
2===================== 3=====================
3The device-mapper logging code is used by some of the device-mapper 4The device-mapper logging code is used by some of the device-mapper
@@ -16,11 +17,13 @@ dm_dirty_log_type in include/linux/dm-dirty-log.h). Various different
16logging implementations are available and provide different 17logging implementations are available and provide different
17capabilities. The list includes: 18capabilities. The list includes:
18 19
20============== ==============================================================
19Type Files 21Type Files
20==== ===== 22============== ==============================================================
21disk drivers/md/dm-log.c 23disk drivers/md/dm-log.c
22core drivers/md/dm-log.c 24core drivers/md/dm-log.c
23userspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h 25userspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h
26============== ==============================================================
24 27
25The "disk" log type 28The "disk" log type
26------------------- 29-------------------
diff --git a/Documentation/device-mapper/dm-queue-length.txt b/Documentation/device-mapper/dm-queue-length.rst
index f4db2562175c..d8e381c1cb02 100644
--- a/Documentation/device-mapper/dm-queue-length.txt
+++ b/Documentation/device-mapper/dm-queue-length.rst
@@ -1,3 +1,4 @@
1===============
1dm-queue-length 2dm-queue-length
2=============== 3===============
3 4
@@ -6,12 +7,18 @@ which selects a path with the least number of in-flight I/Os.
6The path selector name is 'queue-length'. 7The path selector name is 'queue-length'.
7 8
8Table parameters for each path: [<repeat_count>] 9Table parameters for each path: [<repeat_count>]
10
11::
12
9 <repeat_count>: The number of I/Os to dispatch using the selected 13 <repeat_count>: The number of I/Os to dispatch using the selected
10 path before switching to the next path. 14 path before switching to the next path.
11 If not given, internal default is used. To check 15 If not given, internal default is used. To check
12 the default value, see the activated table. 16 the default value, see the activated table.
13 17
14Status for each path: <status> <fail-count> <in-flight> 18Status for each path: <status> <fail-count> <in-flight>
19
20::
21
15 <status>: 'A' if the path is active, 'F' if the path is failed. 22 <status>: 'A' if the path is active, 'F' if the path is failed.
16 <fail-count>: The number of path failures. 23 <fail-count>: The number of path failures.
17 <in-flight>: The number of in-flight I/Os on the path. 24 <in-flight>: The number of in-flight I/Os on the path.
@@ -29,11 +36,13 @@ Examples
29======== 36========
30In case that 2 paths (sda and sdb) are used with repeat_count == 128. 37In case that 2 paths (sda and sdb) are used with repeat_count == 128.
31 38
32# echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \ 39::
33 dmsetup create test 40
34# 41 # echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \
35# dmsetup table 42 dmsetup create test
36test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128 43 #
37# 44 # dmsetup table
38# dmsetup status 45 test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128
39test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0 46 #
47 # dmsetup status
48 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0
diff --git a/Documentation/device-mapper/dm-raid.txt b/Documentation/device-mapper/dm-raid.rst
index 2355bef14653..2fe255b130fb 100644
--- a/Documentation/device-mapper/dm-raid.txt
+++ b/Documentation/device-mapper/dm-raid.rst
@@ -1,3 +1,4 @@
1=======
1dm-raid 2dm-raid
2======= 3=======
3 4
@@ -8,49 +9,66 @@ interface.
8 9
9Mapping Table Interface 10Mapping Table Interface
10----------------------- 11-----------------------
11The target is named "raid" and it accepts the following parameters: 12The target is named "raid" and it accepts the following parameters::
12 13
13 <raid_type> <#raid_params> <raid_params> \ 14 <raid_type> <#raid_params> <raid_params> \
14 <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>] 15 <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>]
15 16
16<raid_type>: 17<raid_type>:
18
19 ============= ===============================================================
17 raid0 RAID0 striping (no resilience) 20 raid0 RAID0 striping (no resilience)
18 raid1 RAID1 mirroring 21 raid1 RAID1 mirroring
19 raid4 RAID4 with dedicated last parity disk 22 raid4 RAID4 with dedicated last parity disk
20 raid5_n RAID5 with dedicated last parity disk supporting takeover 23 raid5_n RAID5 with dedicated last parity disk supporting takeover
21 Same as raid4 24 Same as raid4
22 -Transitory layout 25
26 - Transitory layout
23 raid5_la RAID5 left asymmetric 27 raid5_la RAID5 left asymmetric
28
24 - rotating parity 0 with data continuation 29 - rotating parity 0 with data continuation
25 raid5_ra RAID5 right asymmetric 30 raid5_ra RAID5 right asymmetric
31
26 - rotating parity N with data continuation 32 - rotating parity N with data continuation
27 raid5_ls RAID5 left symmetric 33 raid5_ls RAID5 left symmetric
34
28 - rotating parity 0 with data restart 35 - rotating parity 0 with data restart
29 raid5_rs RAID5 right symmetric 36 raid5_rs RAID5 right symmetric
37
30 - rotating parity N with data restart 38 - rotating parity N with data restart
31 raid6_zr RAID6 zero restart 39 raid6_zr RAID6 zero restart
40
32 - rotating parity zero (left-to-right) with data restart 41 - rotating parity zero (left-to-right) with data restart
33 raid6_nr RAID6 N restart 42 raid6_nr RAID6 N restart
43
34 - rotating parity N (right-to-left) with data restart 44 - rotating parity N (right-to-left) with data restart
35 raid6_nc RAID6 N continue 45 raid6_nc RAID6 N continue
46
36 - rotating parity N (right-to-left) with data continuation 47 - rotating parity N (right-to-left) with data continuation
37 raid6_n_6 RAID6 with dedicate parity disks 48 raid6_n_6 RAID6 with dedicate parity disks
49
38 - parity and Q-syndrome on the last 2 disks; 50 - parity and Q-syndrome on the last 2 disks;
39 layout for takeover from/to raid4/raid5_n 51 layout for takeover from/to raid4/raid5_n
40 raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk 52 raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk
53
41 - layout for takeover from raid5_la from/to raid6 54 - layout for takeover from raid5_la from/to raid6
42 raid6_ra_6 Same as "raid5_ra" dedicated last Q-syndrome disk 55 raid6_ra_6 Same as "raid5_ra" dedicated last Q-syndrome disk
56
43 - layout for takeover from raid5_ra from/to raid6 57 - layout for takeover from raid5_ra from/to raid6
44 raid6_ls_6 Same as "raid5_ls" dedicated last Q-syndrome disk 58 raid6_ls_6 Same as "raid5_ls" dedicated last Q-syndrome disk
59
45 - layout for takeover from raid5_ls from/to raid6 60 - layout for takeover from raid5_ls from/to raid6
46 raid6_rs_6 Same as "raid5_rs" dedicated last Q-syndrome disk 61 raid6_rs_6 Same as "raid5_rs" dedicated last Q-syndrome disk
62
47 - layout for takeover from raid5_rs from/to raid6 63 - layout for takeover from raid5_rs from/to raid6
48 raid10 Various RAID10 inspired algorithms chosen by additional params 64 raid10 Various RAID10 inspired algorithms chosen by additional params
49 (see raid10_format and raid10_copies below) 65 (see raid10_format and raid10_copies below)
66
50 - RAID10: Striped Mirrors (aka 'Striping on top of mirrors') 67 - RAID10: Striped Mirrors (aka 'Striping on top of mirrors')
51 - RAID1E: Integrated Adjacent Stripe Mirroring 68 - RAID1E: Integrated Adjacent Stripe Mirroring
52 - RAID1E: Integrated Offset Stripe Mirroring 69 - RAID1E: Integrated Offset Stripe Mirroring
53 - and other similar RAID10 variants 70 - and other similar RAID10 variants
71 ============= ===============================================================
54 72
55 Reference: Chapter 4 of 73 Reference: Chapter 4 of
56 http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf 74 http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf
@@ -58,33 +76,41 @@ The target is named "raid" and it accepts the following parameters:
58<#raid_params>: The number of parameters that follow. 76<#raid_params>: The number of parameters that follow.
59 77
60<raid_params> consists of 78<raid_params> consists of
79
61 Mandatory parameters: 80 Mandatory parameters:
62 <chunk_size>: Chunk size in sectors. This parameter is often known as 81 <chunk_size>:
82 Chunk size in sectors. This parameter is often known as
63 "stripe size". It is the only mandatory parameter and 83 "stripe size". It is the only mandatory parameter and
64 is placed first. 84 is placed first.
65 85
66 followed by optional parameters (in any order): 86 followed by optional parameters (in any order):
67 [sync|nosync] Force or prevent RAID initialization. 87 [sync|nosync]
88 Force or prevent RAID initialization.
68 89
69 [rebuild <idx>] Rebuild drive number 'idx' (first drive is 0). 90 [rebuild <idx>]
91 Rebuild drive number 'idx' (first drive is 0).
70 92
71 [daemon_sleep <ms>] 93 [daemon_sleep <ms>]
72 Interval between runs of the bitmap daemon that 94 Interval between runs of the bitmap daemon that
73 clear bits. A longer interval means less bitmap I/O but 95 clear bits. A longer interval means less bitmap I/O but
74 resyncing after a failure is likely to take longer. 96 resyncing after a failure is likely to take longer.
75 97
76 [min_recovery_rate <kB/sec/disk>] Throttle RAID initialization 98 [min_recovery_rate <kB/sec/disk>]
77 [max_recovery_rate <kB/sec/disk>] Throttle RAID initialization 99 Throttle RAID initialization
78 [write_mostly <idx>] Mark drive index 'idx' write-mostly. 100 [max_recovery_rate <kB/sec/disk>]
79 [max_write_behind <sectors>] See '--write-behind=' (man mdadm) 101 Throttle RAID initialization
80 [stripe_cache <sectors>] Stripe cache size (RAID 4/5/6 only) 102 [write_mostly <idx>]
103 Mark drive index 'idx' write-mostly.
104 [max_write_behind <sectors>]
105 See '--write-behind=' (man mdadm)
106 [stripe_cache <sectors>]
107 Stripe cache size (RAID 4/5/6 only)
81 [region_size <sectors>] 108 [region_size <sectors>]
82 The region_size multiplied by the number of regions is the 109 The region_size multiplied by the number of regions is the
83 logical size of the array. The bitmap records the device 110 logical size of the array. The bitmap records the device
84 synchronisation state for each region. 111 synchronisation state for each region.
85 112
86 [raid10_copies <# copies>] 113 [raid10_copies <# copies>], [raid10_format <near|far|offset>]
87 [raid10_format <near|far|offset>]
88 These two options are used to alter the default layout of 114 These two options are used to alter the default layout of
89 a RAID10 configuration. The number of copies is can be 115 a RAID10 configuration. The number of copies is can be
90 specified, but the default is 2. There are also three 116 specified, but the default is 2. There are also three
@@ -93,13 +119,17 @@ The target is named "raid" and it accepts the following parameters:
93 respect to mirroring. If these options are left unspecified, 119 respect to mirroring. If these options are left unspecified,
94 or 'raid10_copies 2' and/or 'raid10_format near' are given, 120 or 'raid10_copies 2' and/or 'raid10_format near' are given,
95 then the layouts for 2, 3 and 4 devices are: 121 then the layouts for 2, 3 and 4 devices are:
122
123 ======== ========== ==============
96 2 drives 3 drives 4 drives 124 2 drives 3 drives 4 drives
97 -------- ---------- -------------- 125 ======== ========== ==============
98 A1 A1 A1 A1 A2 A1 A1 A2 A2 126 A1 A1 A1 A1 A2 A1 A1 A2 A2
99 A2 A2 A2 A3 A3 A3 A3 A4 A4 127 A2 A2 A2 A3 A3 A3 A3 A4 A4
100 A3 A3 A4 A4 A5 A5 A5 A6 A6 128 A3 A3 A4 A4 A5 A5 A5 A6 A6
101 A4 A4 A5 A6 A6 A7 A7 A8 A8 129 A4 A4 A5 A6 A6 A7 A7 A8 A8
102 .. .. .. .. .. .. .. .. .. 130 .. .. .. .. .. .. .. .. ..
131 ======== ========== ==============
132
103 The 2-device layout is equivalent 2-way RAID1. The 4-device 133 The 2-device layout is equivalent 2-way RAID1. The 4-device
104 layout is what a traditional RAID10 would look like. The 134 layout is what a traditional RAID10 would look like. The
105 3-device layout is what might be called a 'RAID1E - Integrated 135 3-device layout is what might be called a 'RAID1E - Integrated
@@ -107,8 +137,10 @@ The target is named "raid" and it accepts the following parameters:
107 137
108 If 'raid10_copies 2' and 'raid10_format far', then the layouts 138 If 'raid10_copies 2' and 'raid10_format far', then the layouts
109 for 2, 3 and 4 devices are: 139 for 2, 3 and 4 devices are:
140
141 ======== ============ ===================
110 2 drives 3 drives 4 drives 142 2 drives 3 drives 4 drives
111 -------- -------------- -------------------- 143 ======== ============ ===================
112 A1 A2 A1 A2 A3 A1 A2 A3 A4 144 A1 A2 A1 A2 A3 A1 A2 A3 A4
113 A3 A4 A4 A5 A6 A5 A6 A7 A8 145 A3 A4 A4 A5 A6 A5 A6 A7 A8
114 A5 A6 A7 A8 A9 A9 A10 A11 A12 146 A5 A6 A7 A8 A9 A9 A10 A11 A12
@@ -117,11 +149,14 @@ The target is named "raid" and it accepts the following parameters:
117 A4 A3 A6 A4 A5 A6 A5 A8 A7 149 A4 A3 A6 A4 A5 A6 A5 A8 A7
118 A6 A5 A9 A7 A8 A10 A9 A12 A11 150 A6 A5 A9 A7 A8 A10 A9 A12 A11
119 .. .. .. .. .. .. .. .. .. 151 .. .. .. .. .. .. .. .. ..
152 ======== ============ ===================
120 153
121 If 'raid10_copies 2' and 'raid10_format offset', then the 154 If 'raid10_copies 2' and 'raid10_format offset', then the
122 layouts for 2, 3 and 4 devices are: 155 layouts for 2, 3 and 4 devices are:
156
157 ======== ========== ================
123 2 drives 3 drives 4 drives 158 2 drives 3 drives 4 drives
124 -------- ------------ ----------------- 159 ======== ========== ================
125 A1 A2 A1 A2 A3 A1 A2 A3 A4 160 A1 A2 A1 A2 A3 A1 A2 A3 A4
126 A2 A1 A3 A1 A2 A2 A1 A4 A3 161 A2 A1 A3 A1 A2 A2 A1 A4 A3
127 A3 A4 A4 A5 A6 A5 A6 A7 A8 162 A3 A4 A4 A5 A6 A5 A6 A7 A8
@@ -129,6 +164,8 @@ The target is named "raid" and it accepts the following parameters:
129 A5 A6 A7 A8 A9 A9 A10 A11 A12 164 A5 A6 A7 A8 A9 A9 A10 A11 A12
130 A6 A5 A9 A7 A8 A10 A9 A12 A11 165 A6 A5 A9 A7 A8 A10 A9 A12 A11
131 .. .. .. .. .. .. .. .. .. 166 .. .. .. .. .. .. .. .. ..
167 ======== ========== ================
168
132 Here we see layouts closely akin to 'RAID1E - Integrated 169 Here we see layouts closely akin to 'RAID1E - Integrated
133 Offset Stripe Mirroring'. 170 Offset Stripe Mirroring'.
134 171
@@ -190,22 +227,25 @@ The target is named "raid" and it accepts the following parameters:
190 227
191Example Tables 228Example Tables
192-------------- 229--------------
193# RAID4 - 4 data drives, 1 parity (no metadata devices)
194# No metadata devices specified to hold superblock/bitmap info
195# Chunk size of 1MiB
196# (Lines separated for easy reading)
197 230
1980 1960893648 raid \ 231::
199 raid4 1 2048 \
200 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
201 232
202# RAID4 - 4 data drives, 1 parity (with metadata devices) 233 # RAID4 - 4 data drives, 1 parity (no metadata devices)
203# Chunk size of 1MiB, force RAID initialization, 234 # No metadata devices specified to hold superblock/bitmap info
204# min recovery rate at 20 kiB/sec/disk 235 # Chunk size of 1MiB
236 # (Lines separated for easy reading)
205 237
2060 1960893648 raid \ 238 0 1960893648 raid \
207 raid4 4 2048 sync min_recovery_rate 20 \ 239 raid4 1 2048 \
208 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82 240 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
241
242 # RAID4 - 4 data drives, 1 parity (with metadata devices)
243 # Chunk size of 1MiB, force RAID initialization,
244 # min recovery rate at 20 kiB/sec/disk
245
246 0 1960893648 raid \
247 raid4 4 2048 sync min_recovery_rate 20 \
248 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
209 249
210 250
211Status Output 251Status Output
@@ -219,41 +259,58 @@ Arguments that can be repeated are ordered by value.
219 259
220'dmsetup status' yields information on the state and health of the array. 260'dmsetup status' yields information on the state and health of the array.
221The output is as follows (normally a single line, but expanded here for 261The output is as follows (normally a single line, but expanded here for
222clarity): 262clarity)::
2231: <s> <l> raid \ 263
2242: <raid_type> <#devices> <health_chars> \ 264 1: <s> <l> raid \
2253: <sync_ratio> <sync_action> <mismatch_cnt> 265 2: <raid_type> <#devices> <health_chars> \
266 3: <sync_ratio> <sync_action> <mismatch_cnt>
226 267
227Line 1 is the standard output produced by device-mapper. 268Line 1 is the standard output produced by device-mapper.
228Line 2 & 3 are produced by the raid target and are best explained by example: 269
270Line 2 & 3 are produced by the raid target and are best explained by example::
271
229 0 1960893648 raid raid4 5 AAAAA 2/490221568 init 0 272 0 1960893648 raid raid4 5 AAAAA 2/490221568 init 0
273
230Here we can see the RAID type is raid4, there are 5 devices - all of 274Here we can see the RAID type is raid4, there are 5 devices - all of
231which are 'A'live, and the array is 2/490221568 complete with its initial 275which are 'A'live, and the array is 2/490221568 complete with its initial
232recovery. Here is a fuller description of the individual fields: 276recovery. Here is a fuller description of the individual fields:
277
278 =============== =========================================================
233 <raid_type> Same as the <raid_type> used to create the array. 279 <raid_type> Same as the <raid_type> used to create the array.
234 <health_chars> One char for each device, indicating: 'A' = alive and 280 <health_chars> One char for each device, indicating:
235 in-sync, 'a' = alive but not in-sync, 'D' = dead/failed. 281
282 - 'A' = alive and in-sync
283 - 'a' = alive but not in-sync
284 - 'D' = dead/failed.
236 <sync_ratio> The ratio indicating how much of the array has undergone 285 <sync_ratio> The ratio indicating how much of the array has undergone
237 the process described by 'sync_action'. If the 286 the process described by 'sync_action'. If the
238 'sync_action' is "check" or "repair", then the process 287 'sync_action' is "check" or "repair", then the process
239 of "resync" or "recover" can be considered complete. 288 of "resync" or "recover" can be considered complete.
240 <sync_action> One of the following possible states: 289 <sync_action> One of the following possible states:
241 idle - No synchronization action is being performed. 290
242 frozen - The current action has been halted. 291 idle
243 resync - Array is undergoing its initial synchronization 292 - No synchronization action is being performed.
293 frozen
294 - The current action has been halted.
295 resync
296 - Array is undergoing its initial synchronization
244 or is resynchronizing after an unclean shutdown 297 or is resynchronizing after an unclean shutdown
245 (possibly aided by a bitmap). 298 (possibly aided by a bitmap).
246 recover - A device in the array is being rebuilt or 299 recover
300 - A device in the array is being rebuilt or
247 replaced. 301 replaced.
248 check - A user-initiated full check of the array is 302 check
303 - A user-initiated full check of the array is
249 being performed. All blocks are read and 304 being performed. All blocks are read and
250 checked for consistency. The number of 305 checked for consistency. The number of
251 discrepancies found are recorded in 306 discrepancies found are recorded in
252 <mismatch_cnt>. No changes are made to the 307 <mismatch_cnt>. No changes are made to the
253 array by this action. 308 array by this action.
254 repair - The same as "check", but discrepancies are 309 repair
310 - The same as "check", but discrepancies are
255 corrected. 311 corrected.
256 reshape - The array is undergoing a reshape. 312 reshape
313 - The array is undergoing a reshape.
257 <mismatch_cnt> The number of discrepancies found between mirror copies 314 <mismatch_cnt> The number of discrepancies found between mirror copies
258 in RAID1/10 or wrong parity values found in RAID4/5/6. 315 in RAID1/10 or wrong parity values found in RAID4/5/6.
259 This value is valid only after a "check" of the array 316 This value is valid only after a "check" of the array
@@ -261,10 +318,11 @@ recovery. Here is a fuller description of the individual fields:
261 <data_offset> The current data offset to the start of the user data on 318 <data_offset> The current data offset to the start of the user data on
262 each component device of a raid set (see the respective 319 each component device of a raid set (see the respective
263 raid parameter to support out-of-place reshaping). 320 raid parameter to support out-of-place reshaping).
264 <journal_char> 'A' - active write-through journal device. 321 <journal_char> - 'A' - active write-through journal device.
265 'a' - active write-back journal device. 322 - 'a' - active write-back journal device.
266 'D' - dead journal device. 323 - 'D' - dead journal device.
267 '-' - no journal device. 324 - '-' - no journal device.
325 =============== =========================================================
268 326
269 327
270Message Interface 328Message Interface
@@ -272,12 +330,15 @@ Message Interface
272The dm-raid target will accept certain actions through the 'message' interface. 330The dm-raid target will accept certain actions through the 'message' interface.
273('man dmsetup' for more information on the message interface.) These actions 331('man dmsetup' for more information on the message interface.) These actions
274include: 332include:
275 "idle" - Halt the current sync action. 333
276 "frozen" - Freeze the current sync action. 334 ========= ================================================
277 "resync" - Initiate/continue a resync. 335 "idle" Halt the current sync action.
278 "recover"- Initiate/continue a recover process. 336 "frozen" Freeze the current sync action.
279 "check" - Initiate a check (i.e. a "scrub") of the array. 337 "resync" Initiate/continue a resync.
280 "repair" - Initiate a repair of the array. 338 "recover" Initiate/continue a recover process.
339 "check" Initiate a check (i.e. a "scrub") of the array.
340 "repair" Initiate a repair of the array.
341 ========= ================================================
281 342
282 343
283Discard Support 344Discard Support
@@ -307,48 +368,52 @@ increasingly whitelisted in the kernel and can thus be trusted.
307 368
308For trusted devices, the following dm-raid module parameter can be set 369For trusted devices, the following dm-raid module parameter can be set
309to safely enable discard support for RAID 4/5/6: 370to safely enable discard support for RAID 4/5/6:
371
310 'devices_handle_discards_safely' 372 'devices_handle_discards_safely'
311 373
312 374
313Version History 375Version History
314--------------- 376---------------
3151.0.0 Initial version. Support for RAID 4/5/6 377
3161.1.0 Added support for RAID 1 378::
3171.2.0 Handle creation of arrays that contain failed devices. 379
3181.3.0 Added support for RAID 10 380 1.0.0 Initial version. Support for RAID 4/5/6
3191.3.1 Allow device replacement/rebuild for RAID 10 381 1.1.0 Added support for RAID 1
3201.3.2 Fix/improve redundancy checking for RAID10 382 1.2.0 Handle creation of arrays that contain failed devices.
3211.4.0 Non-functional change. Removes arg from mapping function. 383 1.3.0 Added support for RAID 10
3221.4.1 RAID10 fix redundancy validation checks (commit 55ebbb5). 384 1.3.1 Allow device replacement/rebuild for RAID 10
3231.4.2 Add RAID10 "far" and "offset" algorithm support. 385 1.3.2 Fix/improve redundancy checking for RAID10
3241.5.0 Add message interface to allow manipulation of the sync_action. 386 1.4.0 Non-functional change. Removes arg from mapping function.
387 1.4.1 RAID10 fix redundancy validation checks (commit 55ebbb5).
388 1.4.2 Add RAID10 "far" and "offset" algorithm support.
389 1.5.0 Add message interface to allow manipulation of the sync_action.
325 New status (STATUSTYPE_INFO) fields: sync_action and mismatch_cnt. 390 New status (STATUSTYPE_INFO) fields: sync_action and mismatch_cnt.
3261.5.1 Add ability to restore transiently failed devices on resume. 391 1.5.1 Add ability to restore transiently failed devices on resume.
3271.5.2 'mismatch_cnt' is zero unless [last_]sync_action is "check". 392 1.5.2 'mismatch_cnt' is zero unless [last_]sync_action is "check".
3281.6.0 Add discard support (and devices_handle_discard_safely module param). 393 1.6.0 Add discard support (and devices_handle_discard_safely module param).
3291.7.0 Add support for MD RAID0 mappings. 394 1.7.0 Add support for MD RAID0 mappings.
3301.8.0 Explicitly check for compatible flags in the superblock metadata 395 1.8.0 Explicitly check for compatible flags in the superblock metadata
331 and reject to start the raid set if any are set by a newer 396 and reject to start the raid set if any are set by a newer
332 target version, thus avoiding data corruption on a raid set 397 target version, thus avoiding data corruption on a raid set
333 with a reshape in progress. 398 with a reshape in progress.
3341.9.0 Add support for RAID level takeover/reshape/region size 399 1.9.0 Add support for RAID level takeover/reshape/region size
335 and set size reduction. 400 and set size reduction.
3361.9.1 Fix activation of existing RAID 4/10 mapped devices 401 1.9.1 Fix activation of existing RAID 4/10 mapped devices
3371.9.2 Don't emit '- -' on the status table line in case the constructor 402 1.9.2 Don't emit '- -' on the status table line in case the constructor
338 fails reading a superblock. Correctly emit 'maj:min1 maj:min2' and 403 fails reading a superblock. Correctly emit 'maj:min1 maj:min2' and
339 'D' on the status line. If '- -' is passed into the constructor, emit 404 'D' on the status line. If '- -' is passed into the constructor, emit
340 '- -' on the table line and '-' as the status line health character. 405 '- -' on the table line and '-' as the status line health character.
3411.10.0 Add support for raid4/5/6 journal device 406 1.10.0 Add support for raid4/5/6 journal device
3421.10.1 Fix data corruption on reshape request 407 1.10.1 Fix data corruption on reshape request
3431.11.0 Fix table line argument order 408 1.11.0 Fix table line argument order
344 (wrong raid10_copies/raid10_format sequence) 409 (wrong raid10_copies/raid10_format sequence)
3451.11.1 Add raid4/5/6 journal write-back support via journal_mode option 410 1.11.1 Add raid4/5/6 journal write-back support via journal_mode option
3461.12.1 Fix for MD deadlock between mddev_suspend() and md_write_start() available 411 1.12.1 Fix for MD deadlock between mddev_suspend() and md_write_start() available
3471.13.0 Fix dev_health status at end of "recover" (was 'a', now 'A') 412 1.13.0 Fix dev_health status at end of "recover" (was 'a', now 'A')
3481.13.1 Fix deadlock caused by early md_stop_writes(). Also fix size an 413 1.13.1 Fix deadlock caused by early md_stop_writes(). Also fix size an
349 state races. 414 state races.
3501.13.2 Fix raid redundancy validation and avoid keeping raid set frozen 415 1.13.2 Fix raid redundancy validation and avoid keeping raid set frozen
3511.14.0 Fix reshape race on small devices. Fix stripe adding reshape 416 1.14.0 Fix reshape race on small devices. Fix stripe adding reshape
352 deadlock/potential data corruption. Update superblock when 417 deadlock/potential data corruption. Update superblock when
353 specific devices are requested via rebuild. Fix RAID leg 418 specific devices are requested via rebuild. Fix RAID leg
354 rebuild errors. 419 rebuild errors.
diff --git a/Documentation/device-mapper/dm-service-time.txt b/Documentation/device-mapper/dm-service-time.rst
index fb1d4a0cf122..facf277fc13c 100644
--- a/Documentation/device-mapper/dm-service-time.txt
+++ b/Documentation/device-mapper/dm-service-time.rst
@@ -1,3 +1,4 @@
1===============
1dm-service-time 2dm-service-time
2=============== 3===============
3 4
@@ -12,25 +13,34 @@ in a path-group, and it can be specified as a table argument.
12 13
13The path selector name is 'service-time'. 14The path selector name is 'service-time'.
14 15
15Table parameters for each path: [<repeat_count> [<relative_throughput>]] 16Table parameters for each path:
16 <repeat_count>: The number of I/Os to dispatch using the selected 17
18 [<repeat_count> [<relative_throughput>]]
19 <repeat_count>:
20 The number of I/Os to dispatch using the selected
17 path before switching to the next path. 21 path before switching to the next path.
18 If not given, internal default is used. To check 22 If not given, internal default is used. To check
19 the default value, see the activated table. 23 the default value, see the activated table.
20 <relative_throughput>: The relative throughput value of the path 24 <relative_throughput>:
25 The relative throughput value of the path
21 among all paths in the path-group. 26 among all paths in the path-group.
22 The valid range is 0-100. 27 The valid range is 0-100.
23 If not given, minimum value '1' is used. 28 If not given, minimum value '1' is used.
24 If '0' is given, the path isn't selected while 29 If '0' is given, the path isn't selected while
25 other paths having a positive value are available. 30 other paths having a positive value are available.
26 31
27Status for each path: <status> <fail-count> <in-flight-size> \ 32Status for each path:
28 <relative_throughput> 33
29 <status>: 'A' if the path is active, 'F' if the path is failed. 34 <status> <fail-count> <in-flight-size> <relative_throughput>
30 <fail-count>: The number of path failures. 35 <status>:
31 <in-flight-size>: The size of in-flight I/Os on the path. 36 'A' if the path is active, 'F' if the path is failed.
32 <relative_throughput>: The relative throughput value of the path 37 <fail-count>:
33 among all paths in the path-group. 38 The number of path failures.
39 <in-flight-size>:
40 The size of in-flight I/Os on the path.
41 <relative_throughput>:
42 The relative throughput value of the path
43 among all paths in the path-group.
34 44
35 45
36Algorithm 46Algorithm
@@ -39,7 +49,7 @@ Algorithm
39dm-service-time adds the I/O size to 'in-flight-size' when the I/O is 49dm-service-time adds the I/O size to 'in-flight-size' when the I/O is
40dispatched and subtracts when completed. 50dispatched and subtracts when completed.
41Basically, dm-service-time selects a path having minimum service time 51Basically, dm-service-time selects a path having minimum service time
42which is calculated by: 52which is calculated by::
43 53
44 ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput' 54 ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput'
45 55
@@ -67,25 +77,25 @@ Examples
67======== 77========
68In case that 2 paths (sda and sdb) are used with repeat_count == 128 78In case that 2 paths (sda and sdb) are used with repeat_count == 128
69and sda has an average throughput 1GB/s and sdb has 4GB/s, 79and sda has an average throughput 1GB/s and sdb has 4GB/s,
70'relative_throughput' value may be '1' for sda and '4' for sdb. 80'relative_throughput' value may be '1' for sda and '4' for sdb::
71 81
72# echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \ 82 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \
73 dmsetup create test 83 dmsetup create test
74# 84 #
75# dmsetup table 85 # dmsetup table
76test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4 86 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4
77# 87 #
78# dmsetup status 88 # dmsetup status
79test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 1 8:16 A 0 0 4 89 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 1 8:16 A 0 0 4
80 90
81 91
82Or '2' for sda and '8' for sdb would be also true. 92Or '2' for sda and '8' for sdb would be also true::
83 93
84# echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \ 94 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \
85 dmsetup create test 95 dmsetup create test
86# 96 #
87# dmsetup table 97 # dmsetup table
88test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8 98 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8
89# 99 #
90# dmsetup status 100 # dmsetup status
91test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 2 8:16 A 0 0 8 101 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 2 8:16 A 0 0 8
diff --git a/Documentation/device-mapper/dm-uevent.rst b/Documentation/device-mapper/dm-uevent.rst
new file mode 100644
index 000000000000..4a8ee8d069c9
--- /dev/null
+++ b/Documentation/device-mapper/dm-uevent.rst
@@ -0,0 +1,110 @@
1====================
2device-mapper uevent
3====================
4
5The device-mapper uevent code adds the capability to device-mapper to create
6and send kobject uevents (uevents). Previously device-mapper events were only
7available through the ioctl interface. The advantage of the uevents interface
8is the event contains environment attributes providing increased context for
9the event avoiding the need to query the state of the device-mapper device after
10the event is received.
11
12There are two functions currently for device-mapper events. The first function
13listed creates the event and the second function sends the event(s)::
14
15 void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
16 const char *path, unsigned nr_valid_paths)
17
18 void dm_send_uevents(struct list_head *events, struct kobject *kobj)
19
20
21The variables added to the uevent environment are:
22
23Variable Name: DM_TARGET
24------------------------
25:Uevent Action(s): KOBJ_CHANGE
26:Type: string
27:Description:
28:Value: Name of device-mapper target that generated the event.
29
30Variable Name: DM_ACTION
31------------------------
32:Uevent Action(s): KOBJ_CHANGE
33:Type: string
34:Description:
35:Value: Device-mapper specific action that caused the uevent action.
36 PATH_FAILED - A path has failed;
37 PATH_REINSTATED - A path has been reinstated.
38
39Variable Name: DM_SEQNUM
40------------------------
41:Uevent Action(s): KOBJ_CHANGE
42:Type: unsigned integer
43:Description: A sequence number for this specific device-mapper device.
44:Value: Valid unsigned integer range.
45
46Variable Name: DM_PATH
47----------------------
48:Uevent Action(s): KOBJ_CHANGE
49:Type: string
50:Description: Major and minor number of the path device pertaining to this
51 event.
52:Value: Path name in the form of "Major:Minor"
53
54Variable Name: DM_NR_VALID_PATHS
55--------------------------------
56:Uevent Action(s): KOBJ_CHANGE
57:Type: unsigned integer
58:Description:
59:Value: Valid unsigned integer range.
60
61Variable Name: DM_NAME
62----------------------
63:Uevent Action(s): KOBJ_CHANGE
64:Type: string
65:Description: Name of the device-mapper device.
66:Value: Name
67
68Variable Name: DM_UUID
69----------------------
70:Uevent Action(s): KOBJ_CHANGE
71:Type: string
72:Description: UUID of the device-mapper device.
73:Value: UUID. (Empty string if there isn't one.)
74
75An example of the uevents generated as captured by udevmonitor is shown
76below
77
781.) Path failure::
79
80 UEVENT[1192521009.711215] change@/block/dm-3
81 ACTION=change
82 DEVPATH=/block/dm-3
83 SUBSYSTEM=block
84 DM_TARGET=multipath
85 DM_ACTION=PATH_FAILED
86 DM_SEQNUM=1
87 DM_PATH=8:32
88 DM_NR_VALID_PATHS=0
89 DM_NAME=mpath2
90 DM_UUID=mpath-35333333000002328
91 MINOR=3
92 MAJOR=253
93 SEQNUM=1130
94
952.) Path reinstate::
96
97 UEVENT[1192521132.989927] change@/block/dm-3
98 ACTION=change
99 DEVPATH=/block/dm-3
100 SUBSYSTEM=block
101 DM_TARGET=multipath
102 DM_ACTION=PATH_REINSTATED
103 DM_SEQNUM=2
104 DM_PATH=8:32
105 DM_NR_VALID_PATHS=1
106 DM_NAME=mpath2
107 DM_UUID=mpath-35333333000002328
108 MINOR=3
109 MAJOR=253
110 SEQNUM=1131
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt
deleted file mode 100644
index 07edbd85c714..000000000000
--- a/Documentation/device-mapper/dm-uevent.txt
+++ /dev/null
@@ -1,97 +0,0 @@
1The device-mapper uevent code adds the capability to device-mapper to create
2and send kobject uevents (uevents). Previously device-mapper events were only
3available through the ioctl interface. The advantage of the uevents interface
4is the event contains environment attributes providing increased context for
5the event avoiding the need to query the state of the device-mapper device after
6the event is received.
7
8There are two functions currently for device-mapper events. The first function
9listed creates the event and the second function sends the event(s).
10
11void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
12 const char *path, unsigned nr_valid_paths)
13
14void dm_send_uevents(struct list_head *events, struct kobject *kobj)
15
16
17The variables added to the uevent environment are:
18
19Variable Name: DM_TARGET
20Uevent Action(s): KOBJ_CHANGE
21Type: string
22Description:
23Value: Name of device-mapper target that generated the event.
24
25Variable Name: DM_ACTION
26Uevent Action(s): KOBJ_CHANGE
27Type: string
28Description:
29Value: Device-mapper specific action that caused the uevent action.
30 PATH_FAILED - A path has failed.
31 PATH_REINSTATED - A path has been reinstated.
32
33Variable Name: DM_SEQNUM
34Uevent Action(s): KOBJ_CHANGE
35Type: unsigned integer
36Description: A sequence number for this specific device-mapper device.
37Value: Valid unsigned integer range.
38
39Variable Name: DM_PATH
40Uevent Action(s): KOBJ_CHANGE
41Type: string
42Description: Major and minor number of the path device pertaining to this
43event.
44Value: Path name in the form of "Major:Minor"
45
46Variable Name: DM_NR_VALID_PATHS
47Uevent Action(s): KOBJ_CHANGE
48Type: unsigned integer
49Description:
50Value: Valid unsigned integer range.
51
52Variable Name: DM_NAME
53Uevent Action(s): KOBJ_CHANGE
54Type: string
55Description: Name of the device-mapper device.
56Value: Name
57
58Variable Name: DM_UUID
59Uevent Action(s): KOBJ_CHANGE
60Type: string
61Description: UUID of the device-mapper device.
62Value: UUID. (Empty string if there isn't one.)
63
64An example of the uevents generated as captured by udevmonitor is shown
65below.
66
671.) Path failure.
68UEVENT[1192521009.711215] change@/block/dm-3
69ACTION=change
70DEVPATH=/block/dm-3
71SUBSYSTEM=block
72DM_TARGET=multipath
73DM_ACTION=PATH_FAILED
74DM_SEQNUM=1
75DM_PATH=8:32
76DM_NR_VALID_PATHS=0
77DM_NAME=mpath2
78DM_UUID=mpath-35333333000002328
79MINOR=3
80MAJOR=253
81SEQNUM=1130
82
832.) Path reinstate.
84UEVENT[1192521132.989927] change@/block/dm-3
85ACTION=change
86DEVPATH=/block/dm-3
87SUBSYSTEM=block
88DM_TARGET=multipath
89DM_ACTION=PATH_REINSTATED
90DM_SEQNUM=2
91DM_PATH=8:32
92DM_NR_VALID_PATHS=1
93DM_NAME=mpath2
94DM_UUID=mpath-35333333000002328
95MINOR=3
96MAJOR=253
97SEQNUM=1131
diff --git a/Documentation/device-mapper/dm-zoned.txt b/Documentation/device-mapper/dm-zoned.rst
index 736fcc78d193..07f56ebc1730 100644
--- a/Documentation/device-mapper/dm-zoned.txt
+++ b/Documentation/device-mapper/dm-zoned.rst
@@ -1,3 +1,4 @@
1========
1dm-zoned 2dm-zoned
2======== 3========
3 4
@@ -133,12 +134,13 @@ A zoned block device must first be formatted using the dmzadm tool. This
133will analyze the device zone configuration, determine where to place the 134will analyze the device zone configuration, determine where to place the
134metadata sets on the device and initialize the metadata sets. 135metadata sets on the device and initialize the metadata sets.
135 136
136Ex: 137Ex::
137 138
138dmzadm --format /dev/sdxx 139 dmzadm --format /dev/sdxx
139 140
140For a formatted device, the target can be created normally with the 141For a formatted device, the target can be created normally with the
141dmsetup utility. The only parameter that dm-zoned requires is the 142dmsetup utility. The only parameter that dm-zoned requires is the
142underlying zoned block device name. Ex: 143underlying zoned block device name. Ex::
143 144
144echo "0 `blockdev --getsize ${dev}` zoned ${dev}" | dmsetup create dmz-`basename ${dev}` 145 echo "0 `blockdev --getsize ${dev}` zoned ${dev}" | \
146 dmsetup create dmz-`basename ${dev}`
diff --git a/Documentation/device-mapper/era.txt b/Documentation/device-mapper/era.rst
index 3c6d01be3560..90dd5c670b9f 100644
--- a/Documentation/device-mapper/era.txt
+++ b/Documentation/device-mapper/era.rst
@@ -1,3 +1,7 @@
1======
2dm-era
3======
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -14,12 +18,14 @@ coherency after rolling back a vendor snapshot.
14Constructor 18Constructor
15=========== 19===========
16 20
17 era <metadata dev> <origin dev> <block size> 21era <metadata dev> <origin dev> <block size>
18 22
19 metadata dev : fast device holding the persistent metadata 23 ================ ======================================================
20 origin dev : device holding data blocks that may change 24 metadata dev fast device holding the persistent metadata
21 block size : block size of origin data device, granularity that is 25 origin dev device holding data blocks that may change
22 tracked by the target 26 block size block size of origin data device, granularity that is
27 tracked by the target
28 ================ ======================================================
23 29
24Messages 30Messages
25======== 31========
@@ -49,14 +55,16 @@ Status
49<metadata block size> <#used metadata blocks>/<#total metadata blocks> 55<metadata block size> <#used metadata blocks>/<#total metadata blocks>
50<current era> <held metadata root | '-'> 56<current era> <held metadata root | '-'>
51 57
52metadata block size : Fixed block size for each metadata block in 58========================= ==============================================
53 sectors 59metadata block size Fixed block size for each metadata block in
54#used metadata blocks : Number of metadata blocks used 60 sectors
55#total metadata blocks : Total number of metadata blocks 61#used metadata blocks Number of metadata blocks used
56current era : The current era 62#total metadata blocks Total number of metadata blocks
57held metadata root : The location, in blocks, of the metadata root 63current era The current era
58 that has been 'held' for userspace read 64held metadata root The location, in blocks, of the metadata root
59 access. '-' indicates there is no held root 65 that has been 'held' for userspace read
66 access. '-' indicates there is no held root
67========================= ==============================================
60 68
61Detailed use case 69Detailed use case
62================= 70=================
@@ -88,7 +96,7 @@ Memory usage
88 96
89The target uses a bitset to record writes in the current era. It also 97The target uses a bitset to record writes in the current era. It also
90has a spare bitset ready for switching over to a new era. Other than 98has a spare bitset ready for switching over to a new era. Other than
91that it uses a few 4k blocks for updating metadata. 99that it uses a few 4k blocks for updating metadata::
92 100
93 (4 * nr_blocks) bytes + buffers 101 (4 * nr_blocks) bytes + buffers
94 102
diff --git a/Documentation/device-mapper/index.rst b/Documentation/device-mapper/index.rst
new file mode 100644
index 000000000000..105e253bc231
--- /dev/null
+++ b/Documentation/device-mapper/index.rst
@@ -0,0 +1,44 @@
1:orphan:
2
3=============
4Device Mapper
5=============
6
7.. toctree::
8 :maxdepth: 1
9
10 cache-policies
11 cache
12 delay
13 dm-crypt
14 dm-flakey
15 dm-init
16 dm-integrity
17 dm-io
18 dm-log
19 dm-queue-length
20 dm-raid
21 dm-service-time
22 dm-uevent
23 dm-zoned
24 era
25 kcopyd
26 linear
27 log-writes
28 persistent-data
29 snapshot
30 statistics
31 striped
32 switch
33 thin-provisioning
34 unstriped
35 verity
36 writecache
37 zero
38
39.. only:: subproject and html
40
41 Indices
42 =======
43
44 * :ref:`genindex`
diff --git a/Documentation/device-mapper/kcopyd.txt b/Documentation/device-mapper/kcopyd.rst
index 820382c4cecf..7651d395127f 100644
--- a/Documentation/device-mapper/kcopyd.txt
+++ b/Documentation/device-mapper/kcopyd.rst
@@ -1,3 +1,4 @@
1======
1kcopyd 2kcopyd
2====== 3======
3 4
@@ -7,7 +8,7 @@ notification. It is used by dm-snapshot and dm-mirror.
7 8
8Users of kcopyd must first create a client and indicate how many memory pages 9Users of kcopyd must first create a client and indicate how many memory pages
9to set aside for their copy jobs. This is done with a call to 10to set aside for their copy jobs. This is done with a call to
10kcopyd_client_create(). 11kcopyd_client_create()::
11 12
12 int kcopyd_client_create(unsigned int num_pages, 13 int kcopyd_client_create(unsigned int num_pages,
13 struct kcopyd_client **result); 14 struct kcopyd_client **result);
@@ -16,7 +17,7 @@ To start a copy job, the user must set up io_region structures to describe
16the source and destinations of the copy. Each io_region indicates a 17the source and destinations of the copy. Each io_region indicates a
17block-device along with the starting sector and size of the region. The source 18block-device along with the starting sector and size of the region. The source
18of the copy is given as one io_region structure, and the destinations of the 19of the copy is given as one io_region structure, and the destinations of the
19copy are given as an array of io_region structures. 20copy are given as an array of io_region structures::
20 21
21 struct io_region { 22 struct io_region {
22 struct block_device *bdev; 23 struct block_device *bdev;
@@ -26,7 +27,7 @@ copy are given as an array of io_region structures.
26 27
27To start the copy, the user calls kcopyd_copy(), passing in the client 28To start the copy, the user calls kcopyd_copy(), passing in the client
28pointer, pointers to the source and destination io_regions, the name of a 29pointer, pointers to the source and destination io_regions, the name of a
29completion callback routine, and a pointer to some context data for the copy. 30completion callback routine, and a pointer to some context data for the copy::
30 31
31 int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, 32 int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
32 unsigned int num_dests, struct io_region *dests, 33 unsigned int num_dests, struct io_region *dests,
@@ -41,7 +42,6 @@ write error occurred during the copy.
41 42
42When a user is done with all their copy jobs, they should call 43When a user is done with all their copy jobs, they should call
43kcopyd_client_destroy() to delete the kcopyd client, which will release the 44kcopyd_client_destroy() to delete the kcopyd client, which will release the
44associated memory pages. 45associated memory pages::
45 46
46 void kcopyd_client_destroy(struct kcopyd_client *kc); 47 void kcopyd_client_destroy(struct kcopyd_client *kc);
47
diff --git a/Documentation/device-mapper/linear.rst b/Documentation/device-mapper/linear.rst
new file mode 100644
index 000000000000..9d17fc6e64a9
--- /dev/null
+++ b/Documentation/device-mapper/linear.rst
@@ -0,0 +1,63 @@
1=========
2dm-linear
3=========
4
5Device-Mapper's "linear" target maps a linear range of the Device-Mapper
6device onto a linear range of another device. This is the basic building
7block of logical volume managers.
8
9Parameters: <dev path> <offset>
10 <dev path>:
11 Full pathname to the underlying block-device, or a
12 "major:minor" device-number.
13 <offset>:
14 Starting sector within the device.
15
16
17Example scripts
18===============
19
20::
21
22 #!/bin/sh
23 # Create an identity mapping for a device
24 echo "0 `blockdev --getsz $1` linear $1 0" | dmsetup create identity
25
26::
27
28 #!/bin/sh
29 # Join 2 devices together
30 size1=`blockdev --getsz $1`
31 size2=`blockdev --getsz $2`
32 echo "0 $size1 linear $1 0
33 $size1 $size2 linear $2 0" | dmsetup create joined
34
35::
36
37 #!/usr/bin/perl -w
38 # Split a device into 4M chunks and then join them together in reverse order.
39
40 my $name = "reverse";
41 my $extent_size = 4 * 1024 * 2;
42 my $dev = $ARGV[0];
43 my $table = "";
44 my $count = 0;
45
46 if (!defined($dev)) {
47 die("Please specify a device.\n");
48 }
49
50 my $dev_size = `blockdev --getsz $dev`;
51 my $extents = int($dev_size / $extent_size) -
52 (($dev_size % $extent_size) ? 1 : 0);
53
54 while ($extents > 0) {
55 my $this_start = $count * $extent_size;
56 $extents--;
57 $count++;
58 my $this_offset = $extents * $extent_size;
59
60 $table .= "$this_start $extent_size linear $dev $this_offset\n";
61 }
62
63 `echo \"$table\" | dmsetup create $name`;
diff --git a/Documentation/device-mapper/linear.txt b/Documentation/device-mapper/linear.txt
deleted file mode 100644
index 7cb98d89d3f8..000000000000
--- a/Documentation/device-mapper/linear.txt
+++ /dev/null
@@ -1,61 +0,0 @@
1dm-linear
2=========
3
4Device-Mapper's "linear" target maps a linear range of the Device-Mapper
5device onto a linear range of another device. This is the basic building
6block of logical volume managers.
7
8Parameters: <dev path> <offset>
9 <dev path>: Full pathname to the underlying block-device, or a
10 "major:minor" device-number.
11 <offset>: Starting sector within the device.
12
13
14Example scripts
15===============
16[[
17#!/bin/sh
18# Create an identity mapping for a device
19echo "0 `blockdev --getsz $1` linear $1 0" | dmsetup create identity
20]]
21
22
23[[
24#!/bin/sh
25# Join 2 devices together
26size1=`blockdev --getsz $1`
27size2=`blockdev --getsz $2`
28echo "0 $size1 linear $1 0
29$size1 $size2 linear $2 0" | dmsetup create joined
30]]
31
32
33[[
34#!/usr/bin/perl -w
35# Split a device into 4M chunks and then join them together in reverse order.
36
37my $name = "reverse";
38my $extent_size = 4 * 1024 * 2;
39my $dev = $ARGV[0];
40my $table = "";
41my $count = 0;
42
43if (!defined($dev)) {
44 die("Please specify a device.\n");
45}
46
47my $dev_size = `blockdev --getsz $dev`;
48my $extents = int($dev_size / $extent_size) -
49 (($dev_size % $extent_size) ? 1 : 0);
50
51while ($extents > 0) {
52 my $this_start = $count * $extent_size;
53 $extents--;
54 $count++;
55 my $this_offset = $extents * $extent_size;
56
57 $table .= "$this_start $extent_size linear $dev $this_offset\n";
58}
59
60`echo \"$table\" | dmsetup create $name`;
61]]
diff --git a/Documentation/device-mapper/log-writes.txt b/Documentation/device-mapper/log-writes.rst
index b638d124be6a..23141f2ffb7c 100644
--- a/Documentation/device-mapper/log-writes.txt
+++ b/Documentation/device-mapper/log-writes.rst
@@ -1,3 +1,4 @@
1=============
1dm-log-writes 2dm-log-writes
2============= 3=============
3 4
@@ -25,11 +26,11 @@ completed WRITEs, at the time the REQ_PREFLUSH is issued, are added in order to
25simulate the worst case scenario with regard to power failures. Consider the 26simulate the worst case scenario with regard to power failures. Consider the
26following example (W means write, C means complete): 27following example (W means write, C means complete):
27 28
28W1,W2,W3,C3,C2,Wflush,C1,Cflush 29 W1,W2,W3,C3,C2,Wflush,C1,Cflush
29 30
30The log would show the following 31The log would show the following:
31 32
32W3,W2,flush,W1.... 33 W3,W2,flush,W1....
33 34
34Again this is to simulate what is actually on disk, this allows us to detect 35Again this is to simulate what is actually on disk, this allows us to detect
35cases where a power failure at a particular point in time would create an 36cases where a power failure at a particular point in time would create an
@@ -42,11 +43,11 @@ Any REQ_OP_DISCARD requests are treated like WRITE requests. Otherwise we would
42have all the DISCARD requests, and then the WRITE requests and then the FLUSH 43have all the DISCARD requests, and then the WRITE requests and then the FLUSH
43request. Consider the following example: 44request. Consider the following example:
44 45
45WRITE block 1, DISCARD block 1, FLUSH 46 WRITE block 1, DISCARD block 1, FLUSH
46 47
47If we logged DISCARD when it completed, the replay would look like this 48If we logged DISCARD when it completed, the replay would look like this:
48 49
49DISCARD 1, WRITE 1, FLUSH 50 DISCARD 1, WRITE 1, FLUSH
50 51
51which isn't quite what happened and wouldn't be caught during the log replay. 52which isn't quite what happened and wouldn't be caught during the log replay.
52 53
@@ -57,15 +58,19 @@ i) Constructor
57 58
58 log-writes <dev_path> <log_dev_path> 59 log-writes <dev_path> <log_dev_path>
59 60
60 dev_path : Device that all of the IO will go to normally. 61 ============= ==============================================
61 log_dev_path : Device where the log entries are written to. 62 dev_path Device that all of the IO will go to normally.
63 log_dev_path Device where the log entries are written to.
64 ============= ==============================================
62 65
63ii) Status 66ii) Status
64 67
65 <#logged entries> <highest allocated sector> 68 <#logged entries> <highest allocated sector>
66 69
67 #logged entries : Number of logged entries 70 =========================== ========================
68 highest allocated sector : Highest allocated sector 71 #logged entries Number of logged entries
72 highest allocated sector Highest allocated sector
73 =========================== ========================
69 74
70iii) Messages 75iii) Messages
71 76
@@ -75,15 +80,15 @@ iii) Messages
75 For example say you want to fsck a file system after every 80 For example say you want to fsck a file system after every
76 write, but first you need to replay up to the mkfs to make sure 81 write, but first you need to replay up to the mkfs to make sure
77 we're fsck'ing something reasonable, you would do something like 82 we're fsck'ing something reasonable, you would do something like
78 this: 83 this::
79 84
80 mkfs.btrfs -f /dev/mapper/log 85 mkfs.btrfs -f /dev/mapper/log
81 dmsetup message log 0 mark mkfs 86 dmsetup message log 0 mark mkfs
82 <run test> 87 <run test>
83 88
84 This would allow you to replay the log up to the mkfs mark and 89 This would allow you to replay the log up to the mkfs mark and
85 then replay from that point on doing the fsck check in the 90 then replay from that point on doing the fsck check in the
86 interval that you want. 91 interval that you want.
87 92
88 Every log has a mark at the end labeled "dm-log-writes-end". 93 Every log has a mark at the end labeled "dm-log-writes-end".
89 94
@@ -97,42 +102,42 @@ Example usage
97============= 102=============
98 103
99Say you want to test fsync on your file system. You would do something like 104Say you want to test fsync on your file system. You would do something like
100this: 105this::
101 106
102TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc" 107 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
103dmsetup create log --table "$TABLE" 108 dmsetup create log --table "$TABLE"
104mkfs.btrfs -f /dev/mapper/log 109 mkfs.btrfs -f /dev/mapper/log
105dmsetup message log 0 mark mkfs 110 dmsetup message log 0 mark mkfs
106 111
107mount /dev/mapper/log /mnt/btrfs-test 112 mount /dev/mapper/log /mnt/btrfs-test
108<some test that does fsync at the end> 113 <some test that does fsync at the end>
109dmsetup message log 0 mark fsync 114 dmsetup message log 0 mark fsync
110md5sum /mnt/btrfs-test/foo 115 md5sum /mnt/btrfs-test/foo
111umount /mnt/btrfs-test 116 umount /mnt/btrfs-test
112 117
113dmsetup remove log 118 dmsetup remove log
114replay-log --log /dev/sdc --replay /dev/sdb --end-mark fsync 119 replay-log --log /dev/sdc --replay /dev/sdb --end-mark fsync
115mount /dev/sdb /mnt/btrfs-test 120 mount /dev/sdb /mnt/btrfs-test
116md5sum /mnt/btrfs-test/foo 121 md5sum /mnt/btrfs-test/foo
117<verify md5sum's are correct> 122 <verify md5sum's are correct>
118 123
119Another option is to do a complicated file system operation and verify the file 124 Another option is to do a complicated file system operation and verify the file
120system is consistent during the entire operation. You could do this with: 125 system is consistent during the entire operation. You could do this with:
121 126
122TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc" 127 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
123dmsetup create log --table "$TABLE" 128 dmsetup create log --table "$TABLE"
124mkfs.btrfs -f /dev/mapper/log 129 mkfs.btrfs -f /dev/mapper/log
125dmsetup message log 0 mark mkfs 130 dmsetup message log 0 mark mkfs
126 131
127mount /dev/mapper/log /mnt/btrfs-test 132 mount /dev/mapper/log /mnt/btrfs-test
128<fsstress to dirty the fs> 133 <fsstress to dirty the fs>
129btrfs filesystem balance /mnt/btrfs-test 134 btrfs filesystem balance /mnt/btrfs-test
130umount /mnt/btrfs-test 135 umount /mnt/btrfs-test
131dmsetup remove log 136 dmsetup remove log
132 137
133replay-log --log /dev/sdc --replay /dev/sdb --end-mark mkfs 138 replay-log --log /dev/sdc --replay /dev/sdb --end-mark mkfs
134btrfsck /dev/sdb 139 btrfsck /dev/sdb
135replay-log --log /dev/sdc --replay /dev/sdb --start-mark mkfs \ 140 replay-log --log /dev/sdc --replay /dev/sdb --start-mark mkfs \
136 --fsck "btrfsck /dev/sdb" --check fua 141 --fsck "btrfsck /dev/sdb" --check fua
137 142
138And that will replay the log until it sees a FUA request, run the fsck command 143And that will replay the log until it sees a FUA request, run the fsck command
diff --git a/Documentation/device-mapper/persistent-data.txt b/Documentation/device-mapper/persistent-data.rst
index a333bcb3a6c2..2065c3c5a091 100644
--- a/Documentation/device-mapper/persistent-data.txt
+++ b/Documentation/device-mapper/persistent-data.rst
@@ -1,3 +1,7 @@
1===============
2Persistent data
3===============
4
1Introduction 5Introduction
2============ 6============
3 7
diff --git a/Documentation/device-mapper/snapshot.txt b/Documentation/device-mapper/snapshot.rst
index b8bbb516f989..4c53304e72f1 100644
--- a/Documentation/device-mapper/snapshot.txt
+++ b/Documentation/device-mapper/snapshot.rst
@@ -1,15 +1,16 @@
1==============================
1Device-mapper snapshot support 2Device-mapper snapshot support
2============================== 3==============================
3 4
4Device-mapper allows you, without massive data copying: 5Device-mapper allows you, without massive data copying:
5 6
6*) To create snapshots of any block device i.e. mountable, saved states of 7- To create snapshots of any block device i.e. mountable, saved states of
7the block device which are also writable without interfering with the 8 the block device which are also writable without interfering with the
8original content; 9 original content;
9*) To create device "forks", i.e. multiple different versions of the 10- To create device "forks", i.e. multiple different versions of the
10same data stream. 11 same data stream.
11*) To merge a snapshot of a block device back into the snapshot's origin 12- To merge a snapshot of a block device back into the snapshot's origin
12device. 13 device.
13 14
14In the first two cases, dm copies only the chunks of data that get 15In the first two cases, dm copies only the chunks of data that get
15changed and uses a separate copy-on-write (COW) block device for 16changed and uses a separate copy-on-write (COW) block device for
@@ -22,7 +23,7 @@ the origin device.
22There are three dm targets available: 23There are three dm targets available:
23snapshot, snapshot-origin, and snapshot-merge. 24snapshot, snapshot-origin, and snapshot-merge.
24 25
25*) snapshot-origin <origin> 26- snapshot-origin <origin>
26 27
27which will normally have one or more snapshots based on it. 28which will normally have one or more snapshots based on it.
28Reads will be mapped directly to the backing device. For each write, the 29Reads will be mapped directly to the backing device. For each write, the
@@ -30,7 +31,7 @@ original data will be saved in the <COW device> of each snapshot to keep
30its visible content unchanged, at least until the <COW device> fills up. 31its visible content unchanged, at least until the <COW device> fills up.
31 32
32 33
33*) snapshot <origin> <COW device> <persistent?> <chunksize> 34- snapshot <origin> <COW device> <persistent?> <chunksize>
34 35
35A snapshot of the <origin> block device is created. Changed chunks of 36A snapshot of the <origin> block device is created. Changed chunks of
36<chunksize> sectors will be stored on the <COW device>. Writes will 37<chunksize> sectors will be stored on the <COW device>. Writes will
@@ -83,25 +84,25 @@ When you create the first LVM2 snapshot of a volume, four dm devices are used:
83 source volume), whose table is replaced by a "snapshot-origin" mapping 84 source volume), whose table is replaced by a "snapshot-origin" mapping
84 from device #1. 85 from device #1.
85 86
86A fixed naming scheme is used, so with the following commands: 87A fixed naming scheme is used, so with the following commands::
87 88
88lvcreate -L 1G -n base volumeGroup 89 lvcreate -L 1G -n base volumeGroup
89lvcreate -L 100M --snapshot -n snap volumeGroup/base 90 lvcreate -L 100M --snapshot -n snap volumeGroup/base
90 91
91we'll have this situation (with volumes in above order): 92we'll have this situation (with volumes in above order)::
92 93
93# dmsetup table|grep volumeGroup 94 # dmsetup table|grep volumeGroup
94 95
95volumeGroup-base-real: 0 2097152 linear 8:19 384 96 volumeGroup-base-real: 0 2097152 linear 8:19 384
96volumeGroup-snap-cow: 0 204800 linear 8:19 2097536 97 volumeGroup-snap-cow: 0 204800 linear 8:19 2097536
97volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16 98 volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16
98volumeGroup-base: 0 2097152 snapshot-origin 254:11 99 volumeGroup-base: 0 2097152 snapshot-origin 254:11
99 100
100# ls -lL /dev/mapper/volumeGroup-* 101 # ls -lL /dev/mapper/volumeGroup-*
101brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real 102 brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
102brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow 103 brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow
103brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap 104 brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap
104brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base 105 brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base
105 106
106 107
107How snapshot-merge is used by LVM2 108How snapshot-merge is used by LVM2
@@ -114,27 +115,28 @@ merging snapshot after it completes. The "snapshot" that hands over its
114COW device to the "snapshot-merge" is deactivated (unless using lvchange 115COW device to the "snapshot-merge" is deactivated (unless using lvchange
115--refresh); but if it is left active it will simply return I/O errors. 116--refresh); but if it is left active it will simply return I/O errors.
116 117
117A snapshot will merge into its origin with the following command: 118A snapshot will merge into its origin with the following command::
118 119
119lvconvert --merge volumeGroup/snap 120 lvconvert --merge volumeGroup/snap
120 121
121we'll now have this situation: 122we'll now have this situation::
122 123
123# dmsetup table|grep volumeGroup 124 # dmsetup table|grep volumeGroup
124 125
125volumeGroup-base-real: 0 2097152 linear 8:19 384 126 volumeGroup-base-real: 0 2097152 linear 8:19 384
126volumeGroup-base-cow: 0 204800 linear 8:19 2097536 127 volumeGroup-base-cow: 0 204800 linear 8:19 2097536
127volumeGroup-base: 0 2097152 snapshot-merge 254:11 254:12 P 16 128 volumeGroup-base: 0 2097152 snapshot-merge 254:11 254:12 P 16
128 129
129# ls -lL /dev/mapper/volumeGroup-* 130 # ls -lL /dev/mapper/volumeGroup-*
130brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real 131 brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
131brw------- 1 root root 254, 12 29 ago 18:16 /dev/mapper/volumeGroup-base-cow 132 brw------- 1 root root 254, 12 29 ago 18:16 /dev/mapper/volumeGroup-base-cow
132brw------- 1 root root 254, 10 29 ago 18:16 /dev/mapper/volumeGroup-base 133 brw------- 1 root root 254, 10 29 ago 18:16 /dev/mapper/volumeGroup-base
133 134
134 135
135How to determine when a merging is complete 136How to determine when a merging is complete
136=========================================== 137===========================================
137The snapshot-merge and snapshot status lines end with: 138The snapshot-merge and snapshot status lines end with:
139
138 <sectors_allocated>/<total_sectors> <metadata_sectors> 140 <sectors_allocated>/<total_sectors> <metadata_sectors>
139 141
140Both <sectors_allocated> and <total_sectors> include both data and metadata. 142Both <sectors_allocated> and <total_sectors> include both data and metadata.
@@ -142,35 +144,37 @@ During merging, the number of sectors allocated gets smaller and
142smaller. Merging has finished when the number of sectors holding data 144smaller. Merging has finished when the number of sectors holding data
143is zero, in other words <sectors_allocated> == <metadata_sectors>. 145is zero, in other words <sectors_allocated> == <metadata_sectors>.
144 146
145Here is a practical example (using a hybrid of lvm and dmsetup commands): 147Here is a practical example (using a hybrid of lvm and dmsetup commands)::
146 148
147# lvs 149 # lvs
148 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 150 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
149 base volumeGroup owi-a- 4.00g 151 base volumeGroup owi-a- 4.00g
150 snap volumeGroup swi-a- 1.00g base 18.97 152 snap volumeGroup swi-a- 1.00g base 18.97
151 153
152# dmsetup status volumeGroup-snap 154 # dmsetup status volumeGroup-snap
1530 8388608 snapshot 397896/2097152 1560 155 0 8388608 snapshot 397896/2097152 1560
154 ^^^^ metadata sectors 156 ^^^^ metadata sectors
155 157
156# lvconvert --merge -b volumeGroup/snap 158 # lvconvert --merge -b volumeGroup/snap
157 Merging of volume snap started. 159 Merging of volume snap started.
158 160
159# lvs volumeGroup/snap 161 # lvs volumeGroup/snap
160 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 162 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
161 base volumeGroup Owi-a- 4.00g 17.23 163 base volumeGroup Owi-a- 4.00g 17.23
162 164
163# dmsetup status volumeGroup-base 165 # dmsetup status volumeGroup-base
1640 8388608 snapshot-merge 281688/2097152 1104 166 0 8388608 snapshot-merge 281688/2097152 1104
165 167
166# dmsetup status volumeGroup-base 168 # dmsetup status volumeGroup-base
1670 8388608 snapshot-merge 180480/2097152 712 169 0 8388608 snapshot-merge 180480/2097152 712
168 170
169# dmsetup status volumeGroup-base 171 # dmsetup status volumeGroup-base
1700 8388608 snapshot-merge 16/2097152 16 172 0 8388608 snapshot-merge 16/2097152 16
171 173
172Merging has finished. 174Merging has finished.
173 175
174# lvs 176::
175 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 177
176 base volumeGroup owi-a- 4.00g 178 # lvs
179 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
180 base volumeGroup owi-a- 4.00g
diff --git a/Documentation/device-mapper/statistics.txt b/Documentation/device-mapper/statistics.rst
index 170ac02a1f50..3d80a9f850cc 100644
--- a/Documentation/device-mapper/statistics.txt
+++ b/Documentation/device-mapper/statistics.rst
@@ -1,3 +1,4 @@
1=============
1DM statistics 2DM statistics
2============= 3=============
3 4
@@ -11,7 +12,7 @@ Individual statistics will be collected for each step-sized area within
11the range specified. 12the range specified.
12 13
13The I/O statistics counters for each step-sized area of a region are 14The I/O statistics counters for each step-sized area of a region are
14in the same format as /sys/block/*/stat or /proc/diskstats (see: 15in the same format as `/sys/block/*/stat` or `/proc/diskstats` (see:
15Documentation/iostats.txt). But two extra counters (12 and 13) are 16Documentation/iostats.txt). But two extra counters (12 and 13) are
16provided: total time spent reading and writing. When the histogram 17provided: total time spent reading and writing. When the histogram
17argument is used, the 14th parameter is reported that represents the 18argument is used, the 14th parameter is reported that represents the
@@ -32,40 +33,45 @@ on each other's data.
32The creation of DM statistics will allocate memory via kmalloc or 33The creation of DM statistics will allocate memory via kmalloc or
33fallback to using vmalloc space. At most, 1/4 of the overall system 34fallback to using vmalloc space. At most, 1/4 of the overall system
34memory may be allocated by DM statistics. The admin can see how much 35memory may be allocated by DM statistics. The admin can see how much
35memory is used by reading 36memory is used by reading:
36/sys/module/dm_mod/parameters/stats_current_allocated_bytes 37
38 /sys/module/dm_mod/parameters/stats_current_allocated_bytes
37 39
38Messages 40Messages
39======== 41========
40 42
41 @stats_create <range> <step> 43 @stats_create <range> <step> [<number_of_optional_arguments> <optional_arguments>...] [<program_id> [<aux_data>]]
42 [<number_of_optional_arguments> <optional_arguments>...]
43 [<program_id> [<aux_data>]]
44
45 Create a new region and return the region_id. 44 Create a new region and return the region_id.
46 45
47 <range> 46 <range>
48 "-" - whole device 47 "-"
49 "<start_sector>+<length>" - a range of <length> 512-byte sectors 48 whole device
50 starting with <start_sector>. 49 "<start_sector>+<length>"
50 a range of <length> 512-byte sectors
51 starting with <start_sector>.
51 52
52 <step> 53 <step>
53 "<area_size>" - the range is subdivided into areas each containing 54 "<area_size>"
54 <area_size> sectors. 55 the range is subdivided into areas each containing
55 "/<number_of_areas>" - the range is subdivided into the specified 56 <area_size> sectors.
56 number of areas. 57 "/<number_of_areas>"
58 the range is subdivided into the specified
59 number of areas.
57 60
58 <number_of_optional_arguments> 61 <number_of_optional_arguments>
59 The number of optional arguments 62 The number of optional arguments
60 63
61 <optional_arguments> 64 <optional_arguments>
62 The following optional arguments are supported 65 The following optional arguments are supported:
63 precise_timestamps - use precise timer with nanosecond resolution 66
67 precise_timestamps
68 use precise timer with nanosecond resolution
64 instead of the "jiffies" variable. When this argument is 69 instead of the "jiffies" variable. When this argument is
65 used, the resulting times are in nanoseconds instead of 70 used, the resulting times are in nanoseconds instead of
66 milliseconds. Precise timestamps are a little bit slower 71 milliseconds. Precise timestamps are a little bit slower
67 to obtain than jiffies-based timestamps. 72 to obtain than jiffies-based timestamps.
68 histogram:n1,n2,n3,n4,... - collect histogram of latencies. The 73 histogram:n1,n2,n3,n4,...
74 collect histogram of latencies. The
69 numbers n1, n2, etc are times that represent the boundaries 75 numbers n1, n2, etc are times that represent the boundaries
70 of the histogram. If precise_timestamps is not used, the 76 of the histogram. If precise_timestamps is not used, the
71 times are in milliseconds, otherwise they are in 77 times are in milliseconds, otherwise they are in
@@ -96,21 +102,18 @@ Messages
96 @stats_list message, but it doesn't use this value for anything. 102 @stats_list message, but it doesn't use this value for anything.
97 103
98 @stats_delete <region_id> 104 @stats_delete <region_id>
99
100 Delete the region with the specified id. 105 Delete the region with the specified id.
101 106
102 <region_id> 107 <region_id>
103 region_id returned from @stats_create 108 region_id returned from @stats_create
104 109
105 @stats_clear <region_id> 110 @stats_clear <region_id>
106
107 Clear all the counters except the in-flight i/o counters. 111 Clear all the counters except the in-flight i/o counters.
108 112
109 <region_id> 113 <region_id>
110 region_id returned from @stats_create 114 region_id returned from @stats_create
111 115
112 @stats_list [<program_id>] 116 @stats_list [<program_id>]
113
114 List all regions registered with @stats_create. 117 List all regions registered with @stats_create.
115 118
116 <program_id> 119 <program_id>
@@ -127,7 +130,6 @@ Messages
127 if they were specified when creating the region. 130 if they were specified when creating the region.
128 131
129 @stats_print <region_id> [<starting_line> <number_of_lines>] 132 @stats_print <region_id> [<starting_line> <number_of_lines>]
130
131 Print counters for each step-sized area of a region. 133 Print counters for each step-sized area of a region.
132 134
133 <region_id> 135 <region_id>
@@ -143,10 +145,11 @@ Messages
143 145
144 Output format for each step-sized area of a region: 146 Output format for each step-sized area of a region:
145 147
146 <start_sector>+<length> counters 148 <start_sector>+<length>
149 counters
147 150
148 The first 11 counters have the same meaning as 151 The first 11 counters have the same meaning as
149 /sys/block/*/stat or /proc/diskstats. 152 `/sys/block/*/stat or /proc/diskstats`.
150 153
151 Please refer to Documentation/iostats.txt for details. 154 Please refer to Documentation/iostats.txt for details.
152 155
@@ -163,11 +166,11 @@ Messages
163 11. the weighted number of milliseconds spent doing I/Os 166 11. the weighted number of milliseconds spent doing I/Os
164 167
165 Additional counters: 168 Additional counters:
169
166 12. the total time spent reading in milliseconds 170 12. the total time spent reading in milliseconds
167 13. the total time spent writing in milliseconds 171 13. the total time spent writing in milliseconds
168 172
169 @stats_print_clear <region_id> [<starting_line> <number_of_lines>] 173 @stats_print_clear <region_id> [<starting_line> <number_of_lines>]
170
171 Atomically print and then clear all the counters except the 174 Atomically print and then clear all the counters except the
172 in-flight i/o counters. Useful when the client consuming the 175 in-flight i/o counters. Useful when the client consuming the
173 statistics does not want to lose any statistics (those updated 176 statistics does not want to lose any statistics (those updated
@@ -185,7 +188,6 @@ Messages
185 If omitted, all lines are printed and then cleared. 188 If omitted, all lines are printed and then cleared.
186 189
187 @stats_set_aux <region_id> <aux_data> 190 @stats_set_aux <region_id> <aux_data>
188
189 Store auxiliary data aux_data for the specified region. 191 Store auxiliary data aux_data for the specified region.
190 192
191 <region_id> 193 <region_id>
@@ -201,23 +203,23 @@ Examples
201======== 203========
202 204
203Subdivide the DM device 'vol' into 100 pieces and start collecting 205Subdivide the DM device 'vol' into 100 pieces and start collecting
204statistics on them: 206statistics on them::
205 207
206 dmsetup message vol 0 @stats_create - /100 208 dmsetup message vol 0 @stats_create - /100
207 209
208Set the auxiliary data string to "foo bar baz" (the escape for each 210Set the auxiliary data string to "foo bar baz" (the escape for each
209space must also be escaped, otherwise the shell will consume them): 211space must also be escaped, otherwise the shell will consume them)::
210 212
211 dmsetup message vol 0 @stats_set_aux 0 foo\\ bar\\ baz 213 dmsetup message vol 0 @stats_set_aux 0 foo\\ bar\\ baz
212 214
213List the statistics: 215List the statistics::
214 216
215 dmsetup message vol 0 @stats_list 217 dmsetup message vol 0 @stats_list
216 218
217Print the statistics: 219Print the statistics::
218 220
219 dmsetup message vol 0 @stats_print 0 221 dmsetup message vol 0 @stats_print 0
220 222
221Delete the statistics: 223Delete the statistics::
222 224
223 dmsetup message vol 0 @stats_delete 0 225 dmsetup message vol 0 @stats_delete 0
diff --git a/Documentation/device-mapper/striped.rst b/Documentation/device-mapper/striped.rst
new file mode 100644
index 000000000000..e9a8da192ae1
--- /dev/null
+++ b/Documentation/device-mapper/striped.rst
@@ -0,0 +1,61 @@
1=========
2dm-stripe
3=========
4
5Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
6device across one or more underlying devices. Data is written in "chunks",
7with consecutive chunks rotating among the underlying devices. This can
8potentially provide improved I/O throughput by utilizing several physical
9devices in parallel.
10
11Parameters: <num devs> <chunk size> [<dev path> <offset>]+
12 <num devs>:
13 Number of underlying devices.
14 <chunk size>:
15 Size of each chunk of data. Must be at least as
16 large as the system's PAGE_SIZE.
17 <dev path>:
18 Full pathname to the underlying block-device, or a
19 "major:minor" device-number.
20 <offset>:
21 Starting sector within the device.
22
23One or more underlying devices can be specified. The striped device size must
24be a multiple of the chunk size multiplied by the number of underlying devices.
25
26
27Example scripts
28===============
29
30::
31
32 #!/usr/bin/perl -w
33 # Create a striped device across any number of underlying devices. The device
34 # will be called "stripe_dev" and have a chunk-size of 128k.
35
36 my $chunk_size = 128 * 2;
37 my $dev_name = "stripe_dev";
38 my $num_devs = @ARGV;
39 my @devs = @ARGV;
40 my ($min_dev_size, $stripe_dev_size, $i);
41
42 if (!$num_devs) {
43 die("Specify at least one device\n");
44 }
45
46 $min_dev_size = `blockdev --getsz $devs[0]`;
47 for ($i = 1; $i < $num_devs; $i++) {
48 my $this_size = `blockdev --getsz $devs[$i]`;
49 $min_dev_size = ($min_dev_size < $this_size) ?
50 $min_dev_size : $this_size;
51 }
52
53 $stripe_dev_size = $min_dev_size * $num_devs;
54 $stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
55
56 $table = "0 $stripe_dev_size striped $num_devs $chunk_size";
57 for ($i = 0; $i < $num_devs; $i++) {
58 $table .= " $devs[$i] 0";
59 }
60
61 `echo $table | dmsetup create $dev_name`;
diff --git a/Documentation/device-mapper/striped.txt b/Documentation/device-mapper/striped.txt
deleted file mode 100644
index 07ec492cceee..000000000000
--- a/Documentation/device-mapper/striped.txt
+++ /dev/null
@@ -1,57 +0,0 @@
1dm-stripe
2=========
3
4Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
5device across one or more underlying devices. Data is written in "chunks",
6with consecutive chunks rotating among the underlying devices. This can
7potentially provide improved I/O throughput by utilizing several physical
8devices in parallel.
9
10Parameters: <num devs> <chunk size> [<dev path> <offset>]+
11 <num devs>: Number of underlying devices.
12 <chunk size>: Size of each chunk of data. Must be at least as
13 large as the system's PAGE_SIZE.
14 <dev path>: Full pathname to the underlying block-device, or a
15 "major:minor" device-number.
16 <offset>: Starting sector within the device.
17
18One or more underlying devices can be specified. The striped device size must
19be a multiple of the chunk size multiplied by the number of underlying devices.
20
21
22Example scripts
23===============
24
25[[
26#!/usr/bin/perl -w
27# Create a striped device across any number of underlying devices. The device
28# will be called "stripe_dev" and have a chunk-size of 128k.
29
30my $chunk_size = 128 * 2;
31my $dev_name = "stripe_dev";
32my $num_devs = @ARGV;
33my @devs = @ARGV;
34my ($min_dev_size, $stripe_dev_size, $i);
35
36if (!$num_devs) {
37 die("Specify at least one device\n");
38}
39
40$min_dev_size = `blockdev --getsz $devs[0]`;
41for ($i = 1; $i < $num_devs; $i++) {
42 my $this_size = `blockdev --getsz $devs[$i]`;
43 $min_dev_size = ($min_dev_size < $this_size) ?
44 $min_dev_size : $this_size;
45}
46
47$stripe_dev_size = $min_dev_size * $num_devs;
48$stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
49
50$table = "0 $stripe_dev_size striped $num_devs $chunk_size";
51for ($i = 0; $i < $num_devs; $i++) {
52 $table .= " $devs[$i] 0";
53}
54
55`echo $table | dmsetup create $dev_name`;
56]]
57
diff --git a/Documentation/device-mapper/switch.txt b/Documentation/device-mapper/switch.rst
index 5bd4831db4a8..7dde06be1a4f 100644
--- a/Documentation/device-mapper/switch.txt
+++ b/Documentation/device-mapper/switch.rst
@@ -1,3 +1,4 @@
1=========
1dm-switch 2dm-switch
2========= 3=========
3 4
@@ -67,27 +68,25 @@ b-tree can achieve.
67Construction Parameters 68Construction Parameters
68======================= 69=======================
69 70
70 <num_paths> <region_size> <num_optional_args> [<optional_args>...] 71 <num_paths> <region_size> <num_optional_args> [<optional_args>...] [<dev_path> <offset>]+
71 [<dev_path> <offset>]+ 72 <num_paths>
72 73 The number of paths across which to distribute the I/O.
73<num_paths>
74 The number of paths across which to distribute the I/O.
75 74
76<region_size> 75 <region_size>
77 The number of 512-byte sectors in a region. Each region can be redirected 76 The number of 512-byte sectors in a region. Each region can be redirected
78 to any of the available paths. 77 to any of the available paths.
79 78
80<num_optional_args> 79 <num_optional_args>
81 The number of optional arguments. Currently, no optional arguments 80 The number of optional arguments. Currently, no optional arguments
82 are supported and so this must be zero. 81 are supported and so this must be zero.
83 82
84<dev_path> 83 <dev_path>
85 The block device that represents a specific path to the device. 84 The block device that represents a specific path to the device.
86 85
87<offset> 86 <offset>
88 The offset of the start of data on the specific <dev_path> (in units 87 The offset of the start of data on the specific <dev_path> (in units
89 of 512-byte sectors). This number is added to the sector number when 88 of 512-byte sectors). This number is added to the sector number when
90 forwarding the request to the specific path. Typically it is zero. 89 forwarding the request to the specific path. Typically it is zero.
91 90
92Messages 91Messages
93======== 92========
@@ -122,17 +121,21 @@ Example
122Assume that you have volumes vg1/switch0 vg1/switch1 vg1/switch2 with 121Assume that you have volumes vg1/switch0 vg1/switch1 vg1/switch2 with
123the same size. 122the same size.
124 123
125Create a switch device with 64kB region size: 124Create a switch device with 64kB region size::
125
126 dmsetup create switch --table "0 `blockdev --getsz /dev/vg1/switch0` 126 dmsetup create switch --table "0 `blockdev --getsz /dev/vg1/switch0`
127 switch 3 128 0 /dev/vg1/switch0 0 /dev/vg1/switch1 0 /dev/vg1/switch2 0" 127 switch 3 128 0 /dev/vg1/switch0 0 /dev/vg1/switch1 0 /dev/vg1/switch2 0"
128 128
129Set mappings for the first 7 entries to point to devices switch0, switch1, 129Set mappings for the first 7 entries to point to devices switch0, switch1,
130switch2, switch0, switch1, switch2, switch1: 130switch2, switch0, switch1, switch2, switch1::
131
131 dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1 132 dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1
132 133
133Set repetitive mapping. This command: 134Set repetitive mapping. This command::
135
134 dmsetup message switch 0 set_region_mappings 1000:1 :2 R2,10 136 dmsetup message switch 0 set_region_mappings 1000:1 :2 R2,10
135is equivalent to: 137
138is equivalent to::
139
136 dmsetup message switch 0 set_region_mappings 1000:1 :2 :1 :2 :1 :2 :1 :2 \ 140 dmsetup message switch 0 set_region_mappings 1000:1 :2 :1 :2 :1 :2 :1 :2 \
137 :1 :2 :1 :2 :1 :2 :1 :2 :1 :2 141 :1 :2 :1 :2 :1 :2 :1 :2 :1 :2
138
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.rst
index 883e7ca5f745..bafebf79da4b 100644
--- a/Documentation/device-mapper/thin-provisioning.txt
+++ b/Documentation/device-mapper/thin-provisioning.rst
@@ -1,3 +1,7 @@
1=================
2Thin provisioning
3=================
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -95,6 +99,8 @@ previously.)
95Using an existing pool device 99Using an existing pool device
96----------------------------- 100-----------------------------
97 101
102::
103
98 dmsetup create pool \ 104 dmsetup create pool \
99 --table "0 20971520 thin-pool $metadata_dev $data_dev \ 105 --table "0 20971520 thin-pool $metadata_dev $data_dev \
100 $data_block_size $low_water_mark" 106 $data_block_size $low_water_mark"
@@ -154,7 +160,7 @@ Thin provisioning
154i) Creating a new thinly-provisioned volume. 160i) Creating a new thinly-provisioned volume.
155 161
156 To create a new thinly- provisioned volume you must send a message to an 162 To create a new thinly- provisioned volume you must send a message to an
157 active pool device, /dev/mapper/pool in this example. 163 active pool device, /dev/mapper/pool in this example::
158 164
159 dmsetup message /dev/mapper/pool 0 "create_thin 0" 165 dmsetup message /dev/mapper/pool 0 "create_thin 0"
160 166
@@ -164,7 +170,7 @@ i) Creating a new thinly-provisioned volume.
164 170
165ii) Using a thinly-provisioned volume. 171ii) Using a thinly-provisioned volume.
166 172
167 Thinly-provisioned volumes are activated using the 'thin' target: 173 Thinly-provisioned volumes are activated using the 'thin' target::
168 174
169 dmsetup create thin --table "0 2097152 thin /dev/mapper/pool 0" 175 dmsetup create thin --table "0 2097152 thin /dev/mapper/pool 0"
170 176
@@ -181,6 +187,8 @@ i) Creating an internal snapshot.
181 must suspend it before creating the snapshot to avoid corruption. 187 must suspend it before creating the snapshot to avoid corruption.
182 This is NOT enforced at the moment, so please be careful! 188 This is NOT enforced at the moment, so please be careful!
183 189
190 ::
191
184 dmsetup suspend /dev/mapper/thin 192 dmsetup suspend /dev/mapper/thin
185 dmsetup message /dev/mapper/pool 0 "create_snap 1 0" 193 dmsetup message /dev/mapper/pool 0 "create_snap 1 0"
186 dmsetup resume /dev/mapper/thin 194 dmsetup resume /dev/mapper/thin
@@ -198,14 +206,14 @@ ii) Using an internal snapshot.
198 activating or removing them both. (This differs from conventional 206 activating or removing them both. (This differs from conventional
199 device-mapper snapshots.) 207 device-mapper snapshots.)
200 208
201 Activate it exactly the same way as any other thinly-provisioned volume: 209 Activate it exactly the same way as any other thinly-provisioned volume::
202 210
203 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1" 211 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1"
204 212
205External snapshots 213External snapshots
206------------------ 214------------------
207 215
208You can use an external _read only_ device as an origin for a 216You can use an external **read only** device as an origin for a
209thinly-provisioned volume. Any read to an unprovisioned area of the 217thinly-provisioned volume. Any read to an unprovisioned area of the
210thin device will be passed through to the origin. Writes trigger 218thin device will be passed through to the origin. Writes trigger
211the allocation of new blocks as usual. 219the allocation of new blocks as usual.
@@ -223,11 +231,13 @@ i) Creating a snapshot of an external device
223 This is the same as creating a thin device. 231 This is the same as creating a thin device.
224 You don't mention the origin at this stage. 232 You don't mention the origin at this stage.
225 233
234 ::
235
226 dmsetup message /dev/mapper/pool 0 "create_thin 0" 236 dmsetup message /dev/mapper/pool 0 "create_thin 0"
227 237
228ii) Using a snapshot of an external device. 238ii) Using a snapshot of an external device.
229 239
230 Append an extra parameter to the thin target specifying the origin: 240 Append an extra parameter to the thin target specifying the origin::
231 241
232 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 0 /dev/image" 242 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 0 /dev/image"
233 243
@@ -240,6 +250,8 @@ Deactivation
240All devices using a pool must be deactivated before the pool itself 250All devices using a pool must be deactivated before the pool itself
241can be. 251can be.
242 252
253::
254
243 dmsetup remove thin 255 dmsetup remove thin
244 dmsetup remove snap 256 dmsetup remove snap
245 dmsetup remove pool 257 dmsetup remove pool
@@ -252,25 +264,32 @@ Reference
252 264
253i) Constructor 265i) Constructor
254 266
255 thin-pool <metadata dev> <data dev> <data block size (sectors)> \ 267 ::
256 <low water mark (blocks)> [<number of feature args> [<arg>]*] 268
269 thin-pool <metadata dev> <data dev> <data block size (sectors)> \
270 <low water mark (blocks)> [<number of feature args> [<arg>]*]
257 271
258 Optional feature arguments: 272 Optional feature arguments:
259 273
260 skip_block_zeroing: Skip the zeroing of newly-provisioned blocks. 274 skip_block_zeroing:
275 Skip the zeroing of newly-provisioned blocks.
261 276
262 ignore_discard: Disable discard support. 277 ignore_discard:
278 Disable discard support.
263 279
264 no_discard_passdown: Don't pass discards down to the underlying 280 no_discard_passdown:
265 data device, but just remove the mapping. 281 Don't pass discards down to the underlying
282 data device, but just remove the mapping.
266 283
267 read_only: Don't allow any changes to be made to the pool 284 read_only:
285 Don't allow any changes to be made to the pool
268 metadata. This mode is only available after the 286 metadata. This mode is only available after the
269 thin-pool has been created and first used in full 287 thin-pool has been created and first used in full
270 read/write mode. It cannot be specified on initial 288 read/write mode. It cannot be specified on initial
271 thin-pool creation. 289 thin-pool creation.
272 290
273 error_if_no_space: Error IOs, instead of queueing, if no space. 291 error_if_no_space:
292 Error IOs, instead of queueing, if no space.
274 293
275 Data block size must be between 64KB (128 sectors) and 1GB 294 Data block size must be between 64KB (128 sectors) and 1GB
276 (2097152 sectors) inclusive. 295 (2097152 sectors) inclusive.
@@ -278,10 +297,12 @@ i) Constructor
278 297
279ii) Status 298ii) Status
280 299
281 <transaction id> <used metadata blocks>/<total metadata blocks> 300 ::
282 <used data blocks>/<total data blocks> <held metadata root> 301
283 ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space 302 <transaction id> <used metadata blocks>/<total metadata blocks>
284 needs_check|- metadata_low_watermark 303 <used data blocks>/<total data blocks> <held metadata root>
304 ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space
305 needs_check|- metadata_low_watermark
285 306
286 transaction id: 307 transaction id:
287 A 64-bit number used by userspace to help synchronise with metadata 308 A 64-bit number used by userspace to help synchronise with metadata
@@ -336,13 +357,11 @@ ii) Status
336iii) Messages 357iii) Messages
337 358
338 create_thin <dev id> 359 create_thin <dev id>
339
340 Create a new thinly-provisioned device. 360 Create a new thinly-provisioned device.
341 <dev id> is an arbitrary unique 24-bit identifier chosen by 361 <dev id> is an arbitrary unique 24-bit identifier chosen by
342 the caller. 362 the caller.
343 363
344 create_snap <dev id> <origin id> 364 create_snap <dev id> <origin id>
345
346 Create a new snapshot of another thinly-provisioned device. 365 Create a new snapshot of another thinly-provisioned device.
347 <dev id> is an arbitrary unique 24-bit identifier chosen by 366 <dev id> is an arbitrary unique 24-bit identifier chosen by
348 the caller. 367 the caller.
@@ -350,11 +369,9 @@ iii) Messages
350 of which the new device will be a snapshot. 369 of which the new device will be a snapshot.
351 370
352 delete <dev id> 371 delete <dev id>
353
354 Deletes a thin device. Irreversible. 372 Deletes a thin device. Irreversible.
355 373
356 set_transaction_id <current id> <new id> 374 set_transaction_id <current id> <new id>
357
358 Userland volume managers, such as LVM, need a way to 375 Userland volume managers, such as LVM, need a way to
359 synchronise their external metadata with the internal metadata of the 376 synchronise their external metadata with the internal metadata of the
360 pool target. The thin-pool target offers to store an 377 pool target. The thin-pool target offers to store an
@@ -364,14 +381,12 @@ iii) Messages
364 compare-and-swap message. 381 compare-and-swap message.
365 382
366 reserve_metadata_snap 383 reserve_metadata_snap
367
368 Reserve a copy of the data mapping btree for use by userland. 384 Reserve a copy of the data mapping btree for use by userland.
369 This allows userland to inspect the mappings as they were when 385 This allows userland to inspect the mappings as they were when
370 this message was executed. Use the pool's status command to 386 this message was executed. Use the pool's status command to
371 get the root block associated with the metadata snapshot. 387 get the root block associated with the metadata snapshot.
372 388
373 release_metadata_snap 389 release_metadata_snap
374
375 Release a previously reserved copy of the data mapping btree. 390 Release a previously reserved copy of the data mapping btree.
376 391
377'thin' target 392'thin' target
@@ -379,7 +394,9 @@ iii) Messages
379 394
380i) Constructor 395i) Constructor
381 396
382 thin <pool dev> <dev id> [<external origin dev>] 397 ::
398
399 thin <pool dev> <dev id> [<external origin dev>]
383 400
384 pool dev: 401 pool dev:
385 the thin-pool device, e.g. /dev/mapper/my_pool or 253:0 402 the thin-pool device, e.g. /dev/mapper/my_pool or 253:0
@@ -401,8 +418,7 @@ provisioned as and when needed.
401 418
402ii) Status 419ii) Status
403 420
404 <nr mapped sectors> <highest mapped sector> 421 <nr mapped sectors> <highest mapped sector>
405
406 If the pool has encountered device errors and failed, the status 422 If the pool has encountered device errors and failed, the status
407 will just contain the string 'Fail'. The userspace recovery 423 will just contain the string 'Fail'. The userspace recovery
408 tools should then be used. 424 tools should then be used.
diff --git a/Documentation/device-mapper/unstriped.txt b/Documentation/device-mapper/unstriped.rst
index 0b2a306c54ee..0a8d3eb3f072 100644
--- a/Documentation/device-mapper/unstriped.txt
+++ b/Documentation/device-mapper/unstriped.rst
@@ -1,3 +1,7 @@
1================================
2Device-mapper "unstriped" target
3================================
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -34,46 +38,46 @@ striped target to combine the 4 devices into one. It then will use
34the unstriped target ontop of the striped device to access the 38the unstriped target ontop of the striped device to access the
35individual backing loop devices. We write data to the newly exposed 39individual backing loop devices. We write data to the newly exposed
36unstriped devices and verify the data written matches the correct 40unstriped devices and verify the data written matches the correct
37underlying device on the striped array. 41underlying device on the striped array::
38 42
39#!/bin/bash 43 #!/bin/bash
40 44
41MEMBER_SIZE=$((128 * 1024 * 1024)) 45 MEMBER_SIZE=$((128 * 1024 * 1024))
42NUM=4 46 NUM=4
43SEQ_END=$((${NUM}-1)) 47 SEQ_END=$((${NUM}-1))
44CHUNK=256 48 CHUNK=256
45BS=4096 49 BS=4096
46 50
47RAID_SIZE=$((${MEMBER_SIZE}*${NUM}/512)) 51 RAID_SIZE=$((${MEMBER_SIZE}*${NUM}/512))
48DM_PARMS="0 ${RAID_SIZE} striped ${NUM} ${CHUNK}" 52 DM_PARMS="0 ${RAID_SIZE} striped ${NUM} ${CHUNK}"
49COUNT=$((${MEMBER_SIZE} / ${BS})) 53 COUNT=$((${MEMBER_SIZE} / ${BS}))
50 54
51for i in $(seq 0 ${SEQ_END}); do 55 for i in $(seq 0 ${SEQ_END}); do
52 dd if=/dev/zero of=member-${i} bs=${MEMBER_SIZE} count=1 oflag=direct 56 dd if=/dev/zero of=member-${i} bs=${MEMBER_SIZE} count=1 oflag=direct
53 losetup /dev/loop${i} member-${i} 57 losetup /dev/loop${i} member-${i}
54 DM_PARMS+=" /dev/loop${i} 0" 58 DM_PARMS+=" /dev/loop${i} 0"
55done 59 done
56 60
57echo $DM_PARMS | dmsetup create raid0 61 echo $DM_PARMS | dmsetup create raid0
58for i in $(seq 0 ${SEQ_END}); do 62 for i in $(seq 0 ${SEQ_END}); do
59 echo "0 1 unstriped ${NUM} ${CHUNK} ${i} /dev/mapper/raid0 0" | dmsetup create set-${i} 63 echo "0 1 unstriped ${NUM} ${CHUNK} ${i} /dev/mapper/raid0 0" | dmsetup create set-${i}
60done; 64 done;
61 65
62for i in $(seq 0 ${SEQ_END}); do 66 for i in $(seq 0 ${SEQ_END}); do
63 dd if=/dev/urandom of=/dev/mapper/set-${i} bs=${BS} count=${COUNT} oflag=direct 67 dd if=/dev/urandom of=/dev/mapper/set-${i} bs=${BS} count=${COUNT} oflag=direct
64 diff /dev/mapper/set-${i} member-${i} 68 diff /dev/mapper/set-${i} member-${i}
65done; 69 done;
66 70
67for i in $(seq 0 ${SEQ_END}); do 71 for i in $(seq 0 ${SEQ_END}); do
68 dmsetup remove set-${i} 72 dmsetup remove set-${i}
69done 73 done
70 74
71dmsetup remove raid0 75 dmsetup remove raid0
72 76
73for i in $(seq 0 ${SEQ_END}); do 77 for i in $(seq 0 ${SEQ_END}); do
74 losetup -d /dev/loop${i} 78 losetup -d /dev/loop${i}
75 rm -f member-${i} 79 rm -f member-${i}
76done 80 done
77 81
78Another example 82Another example
79--------------- 83---------------
@@ -81,7 +85,7 @@ Another example
81Intel NVMe drives contain two cores on the physical device. 85Intel NVMe drives contain two cores on the physical device.
82Each core of the drive has segregated access to its LBA range. 86Each core of the drive has segregated access to its LBA range.
83The current LBA model has a RAID 0 128k chunk on each core, resulting 87The current LBA model has a RAID 0 128k chunk on each core, resulting
84in a 256k stripe across the two cores: 88in a 256k stripe across the two cores::
85 89
86 Core 0: Core 1: 90 Core 0: Core 1:
87 __________ __________ 91 __________ __________
@@ -108,17 +112,24 @@ Example dmsetup usage
108 112
109unstriped ontop of Intel NVMe device that has 2 cores 113unstriped ontop of Intel NVMe device that has 2 cores
110----------------------------------------------------- 114-----------------------------------------------------
111dmsetup create nvmset0 --table '0 512 unstriped 2 256 0 /dev/nvme0n1 0' 115
112dmsetup create nvmset1 --table '0 512 unstriped 2 256 1 /dev/nvme0n1 0' 116::
117
118 dmsetup create nvmset0 --table '0 512 unstriped 2 256 0 /dev/nvme0n1 0'
119 dmsetup create nvmset1 --table '0 512 unstriped 2 256 1 /dev/nvme0n1 0'
113 120
114There will now be two devices that expose Intel NVMe core 0 and 1 121There will now be two devices that expose Intel NVMe core 0 and 1
115respectively: 122respectively::
116/dev/mapper/nvmset0 123
117/dev/mapper/nvmset1 124 /dev/mapper/nvmset0
125 /dev/mapper/nvmset1
118 126
119unstriped ontop of striped with 4 drives using 128K chunk size 127unstriped ontop of striped with 4 drives using 128K chunk size
120-------------------------------------------------------------- 128--------------------------------------------------------------
121dmsetup create raid_disk0 --table '0 512 unstriped 4 256 0 /dev/mapper/striped 0' 129
122dmsetup create raid_disk1 --table '0 512 unstriped 4 256 1 /dev/mapper/striped 0' 130::
123dmsetup create raid_disk2 --table '0 512 unstriped 4 256 2 /dev/mapper/striped 0' 131
124dmsetup create raid_disk3 --table '0 512 unstriped 4 256 3 /dev/mapper/striped 0' 132 dmsetup create raid_disk0 --table '0 512 unstriped 4 256 0 /dev/mapper/striped 0'
133 dmsetup create raid_disk1 --table '0 512 unstriped 4 256 1 /dev/mapper/striped 0'
134 dmsetup create raid_disk2 --table '0 512 unstriped 4 256 2 /dev/mapper/striped 0'
135 dmsetup create raid_disk3 --table '0 512 unstriped 4 256 3 /dev/mapper/striped 0'
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.rst
index b3d2e4a42255..a4d1c1476d72 100644
--- a/Documentation/device-mapper/verity.txt
+++ b/Documentation/device-mapper/verity.rst
@@ -1,5 +1,6 @@
1=========
1dm-verity 2dm-verity
2========== 3=========
3 4
4Device-Mapper's "verity" target provides transparent integrity checking of 5Device-Mapper's "verity" target provides transparent integrity checking of
5block devices using a cryptographic digest provided by the kernel crypto API. 6block devices using a cryptographic digest provided by the kernel crypto API.
@@ -7,6 +8,9 @@ This target is read-only.
7 8
8Construction Parameters 9Construction Parameters
9======================= 10=======================
11
12::
13
10 <version> <dev> <hash_dev> 14 <version> <dev> <hash_dev>
11 <data_block_size> <hash_block_size> 15 <data_block_size> <hash_block_size>
12 <num_data_blocks> <hash_start_block> 16 <num_data_blocks> <hash_start_block>
@@ -160,7 +164,9 @@ calculating the parent node.
160 164
161The tree looks something like: 165The tree looks something like:
162 166
163alg = sha256, num_blocks = 32768, block_size = 4096 167 alg = sha256, num_blocks = 32768, block_size = 4096
168
169::
164 170
165 [ root ] 171 [ root ]
166 / . . . \ 172 / . . . \
@@ -189,6 +195,7 @@ block boundary) are the hash blocks which are stored a depth at a time
189 195
190The full specification of kernel parameters and on-disk metadata format 196The full specification of kernel parameters and on-disk metadata format
191is available at the cryptsetup project's wiki page 197is available at the cryptsetup project's wiki page
198
192 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity 199 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity
193 200
194Status 201Status
@@ -198,7 +205,8 @@ If any check failed, C (for Corruption) is returned.
198 205
199Example 206Example
200======= 207=======
201Set up a device: 208Set up a device::
209
202 # dmsetup create vroot --readonly --table \ 210 # dmsetup create vroot --readonly --table \
203 "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\ 211 "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\
204 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ 212 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\
@@ -209,11 +217,13 @@ the hash tree or activate the kernel device. This is available from
209the cryptsetup upstream repository https://gitlab.com/cryptsetup/cryptsetup/ 217the cryptsetup upstream repository https://gitlab.com/cryptsetup/cryptsetup/
210(as a libcryptsetup extension). 218(as a libcryptsetup extension).
211 219
212Create hash on the device: 220Create hash on the device::
221
213 # veritysetup format /dev/sda1 /dev/sda2 222 # veritysetup format /dev/sda1 /dev/sda2
214 ... 223 ...
215 Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 224 Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
216 225
217Activate the device: 226Activate the device::
227
218 # veritysetup create vroot /dev/sda1 /dev/sda2 \ 228 # veritysetup create vroot /dev/sda1 /dev/sda2 \
219 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 229 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
diff --git a/Documentation/device-mapper/writecache.txt b/Documentation/device-mapper/writecache.rst
index 01532b3008ae..d3d7690f5e8d 100644
--- a/Documentation/device-mapper/writecache.txt
+++ b/Documentation/device-mapper/writecache.rst
@@ -1,3 +1,7 @@
1=================
2Writecache target
3=================
4
1The writecache target caches writes on persistent memory or on SSD. It 5The writecache target caches writes on persistent memory or on SSD. It
2doesn't cache reads because reads are supposed to be cached in page cache 6doesn't cache reads because reads are supposed to be cached in page cache
3in normal RAM. 7in normal RAM.
@@ -6,15 +10,18 @@ When the device is constructed, the first sector should be zeroed or the
6first sector should contain valid superblock from previous invocation. 10first sector should contain valid superblock from previous invocation.
7 11
8Constructor parameters: 12Constructor parameters:
13
91. type of the cache device - "p" or "s" 141. type of the cache device - "p" or "s"
10 p - persistent memory 15
11 s - SSD 16 - p - persistent memory
17 - s - SSD
122. the underlying device that will be cached 182. the underlying device that will be cached
133. the cache device 193. the cache device
144. block size (4096 is recommended; the maximum block size is the page 204. block size (4096 is recommended; the maximum block size is the page
15 size) 21 size)
165. the number of optional parameters (the parameters with an argument 225. the number of optional parameters (the parameters with an argument
17 count as two) 23 count as two)
24
18 start_sector n (default: 0) 25 start_sector n (default: 0)
19 offset from the start of cache device in 512-byte sectors 26 offset from the start of cache device in 512-byte sectors
20 high_watermark n (default: 50) 27 high_watermark n (default: 50)
@@ -43,6 +50,7 @@ Constructor parameters:
43 applicable only to persistent memory - don't use the FUA 50 applicable only to persistent memory - don't use the FUA
44 flag when writing back data and send the FLUSH request 51 flag when writing back data and send the FLUSH request
45 afterwards 52 afterwards
53
46 - some underlying devices perform better with fua, some 54 - some underlying devices perform better with fua, some
47 with nofua. The user should test it 55 with nofua. The user should test it
48 56
@@ -60,6 +68,7 @@ Messages:
60 flush the cache device on next suspend. Use this message 68 flush the cache device on next suspend. Use this message
61 when you are going to remove the cache device. The proper 69 when you are going to remove the cache device. The proper
62 sequence for removing the cache device is: 70 sequence for removing the cache device is:
71
63 1. send the "flush_on_suspend" message 72 1. send the "flush_on_suspend" message
64 2. load an inactive table with a linear target that maps 73 2. load an inactive table with a linear target that maps
65 to the underlying device 74 to the underlying device
diff --git a/Documentation/device-mapper/zero.txt b/Documentation/device-mapper/zero.rst
index 20fb38e7fa7e..11fb5cf4597c 100644
--- a/Documentation/device-mapper/zero.txt
+++ b/Documentation/device-mapper/zero.rst
@@ -1,3 +1,4 @@
1=======
1dm-zero 2dm-zero
2======= 3=======
3 4
@@ -18,20 +19,19 @@ filesystem limitations.
18 19
19To create a sparse device, start by creating a dm-zero device that's the 20To create a sparse device, start by creating a dm-zero device that's the
20desired size of the sparse device. For this example, we'll assume a 10TB 21desired size of the sparse device. For this example, we'll assume a 10TB
21sparse device. 22sparse device::
22 23
23TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors 24 TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors
24echo "0 $TEN_TERABYTES zero" | dmsetup create zero1 25 echo "0 $TEN_TERABYTES zero" | dmsetup create zero1
25 26
26Then create a snapshot of the zero device, using any available block-device as 27Then create a snapshot of the zero device, using any available block-device as
27the COW device. The size of the COW device will determine the amount of real 28the COW device. The size of the COW device will determine the amount of real
28space available to the sparse device. For this example, we'll assume /dev/sdb1 29space available to the sparse device. For this example, we'll assume /dev/sdb1
29is an available 10GB partition. 30is an available 10GB partition::
30 31
31echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \ 32 echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \
32 dmsetup create sparse1 33 dmsetup create sparse1
33 34
34This will create a 10TB sparse device called /dev/mapper/sparse1 that has 35This will create a 10TB sparse device called /dev/mapper/sparse1 that has
3510GB of actual storage space available. If more than 10GB of data is written 3610GB of actual storage space available. If more than 10GB of data is written
36to this device, it will start returning I/O errors. 37to this device, it will start returning I/O errors.
37
diff --git a/Documentation/filesystems/ubifs-authentication.md b/Documentation/filesystems/ubifs-authentication.md
index 028b3e2e25f9..23e698167141 100644
--- a/Documentation/filesystems/ubifs-authentication.md
+++ b/Documentation/filesystems/ubifs-authentication.md
@@ -417,9 +417,9 @@ will then have to be provided beforehand in the normal way.
417 417
418[DMC-CBC-ATTACK] http://www.jakoblell.com/blog/2013/12/22/practical-malleability-attack-against-cbc-encrypted-luks-partitions/ 418[DMC-CBC-ATTACK] http://www.jakoblell.com/blog/2013/12/22/practical-malleability-attack-against-cbc-encrypted-luks-partitions/
419 419
420[DM-INTEGRITY] https://www.kernel.org/doc/Documentation/device-mapper/dm-integrity.txt 420[DM-INTEGRITY] https://www.kernel.org/doc/Documentation/device-mapper/dm-integrity.rst
421 421
422[DM-VERITY] https://www.kernel.org/doc/Documentation/device-mapper/verity.txt 422[DM-VERITY] https://www.kernel.org/doc/Documentation/device-mapper/verity.rst
423 423
424[FSCRYPT-POLICY2] https://www.spinics.net/lists/linux-ext4/msg58710.html 424[FSCRYPT-POLICY2] https://www.spinics.net/lists/linux-ext4/msg58710.html
425 425
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 45254b3ef715..5ccac0b77f17 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -453,7 +453,7 @@ config DM_INIT
453 Enable "dm-mod.create=" parameter to create mapped devices at init time. 453 Enable "dm-mod.create=" parameter to create mapped devices at init time.
454 This option is useful to allow mounting rootfs without requiring an 454 This option is useful to allow mounting rootfs without requiring an
455 initramfs. 455 initramfs.
456 See Documentation/device-mapper/dm-init.txt for dm-mod.create="..." 456 See Documentation/device-mapper/dm-init.rst for dm-mod.create="..."
457 format. 457 format.
458 458
459 If unsure, say N. 459 If unsure, say N.
diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
index 352e803f566e..a58d0944f592 100644
--- a/drivers/md/dm-init.c
+++ b/drivers/md/dm-init.c
@@ -25,7 +25,7 @@ static char *create;
25 * Format: dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+] 25 * Format: dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
26 * Table format: <start_sector> <num_sectors> <target_type> <target_args> 26 * Table format: <start_sector> <num_sectors> <target_type> <target_args>
27 * 27 *
28 * See Documentation/device-mapper/dm-init.txt for dm-mod.create="..." format 28 * See Documentation/device-mapper/dm-init.rst for dm-mod.create="..." format
29 * details. 29 * details.
30 */ 30 */
31 31
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9fdef6897316..7a87a640f8ba 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3558,7 +3558,7 @@ static void raid_status(struct dm_target *ti, status_type_t type,
3558 * v1.5.0+: 3558 * v1.5.0+:
3559 * 3559 *
3560 * Sync action: 3560 * Sync action:
3561 * See Documentation/device-mapper/dm-raid.txt for 3561 * See Documentation/device-mapper/dm-raid.rst for
3562 * information on each of these states. 3562 * information on each of these states.
3563 */ 3563 */
3564 DMEMIT(" %s", sync_action); 3564 DMEMIT(" %s", sync_action);