Package: writeboost
Version: 1.20160718-1

Hello,

We found that //sbin/writeboost/ doesn't work with devices in /write_around_mode/, because it is a static option and the script tries to setup wb cache without any options and then send options as sequence of dmsetup message commands.

For example we have the following //etc/writeboosttab/:

wb-disk123 /dev/vg0/disk123 /dev/sdc1 write_around_mode=1,read_cache_threshold=127

Then running //etc/init.d/writeboost start/ results in:

writeboost: mapping wb-disk123
writeboost: wb-disk123 mapped.
device-mapper: message ioctl on wb-disk123 failed: Invalid argument
Command failed

After the above error /write_around_mode=1/ is missing from the output of the /dmsetup table/ command.

Please find attached a patch, which rectifies the problem for us.

Best regards,
Teodor
--- writeboost.orig	2016-11-16 17:54:14.935717731 +0200
+++ writeboost	2016-11-16 17:52:02.695445860 +0200
@@ -147,13 +147,20 @@
     [ -z "$B" ] && continue                 ## unable to get size of cached device.
+
+	if [ -n "$O" ]; then
+		opts=''
+		opts_n=0
+		IFS_BAK="${IFS}"
+		IFS=','
+		for I in $O; do
+			opts="$opts ${I%%=*} ${I##*=}"
+			opts_n=$(( opts_n + 2 ))
+		done
+		IFS="${IFS_BAK}"
+	fi
+
     logger --tag writeboost --stderr "mapping $M"
-    dmsetup create "$M" --table "0 $B writeboost $H $S"
+    dmsetup create "$M" --table "0 $B writeboost $H $S $opts_n $opts"
+
     if [ -b "/dev/mapper/$M" ]; then
         logger --tag writeboost --stderr "$M mapped."
-        [ -z "$O" ] && continue
-        IFS_BAK="${IFS}"
-        IFS=','
-        for I in $O; do
-            dmsetup message "$M" 0 ${I%%=*} ${I##*=}
-        done
-        IFS="${IFS_BAK}"
     else

Reply via email to