Skip to content

Commit 26b9f22

Browse files
Heinz MauelshagenLinus Torvalds
authored andcommitted
dm: delay target
New device-mapper target that can delay I/O (for testing). Reads can be separated from writes, redirected to different underlying devices and delayed by differing amounts of time. Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Milan Broz <[email protected]> Signed-off-by: Alasdair G Kergon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 0ba6993 commit 26b9f22

File tree

4 files changed

+419
-0
lines changed

4 files changed

+419
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
dm-delay
2+
========
3+
4+
Device-Mapper's "delay" target delays reads and/or writes
5+
and maps them to different devices.
6+
7+
Parameters:
8+
<device> <offset> <delay> [<write_device> <write_offset> <write_delay>]
9+
10+
With separate write parameters, the first set is only used for reads.
11+
Delays are specified in milliseconds.
12+
13+
Example scripts
14+
===============
15+
[[
16+
#!/bin/sh
17+
# Create device delaying rw operation for 500ms
18+
echo "0 `blockdev --getsize $1` delay $1 0 500" | dmsetup create delayed
19+
]]
20+
21+
[[
22+
#!/bin/sh
23+
# Create device delaying only write operation for 500ms and
24+
# splitting reads and writes to different devices $1 $2
25+
echo "0 `blockdev --getsize $1` delay $1 0 0 $2 0 500" | dmsetup create delayed
26+
]]

drivers/md/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ config DM_MULTIPATH_EMC
262262
---help---
263263
Multipath support for EMC CX/AX series hardware.
264264

265+
config DM_DELAY
266+
tristate "I/O delaying target (EXPERIMENTAL)"
267+
depends on BLK_DEV_DM && EXPERIMENTAL
268+
---help---
269+
A target that delays reads and/or writes and can send
270+
them to different devices. Useful for testing.
271+
272+
If unsure, say N.
273+
265274
endmenu
266275

267276
endif

drivers/md/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o
3131
obj-$(CONFIG_BLK_DEV_MD) += md-mod.o
3232
obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o
3333
obj-$(CONFIG_DM_CRYPT) += dm-crypt.o
34+
obj-$(CONFIG_DM_DELAY) += dm-delay.o
3435
obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o
3536
obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o
3637
obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o

0 commit comments

Comments
 (0)