xref: /openbmc/linux/Documentation/admin-guide/device-mapper/delay.rst (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1*6cf2a73cSMauro Carvalho Chehab========
2*6cf2a73cSMauro Carvalho Chehabdm-delay
3*6cf2a73cSMauro Carvalho Chehab========
4*6cf2a73cSMauro Carvalho Chehab
5*6cf2a73cSMauro Carvalho ChehabDevice-Mapper's "delay" target delays reads and/or writes
6*6cf2a73cSMauro Carvalho Chehaband maps them to different devices.
7*6cf2a73cSMauro Carvalho Chehab
8*6cf2a73cSMauro Carvalho ChehabParameters::
9*6cf2a73cSMauro Carvalho Chehab
10*6cf2a73cSMauro Carvalho Chehab    <device> <offset> <delay> [<write_device> <write_offset> <write_delay>
11*6cf2a73cSMauro Carvalho Chehab			       [<flush_device> <flush_offset> <flush_delay>]]
12*6cf2a73cSMauro Carvalho Chehab
13*6cf2a73cSMauro Carvalho ChehabWith separate write parameters, the first set is only used for reads.
14*6cf2a73cSMauro Carvalho ChehabOffsets are specified in sectors.
15*6cf2a73cSMauro Carvalho ChehabDelays are specified in milliseconds.
16*6cf2a73cSMauro Carvalho Chehab
17*6cf2a73cSMauro Carvalho ChehabExample scripts
18*6cf2a73cSMauro Carvalho Chehab===============
19*6cf2a73cSMauro Carvalho Chehab
20*6cf2a73cSMauro Carvalho Chehab::
21*6cf2a73cSMauro Carvalho Chehab
22*6cf2a73cSMauro Carvalho Chehab	#!/bin/sh
23*6cf2a73cSMauro Carvalho Chehab	# Create device delaying rw operation for 500ms
24*6cf2a73cSMauro Carvalho Chehab	echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed
25*6cf2a73cSMauro Carvalho Chehab
26*6cf2a73cSMauro Carvalho Chehab::
27*6cf2a73cSMauro Carvalho Chehab
28*6cf2a73cSMauro Carvalho Chehab	#!/bin/sh
29*6cf2a73cSMauro Carvalho Chehab	# Create device delaying only write operation for 500ms and
30*6cf2a73cSMauro Carvalho Chehab	# splitting reads and writes to different devices $1 $2
31*6cf2a73cSMauro Carvalho Chehab	echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed
32