ldb speed test - needs free block dev
authorAndrew Tridgell <tridge@samba.org>
Fri, 12 Feb 2010 00:16:27 +0000 (11:16 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 12 Feb 2010 00:16:27 +0000 (11:16 +1100)
testldbspeed.sh [new file with mode: 0755]

diff --git a/testldbspeed.sh b/testldbspeed.sh
new file mode 100755 (executable)
index 0000000..e08bd8a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+[ $# -eq 5 ] || {
+cat <<EOF
+usage: testldbspeed.sh DEVICE FSTYPE MNTOPTIONS MNTPOINT LDBTEST
+
+example usage:
+
+  testldbspeed.sh /dev/sda6 ext3 "-o barrier=1" /mnt/ldbtest "/home/tridge/samba/git/combined/source4/bin/ldbtest -H test.ldb --num-records=200 --num-searches=10"
+EOF
+    exit 1
+}
+
+DEV="$1"
+FSTYPE="$2"
+MNTOPTIONS="$3"
+MNTPOINT="$4"
+LDBTEST="$5"
+
+grep "$DEV" /proc/mounts && {
+    umount -f "$DEV" || exit 1
+}
+mkfs."$FSTYPE" "$DEV" || exit 1
+mkdir -p "$MNTPOINT" || exit 1
+mount "$DEV" $MNTOPTIONS "$MNTPOINT" || exit 1
+
+pushd "$MNTPOINT" || exit 1
+time $LDBTEST
+sync
+popd
+umount "$DEV"