code: mafs

ref: 9b76881a8e11c44aae5dfd447e1cd1bc074ec9f3
dir: /tests/testmfs.rc/

View raw version
#!/bin/rc

# create a disk of 17 blocks
# block	- description
# 0		- none, where magic is written
# 1		- config
# 2		- super block
# 3		- / direntry
# 4		- /adm/ dir entry
# 5		- /adm/users dir entry
# 6		- /adm/users contents

# 7		- /dir1 dir entry

# 8		- / direntry
# 9		- super block
# 10	- config

# 11	- /dir1/file1 dir entry
# 12	- /dir1/file1 contents - first 512 bytes
# 13	- /dir1/file1 contents - second 512 bytes

# 14	- / direntry
# 15	- super block
# 16	- config

# tests
# check the contents of the blocks
# write more than 512 bytes to file1 and see if it errors out with a full message

service=test.0
disk=$service^/disk

dd -if /dev/zero -of $disk -bs 512 -count 17
mount -c <{/mnt/term/home/j/local/plan9/custom/mfs/6.out -s -r -m 1 -n test.0 $disk <[0=1]} /n/$service
echo $status

ls -l /srv/mfs*
echo /srv/mfs.$service /srv/mfs.^$service^.cmd
#test -f /srv/mfs.$service && {
#	echo halt >> /srv/mfs.^$service^.cmd
#	sleep 2;
#	rm /srv/mfs.$service
#}
echo ls -l /srv/mfs.$service /srv/mfs.^$service^.cmd
ls -l /srv/mfs.$service /srv/mfs.^$service^.cmd
ls -l /n
echo ls -l /n/$service
ls -l /n/$service
echo ls -l /n/$service^/adm
ls -l /n/$service^/adm
echo cd /n/$service
cd /n/$service

fn showblock{
	dd -if $disk -bs 512 -count 1 -skip $1 | xd -8x -c
}
#echo magic block
#showblock 0

ls -l /n/$service
cd /n/$service
mkdir 'dir1'
touch 'dir1/file1'
echo test > 'dir1/file1'
cat 'dir1/file1'
du -a 
ls -l 'dir1/file1'
cd 'dir1'
cd ..
cd adm
echo cd ../dir1
cd ../dir1
ls -l
echo cd /n/$service
cd /n/$service
rm /n/^$service^/dir1/file1

#echo shutdown > '#F/testdisk.1/ctl'
#echo init > '#F/testdisk.1/ctl'
#
#ls -l '#F/'
#ls -l '#F/testdisk.1'
#mkdir '/dir1'
#touch '/dir1/file1'
#echo test > '/dir1/file1'
#du -a '#F'
#ls -l '/dir1/file1'
#cd '/dir1'
#cd ..
#
#{for(i in `{seq 0 1 60}){ for(i in `{seq 0 1 9}){ echo -n $i} } } > '/dir1/file1'
#ls -l '/dir1/file1'
#echo test > '/dir1/file1'
#ls -l '/dir1/file1'
#
#cat '/dir1/file1'
#
#dd -if /tmp/testdisk.1 -bs 512 -count 1 -skip 3 | xd -8x -c
#
#test hjfs vs mfs performance. hjfs is faster in reads and writes
#: ; disk/prep /dev/sdE2/plan9
#  empty                   0 2            (2 sectors, 1.00 KB)
#  fs                      2 164509813    (164509811 sectors, 78.44 GB)
#  fs.1            164509813 230313737    (65803924 sectors, 31.37 GB)
#  fscache         230313737 296117661    (65803924 sectors, 31.37 GB)
#  fsworm          296117661 625137281    (329019620 sectors, 156.88 GB)
#  empty           625137281 625137282    (1 sectors, 512 B )
#>>> d fs
#>>> a fs 2 4096
#>>> a fs.2 4096 164509813
#>>> p
#  empty                   0 2            (2 sectors, 1.00 KB)
#' fs                      2 4096         (4094 sectors, 1.99 MB)
#' fs.2                 4096 164509813    (164505717 sectors, 78.44 GB)
#  fs.1            164509813 230313737    (65803924 sectors, 31.37 GB)
#  fscache         230313737 296117661    (65803924 sectors, 31.37 GB)
#  fsworm          296117661 625137281    (329019620 sectors, 156.88 GB)
#  empty           625137281 625137282    (1 sectors, 512 B )
#>>> w
#>>> q
#
#disk/prep -bw -a^(fs fs.1 fs.2 fscache fsworm) /dev/sdE2/plan9
#
#disk/prep /dev/sdE2/plan9
#disk/prep -p /dev/sdE2/plan9 > /dev/sdE2/ctl
#
#{
#	echo disk testmfs /dev/sdE2/fs
#	echo ream
#	echo init
#} >'#F/clone'
#
#hjfs -n hjfs.testmc -m 512 -Sf /dev/sdE2/fs.1
#ls /srv/hjfs*
#
#time mkdir '#F/testmfs/root/dir1'
#time mkdir /n/newfs/dir1
#
#time touch '#F/testmfs/root/dir1/file1'
#time echo test > '#F/testmfs/root/dir1/file1'
#time touch '/n/newfs/dir1/file1'
#time echo test > '/n/newfs/dir1/file1'
#
#time rm -rf '#F/testmfs/root/dir1'
#time rm -rf /n/newfs/dir1
#
#time dd -if /dev/zero -of '#F/testmfs/root/dir1/file1' -bs 512 -count 1000
#time dd -if /dev/zero -of /n/newfs/dir1/file1 -bs 512 -count 1000
#
#time dd -of '#F/testmfs/root/dir1/file1' -if /dev/null -bs 512 -count 1000
#time dd -of /n/newfs/dir1/file1 -if /dev/null -bs 512 -count 1000