#!/bin/bash set_START() { START=`cat /proc/uptime | cut -d ' ' -f1` } get_ELAPS() { END=`cat /proc/uptime | cut -d ' ' -f1` ELAPS=`echo "scale=7; $END - $START" | bc` } make_dir() { echo "Gen $m Dirs" sync ; echo 3 > /proc/sys/vm/drop_caches set_START for i in `seq 1 $1`; do mkdir $i done get_ELAPS echo "make $1 dirs: $ELAPS sec" } touch_file() { sync ; echo 3 > /proc/sys/vm/drop_caches set_START for i in `seq 1 $2`; do touch $1/$i done get_ELAPS echo "touch $2 file: $ELAPS sec" } access_file() { sync ; echo 3 > /proc/sys/vm/drop_caches set_START ls -R > /dev/null get_ELAPS echo "access all files: $ELAPS sec" } remove_file() { sync ; echo 3 > /proc/sys/vm/drop_caches set_START rm -rf * get_ELAPS echo "remove all files: $ELAPS sec" } mkdir mnt for k in ext4 xfs btrfs; do /sbin/mkfs.$k -F /dev/xvdb mount /dev/xvdb mnt cd mnt echo "Filesystem: $k start" for m in 16384 24576 ; do make_dir $m for n in 1 5 9 13; do touch_file $n 8192 done access_file; remove_file make_dir $m for n in 1 13; do touch_file $n 16384 done access_file; remove_file make_dir $m for n in 1 ; do touch_file $n 32768 done access_file; remove_file done cd .. echo "Filesystem: $k end" umount mnt done