[Ocfs2-test-devel] [PATCH 05/11] fill_verify_holes

Marcos Matsunaga Marcos.Matsunaga at oracle.com
Wed Jun 23 21:19:54 PDT 2010


ocfs2-test: Added Run_corruption function.

- Added execution to the config.sh script.
- Made modifications suggested by Tristan on first review.
- Added the directory fill_holes_data and files.

Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
---
 programs/fill_verify_holes/Makefile                |    2 +
 programs/fill_verify_holes/burn-in.sh              |   55 +++++++++++++++++++-
 .../fill_verify_holes/fill_holes_data/Makefile     |   13 +++++
 .../fill_holes_data/nosparsebug.dat                |    7 +++
 4 files changed, 76 insertions(+), 1 deletions(-)
 create mode 100644 programs/fill_verify_holes/fill_holes_data/Makefile
 create mode 100644 programs/fill_verify_holes/fill_holes_data/nosparsebug.dat

diff --git a/programs/fill_verify_holes/Makefile b/programs/fill_verify_holes/Makefile
index d0d53ae..35929f2 100644
--- a/programs/fill_verify_holes/Makefile
+++ b/programs/fill_verify_holes/Makefile
@@ -8,6 +8,8 @@ CFLAGS = -O2 -Wall -g $(OCFS2_CFLAGS)
 
 SOURCES = fill_holes.c punch_holes.c verify_holes.c fill_holes.h reservations.h
 
+SUBDIRS = fill_holes_data
+
 DIST_FILES = $(SOURCES)
 
 BIN_EXTRA = burn-in.sh old_burn-in.sh fill_verify_holes.sh
diff --git a/programs/fill_verify_holes/burn-in.sh b/programs/fill_verify_holes/burn-in.sh
index 1ee2b02..e0416ff 100755
--- a/programs/fill_verify_holes/burn-in.sh
+++ b/programs/fill_verify_holes/burn-in.sh
@@ -9,15 +9,22 @@ SUDO="`which sudo` -u root"
 DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
 MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
 TUNEFS_BIN="`which sudo` -u root `which tunefs.ocfs2`"
+MOUNTED_BIN="`which sudo` -u root `which mounted.ocfs2`"
 GREP=`which grep`
+CHOWN=`which chown`
 DF=`which df`
+WC=`which wc`
 ECHO="`which echo` -e"
 AWK=`which awk`
 
+USERID=`/usr/bin/whoami`
 BINPATH="."
 LOGPATH="."
 MMAPOPT=
-UNWOPT=
+if [ -f `dirname ${0}`/config.sh ]; then
+	. `dirname ${0}`/config.sh
+fi;
+NWOPT=
 
 log_run() {
     echo "Run: $@"
@@ -66,6 +73,49 @@ run100() {
     done
 }
 
+Run_corruption() {
+	CORRUPTLOG=${O2TDIR}/workfiles/fill_holes_data/nosparsebug.dat
+	FILESIZE=$[11*1024*1024*1024];
+	FILENAME=${DIRECTORY}/fill_holes.txt;
+	FS_FEATURES='--fs-features=nosparse,nounwritten'
+	LOCAL_FEATURE=''
+	if [ ${LOCALFLAG} -eq 0 ]; then
+		LOCAL_FEATURE='-M local';
+	fi;
+	echo -e "Testing corruption";
+	mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
+	if [ ${mounted} -eq 1 ]; then
+		echo -e "umounting partition";
+		sudo umount ${MOUNTPOINT};
+	fi;
+	mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
+	if [ ${mounted} -ne 0 ]; then
+		echo -e "Device ${DEVICE} is mounted by some other node.";
+		echo -e "Can't proceed with this test. Aborting.";
+		exit 1;
+	fi;
+	echo "Formatting partition with nosparse,nounwritten options.";
+	echo "y"|${MKFS_BIN} -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -L ${LABEL} \
+	-N ${SLOTS} ${LOCAL_FEATURE} ${FS_FEATURES} ${DEVICE};
+	if [ $? -ne 0 ]; then
+		echo -e "mkfs.ocfs2 failed $?";
+		exit 1;
+	fi;
+	echo "mounting device with label ${LABEL} on ${MOUNTPOINT}";
+	sudo mount LABEL=${LABEL} ${MOUNTPOINT};
+	sudo mkdir -p ${DIRECTORY}
+	${SUDO} ${CHOWN} --recursive ${USERID} ${MOUNTPOINT}
+
+	mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
+	if [ ${mounted} -eq 0 ]; then
+		echo -e "Device ${DEVICE} was not properly mounted.";
+		echo -e "Can't proceed with this test. Aborting.";
+		exit 1;
+	fi;
+	${BINDIR}/fill_holes  -r ${CORRUPTLOG} ${FILENAME} ${FILESIZE};
+	${BINDIR}/verify_holes ${CORRUPTLOG} ${FILENAME};
+}
+
 #
 # GetDevInfo
 #
@@ -88,6 +138,8 @@ LABEL=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep Label:|\
 if [ "X${LABEL}" == "X" ]; then
 	LABEL="testlabel";
 fi;
+${DEBUGFS_BIN} -R "stats" ${DEVICE}|grep "Feature Incompat"|grep -q 'local'
+LOCALFLAG=$? 
 UUID=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep UUID|\
 	${AWK} -F" " '{print $2}'`;
 SLOTS=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep Slots:|\
@@ -122,3 +174,4 @@ fi
 
 GetDevInfo;
 run100 ${ITER} ${SIZE} 
+Run_corruption
diff --git a/programs/fill_verify_holes/fill_holes_data/Makefile b/programs/fill_verify_holes/fill_holes_data/Makefile
new file mode 100644
index 0000000..7a5a5a0
--- /dev/null
+++ b/programs/fill_verify_holes/fill_holes_data/Makefile
@@ -0,0 +1,13 @@
+TOPDIR = ../../..
+
+include $(TOPDIR)/Preamble.make
+
+DATADIR = fill_holes_data
+
+DIST_FILES = 				\
+		nosparsebug.dat
+DATAFILES = 				\
+		nosparsebug.dat
+
+include $(TOPDIR)/Postamble.make
+
diff --git a/programs/fill_verify_holes/fill_holes_data/nosparsebug.dat b/programs/fill_verify_holes/fill_holes_data/nosparsebug.dat
new file mode 100644
index 0000000..83891ec
--- /dev/null
+++ b/programs/fill_verify_holes/fill_holes_data/nosparsebug.dat
@@ -0,0 +1,7 @@
+A	0	512
+B	4096	512
+C	1048576	512
+D	2097152	512
+E	3146240	512
+F	5243392	512
+G	10485760	512
-- 
1.5.6.5




More information about the Ocfs2-test-devel mailing list