dm-cow: copy-on-write stackable target for device-mapper
Subsystems (3)
RFC PATCH 1/1 dm-cow: copy-on-write stackable target for device-mapper
Subject: [RFC] [PATCH] dm-cow: copy-on-write stackable target for device-mapper
This is the first cut of a device-mapper target which allows stacking of multiple block devices and in which the top-layer of the stack is a copy-on-write layer. It was originally developed in support of a cluster image management solution.
Existing device mapper snapshot facilities could be used to implement stackable block devices, as they support a copy-on-write mechanism for taking snapshots of logical volumes. However, benchmarks (using bonnie++) of such solutions showed an order of magnitude performance degredation. This target was written in an attempt to provide a stacking and copy-on-write solution which would incur only a minimal overhead.
Detailed performance results will be available shortly in a technical-report available via IBM's CyberDigest website -- however, initial results obtained with bonnie++ show dramatic performance improvements.
The code within this module was developed by an intern (Gorka Guardiola) during his stay with us at IBM Research. Please direct comments both to myself and Gorka.
--- Documentation/device-mapper/dm-cow.txt | 29 + drivers/md/Kconfig | 15 + drivers/md/Makefile | 1 drivers/md/dm-cow.c | 926 ++++++++++++++++++++++++++++++++ 4 files changed, 971 insertions(+), 0 deletions(-)
Documentation/device-mapper/dm-cow.txt new file +29 -0
@@ -0,0 +1,29 @@ +This is a target for the dm-mapper which stacks +block devices. The base image B is a formatted block +device. Over that go N read only block devices R +and then 1 write device W. It does copy on write +of the devices, and reads from the appropiate device. +You start by formatting B. Then add a W on it. +W consists on two parts, a block device for the bitmap +which should start zeroed and which gets some magic number +on it the first time it is used. The you can add another +W and the first W turns into a R. WRB. and so on. + +A simple script file is included to format WB. +The way it works is the standard dmsetup calls for +the device mapper. The arguments are + +N M logdevname Bdevname Boffset Rbitmapdev Rdevname Roffset Wbitmapdev Wdevname Woffset + +N and M are the offsets on the logical device /dev/mapper/logdevname + +Bdevname is the base image device name +Boffset is the offset on the base image device +Rbitmapdev is the block device for the bitmap on a read only device + +and so on. + +a real world example of BW: + +0 8385866 cow /dev/sdb1 0 /dev/sdb2 /dev/sdb3 0 +
drivers/md/Kconfig +15 -0
@@ -261,6 +261,21 @@ config DM_MULTIPATH_EMC ---help--- Multipath support for EMC CX/AX series hardware. +config DM_COW + tristate "Copy-on-write Stackable target (EXPERIMENTAL)" + depends on BLK_DEV_DM && EXPERIMENTAL + ---help--- + This is a target for the dm-mapper which stacks + block devices. The base image B is a formatted block + device. Over that go N read only block devices R + and then 1 write device W. It does copy on write + of the devices, and reads from the appropiate device. + You start by formatting B. Then add a W on it. + W consists on two parts, a block device for the bitmap + which should start zeroed and which gets some magic number + on it the first time it is used. The you can add another + W and the first W turns into a R. WRB. and so on. + endmenu endif
drivers/md/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o obj-$(CONFIG_DM_ZERO) += dm-zero.o +obj-$(CONFIG_DM_COW) += dm-cow.o quiet_cmd_unroll = UNROLL $@ cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \
drivers/md/dm-cow.c new file +926 -0
926 lines not on this page · raw message
Signature · 1 line
1.4.1
Quoted 7 lines · Eric Van Hensbergen
Subject: [RFC] [PATCH] dm-cow: copy-on-write stackable target for device-mapper
This is the first cut of a device-mapper target which allows stacking of multiple block devices and in which the top-layer of the stack is a copy-on-write layer. It was originally developed in support of a cluster image management solution.
The paper describing our motivation for this work including some description of this implementation and performance results is now available:
-eric
Documentation/device-mapper/dm-cow.txt line 15
Quoted 7 lines · Eric Van Hensbergen
Subject: [RFC] [PATCH] dm-cow: copy-on-write stackable target for device-mapper
Documentation/device-mapper/dm-cow.txt new file +5
-0+ +A simple script file is included to format WB. +The way it works is the standard dmsetup calls for +the device mapper. The arguments are +
There have been several requests for the "simple" script file. Portions of its implementation are somewhat specific to our installation (like the use of the rc shell). I'm including it inline here - not sure where else to put it -- perhaps in the Documentation:
#!/usr/bin/rc
tableboth ='0 devblksz cow devread 0 devwrite devbmapw 0' devsize = `{sfdisk -s $1}
fn wipeoutdev{
bmapsize = `{echo $devsize / 512 /2 |bc}
echo dd 'if=/dev/zero' 'of='^$1 'count='^$bmapsize 'bs=512'
dd 'if=/dev/zero' 'of='^$1 'count='^$bmapsize 'bs=512'
}fn escapedev{
echo $1|sed 's/\//\\\//g'
}
fn setcow{
devread = `{escapedev $1}
devwrite = `{escapedev $2}
devbmapw = `{escapedev $3}
tableset = `{echo $tableboth|sed -r 's/devread/'^$devread^'/'}
tableset = `{echo $tableset|sed -r 's/devwrite/'^$devwrite^'/'}
tableset = `{echo $tableset|sed -r 's/devbmapw/'^$devbmapw^'/'}
devblksz = `{expr $devsize '*' 2}
tableset = `{echo $tableset|sed -r 's/devblksz/'^$devblksz^'/'}
echo trying to set $tableset
echo $tableset > /tmp/tableset
echo trying to dmsetup create $4
dmsetup create $4 << EOF$tableset
EOF
dmsetup table
}
if(! ~ $#* 4){
echo usage: newcow origdev destdev bmapdest namecow exit 1
}
namecow=$4
origdev=$1
wipeoutdev $2
setcow $1 $2 $3 $namecow