aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dumpf2fs.sh61
-rwxr-xr-xscripts/spo_test.sh70
-rwxr-xr-xscripts/tracepoint.sh65
3 files changed, 196 insertions, 0 deletions
diff --git a/scripts/dumpf2fs.sh b/scripts/dumpf2fs.sh
new file mode 100755
index 0000000..2c2a273
--- /dev/null
+++ b/scripts/dumpf2fs.sh
@@ -0,0 +1,61 @@
+#!/system/bin/sh
+DEV=/dev/block/mmcblk0p16
+
+CMD=$1
+BASE=0x200000
+BASE_MAIN=0xac00000
+
+case $CMD in
+cp1)
+ echo dump cp1
+ let addr=$BASE
+ echo $addr
+ hexdump -s $addr -n 4096 $DEV;;
+cp2)
+ echo dump cp2
+ let addr=$BASE+0x200000
+ hexdump -s $addr -n 4096 $DEV;;
+cp)
+ echo dump cp1 and cp2
+ let addr=$BASE
+ hexdump -s $addr -n 409 $DEV
+ let addr=$BASE+0x200000
+ hexdump -s $addr -n 4096 $DEV;;
+cp1_all)
+ echo dump cp1 all
+ let addr=$BASE
+ hexdump -s $addr -n 20480 $DEV;;
+cp2_all)
+ echo dump cp2 all
+ let addr=$BASE+0x200000
+ hexdump -s $addr -n 20480 $DEV;;
+cp_all)
+ echo dump cp1 and cp2 all
+ let addr=$BASE
+ hexdump -s $addr -n 20480 $DEV
+ let addr=$BASE+0x200000
+ hexdump -s $addr -n 20480 $DEV;;
+blk)
+ let addr=$BASE_MAIN+$2*0x200000+$3*0x1000
+ hexdump -s $addr -n 4096 $DEV
+ echo ;;
+inode)
+ let addr=$BASE_MAIN+$2*0x200000+$3*0x1000
+ for i in `seq $3 511`
+ do
+ hexdump -s $addr -n 8 $DEV
+ let end=$addr+0x0ff0
+ hexdump -s $end -n 16 $DEV
+ let addr=$addr+0x1000
+ done
+ echo ;;
+*)
+ let addr=$1*0x1000
+ let segno=$addr-$BASE_MAIN
+ let segno=$segno/0x200000
+ let off=$addr-$BASE_MAIN
+ let off=$off%0x200000/0x1000
+ echo $segno, $off
+ hexdump -s $addr -n 4096 $DEV
+ echo ;;
+esac
diff --git a/scripts/spo_test.sh b/scripts/spo_test.sh
new file mode 100755
index 0000000..2191214
--- /dev/null
+++ b/scripts/spo_test.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+MNT=/mnt/f2fs
+DEV=/dev/sdb1
+USER_DIR=/home/zeus
+F2FS_DIR=$USER_DIR/f2fs_test
+
+check_stop() {
+ stop=`cat /tmp/stop`
+ if [ $stop -eq 1 ]; then
+ exit
+ fi
+}
+
+case $1 in
+start)
+ echo 0 > /tmp/stop
+ umount /mnt/*
+ echo 3 > /proc/sys/vm/drop_caches
+ echo 8 > /proc/sys/kernel/printk
+
+ date >> $USER_DIR/por_result
+ sync
+
+ insmod $F2FS_DIR/src/fs/f2fs/f2fs.ko || exit
+
+ echo Start checking F2FS without fsync
+ check_stop
+ fsck.f2fs $DEV -d 0 || exit
+ mount -t f2fs -o disable_roll_forward $DEV $MNT || exit
+ umount $MNT
+ echo 3 > /proc/sys/vm/drop_caches
+
+ echo Start checking F2FS with fsync
+ check_stop
+ fsck.f2fs $DEV -d 0 || exit
+ mount -t f2fs $DEV $MNT || exit
+ umount $MNT
+
+ check_stop
+ fsck.f2fs $DEV -d 0 || exit
+ mount -t f2fs $DEV $MNT || exit
+
+ count=`cat $USER_DIR/por_time`
+ if [ $count -eq 20 ]; then
+ echo Start rm all
+ time rm -rf $MNT/* || exit
+ echo 0 > $USER_DIR/por_time
+ sync
+ else
+ echo $((count+1)) > $USER_DIR/por_time
+ fi
+ echo 8 > /proc/sys/kernel/printk
+ echo Start fsstress
+ date
+ $F2FS_DIR/stress_test/fsstress/fsstress -z -f link=0 -f mkdir=3 -f mknod=3 -f rmdir=2 -f symlink=3 -f truncate=4 -f write=10 -f creat=10 -f unlink=5 -f rename=5 -f fsync=10 -p 10 -n 10000 -l 0 -d $MNT &
+ RANDOM=`date '+%s'`
+ rand=$[($RANDOM % 540) + 60]
+ echo Start sleep: $rand seconds
+ sleep $rand
+
+ echo Reboot now
+ check_stop
+ echo b > /proc/sysrq-trigger
+ ;;
+stop)
+ killall -9 fsstress
+ echo 1 > /tmp/stop
+ ;;
+esac
diff --git a/scripts/tracepoint.sh b/scripts/tracepoint.sh
new file mode 100755
index 0000000..7f5a9b8
--- /dev/null
+++ b/scripts/tracepoint.sh
@@ -0,0 +1,65 @@
+#!/system/bin/sh
+
+TRACE=/sys/kernel/debug/tracing/
+dev=$(((8<<20) + 17)) # sdb1 (8,17)
+
+echo 1 > $TRACE/tracing_on
+
+# block tracepoints
+#echo "dev == $dev" > $TRACE/events/block/block_rq_complete/filter
+echo 0 > $TRACE/events/block/block_rq_complete/enable
+echo 0 > $TRACE/events/block/block_bio_complete/enable
+
+# GC
+G=0
+echo $G > $TRACE/events/f2fs/f2fs_get_victim/enable
+
+# block allocation
+A=0
+echo $A > $TRACE/events/f2fs/f2fs_reserve_new_block/enable
+
+# block truncation
+T=0
+echo $T > $TRACE/events/f2fs/f2fs_truncate/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_inode_blocks_enter/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_inode_blocks_exit/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_blocks_enter/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_blocks_exit/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_nodes_enter/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_nodes_exit/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_data_blocks_range/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_node/enable
+echo $T > $TRACE/events/f2fs/f2fs_truncate_partial_nodes/enable
+
+# syscalls
+S=0
+echo $S > $TRACE/events/f2fs/f2fs_unlink_enter/enable
+echo $S > $TRACE/events/f2fs/f2fs_unlink_exit/enable
+echo $S > $TRACE/events/f2fs/f2fs_fallocate/enable
+echo $S > $TRACE/events/f2fs/f2fs_get_data_block/enable
+
+# IOs
+R=0
+W=0
+echo $R > $TRACE/events/f2fs/f2fs_readpage/enable
+echo $W > $TRACE/events/f2fs/f2fs_writepage/enable
+echo $W > $TRACE/events/f2fs/f2fs_submit_write_bio/enable
+echo $R > $TRACE/events/f2fs/f2fs_submit_read_bio/enable
+
+echo 0 > $TRACE/events/f2fs/f2fs_submit_page_bio/enable
+echo 0 > $TRACE/events/f2fs/f2fs_submit_page_mbio/enable
+echo 0 > $TRACE/events/f2fs/f2fs_issue_discard/enable
+echo 0 > $TRACE/events/f2fs/f2fs_issue_flush/enable
+
+# VFS interfaces
+V=0
+echo $V > $TRACE/events/f2fs/f2fs_iget/enable
+echo $V > $TRACE/events/f2fs/f2fs_iget_exit/enable
+echo $V > $TRACE/events/f2fs/f2fs_new_inode/enable
+echo $V > $TRACE/events/f2fs/f2fs_evict_inode/enable
+echo $V > $TRACE/events/f2fs/f2fs_sync_file_enter/enable
+echo $V > $TRACE/events/f2fs/f2fs_sync_file_exit/enable
+echo $V > $TRACE/events/f2fs/f2fs_write_checkpoint/enable
+echo $V > $TRACE/events/f2fs/f2fs_sync_fs/enable
+
+cat $TRACE/trace_pipe