scripts: add some scripts

1. dumpf2fs.sh
 : to see internal device with hexdump
2. spo_test.sh
 : to run SPOR
3. tracepoint.sh
 : to turn on tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Jaegeuk Kim 2013-10-17 15:26:23 +09:00
parent 050e8712a6
commit 5b9f641c06
3 changed files with 190 additions and 0 deletions

61
scripts/dumpf2fs.sh Executable file
View File

@ -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

70
scripts/spo_test.sh Executable file
View File

@ -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

59
scripts/tracepoint.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
TRACE=/sys/kernel/debug/tracing/
dev=$(((8<<20) + 17)) # sdb1 (8,17)
echo 1 > tracing_on
# block tracepoints
echo "dev == $dev" > $TRACE/events/block/block_rq_complete/filter
echo 1 > $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 $W > $TRACE/events/f2fs/f2fs_submit_write_page/enable
echo $W > $TRACE/events/f2fs/f2fs_do_submit_bio/enable
echo $R > $TRACE/events/f2fs/f2fs_readpage/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