2017-03-02 14:12:20 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-12-14 20:34:03 +00:00
|
|
|
set -xe
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2016-12-14 20:34:03 +00:00
|
|
|
basedir=$(readlink -f $(dirname $0))
|
|
|
|
MAKE="make -j$(( $(nproc) * 2 ))"
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2017-08-09 10:38:11 +00:00
|
|
|
if [[ $1 == "scsi" ]]; then
|
|
|
|
devs=""
|
|
|
|
for entry in /sys/block/sd*; do
|
|
|
|
if grep -Eq '(INTEL|RAWSCSI|LIO-ORG)' $entry/device/vendor; then
|
|
|
|
devs+="$(basename $entry)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else script=$blk_script;
|
|
|
|
devs=$(cd /sys/block; echo vd*)
|
|
|
|
fi
|
2017-03-02 14:12:20 +00:00
|
|
|
|
|
|
|
trap "exit 1" SIGINT SIGTERM EXIT
|
2016-12-14 20:34:03 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
for fs in $fs; do
|
|
|
|
for dev in $devs; do
|
|
|
|
mkfs_cmd="mkfs.$fs"
|
|
|
|
parted_cmd="parted -s /dev/${dev}"
|
2016-12-14 20:34:03 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt"
|
|
|
|
$parted_cmd mklabel gpt
|
|
|
|
$parted_cmd mkpart primary 2048s 100%
|
|
|
|
sleep 2
|
2016-12-14 20:34:03 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
mkfs_cmd+=" /dev/${dev}1"
|
|
|
|
echo "INFO: Creating filesystem using: $mkfs_cmd"
|
|
|
|
wipefs -a /dev/${dev}1
|
|
|
|
$mkfs_cmd
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
mkdir -p /mnt/${dev}dir
|
|
|
|
mount -o sync /dev/${dev}1 /mnt/${dev}dir
|
|
|
|
mkdir -p /mnt/${dev}dir/linux-src
|
|
|
|
tar xf $basedir/linux-src.tar.gz -C /mnt/${dev}dir/linux-src --strip-components=1
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
# Now build SPDK
|
|
|
|
$MAKE -C /mnt/${dev}dir/linux-src defconfig
|
|
|
|
$MAKE -C /mnt/${dev}dir/linux-src
|
|
|
|
# Print out space consumed on target device
|
|
|
|
df -h /dev/$dev
|
|
|
|
rm -rf /mnt/${dev}dir/linux-src
|
|
|
|
done
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
for dev in $devs; do
|
|
|
|
umount /mnt/${dev}dir
|
|
|
|
rm -rf /mnt/${dev}dir
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2017-12-07 11:14:29 +00:00
|
|
|
stats=( $(cat /sys/block/$dev/stat) )
|
|
|
|
echo ""
|
|
|
|
echo "$dev stats"
|
|
|
|
printf "READ IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \
|
|
|
|
${stats[0]} ${stats[1]} ${stats[2]} ${stats[3]}
|
|
|
|
printf "WRITE IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \
|
|
|
|
${stats[4]} ${stats[5]} ${stats[6]} ${stats[7]}
|
|
|
|
printf "in flight: % 8u io ticks: % 8u time in queue: % 8u\n" \
|
|
|
|
${stats[8]} ${stats[9]} ${stats[10]}
|
|
|
|
echo ""
|
|
|
|
done
|
2017-03-02 14:12:20 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|