Get rid of losetup, fix s05k_b2k_n8k tests, set name length for mkdirrange.

This commit is contained in:
Ivan Baravy 2019-11-08 05:22:07 +03:00
parent fa542ce8a1
commit f4bdf82811
16 changed files with 10185 additions and 3723 deletions

View File

@ -1,138 +1,111 @@
MKDIRRANGE=../tools/mkdirrange MKDIRRANGE=../tools/mkdirrange
MKFILEPATTERN=../tools/mkfilepattern MKFILEPATTERN=../tools/mkfilepattern
LOOP_DEV=/dev/loop8 MOUNT_OPT=
TEMP_DIR:=$(shell mktemp -d) TEMP_DIR:=$(shell mktemp -d)
all: s512_xfs_v4_ftype0.img s512_xfs_v4_ftype0_b4k_n2b.img s512_xfs_v4_ftype1.img s512_xfs_v4_ftype0_xattr.img s512_xfs_v4_files.img s512_xfs_v4_files_b4k_n2b.img s512_xfs_v4_ftype1_btree_dirs.img all: xfs_v4_ftype0_s05k_b2k_n8k.img xfs_v4_ftype1_s05k_b2k_n8k.img xfs_v4_xattr.img xfs_v4_files_s05k_b4k_n8k.img xfs_v4_deep_btree_dirs.img
rmdir $(TEMP_DIR)
s512_xfs_v4_ftype0.img: xfs_v4_ftype0_s05k_b2k_n8k.img:
fallocate -l 64MiB $@ fallocate -l 63MiB $@
parted --script $@ mktable gpt sudo mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=0 $@
parted --script --align optimal $@ mkpart primary 1MiB 100% sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo losetup $(LOOP_DEV) --partscan $@ sudo chown $$USER $(TEMP_DIR) -R
sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=0 $(LOOP_DEV)p1
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR)
sudo chown $(shell whoami) $(TEMP_DIR) -R
# #
mkdir $(TEMP_DIR)/sf mkdir $(TEMP_DIR)/sf
$(MKDIRRANGE) $(TEMP_DIR)/sf 3 $(MKDIRRANGE) $(TEMP_DIR)/sf 0 3 0 244
# #
mkdir $(TEMP_DIR)/block mkdir $(TEMP_DIR)/block
$(MKDIRRANGE) $(TEMP_DIR)/block 20 $(MKDIRRANGE) $(TEMP_DIR)/block 0 5 234 10
# #
mkdir $(TEMP_DIR)/leaf mkdir $(TEMP_DIR)/leaf
$(MKDIRRANGE) $(TEMP_DIR)/leaf 70 $(MKDIRRANGE) $(TEMP_DIR)/leaf 0 40 214 30
# #
mkdir $(TEMP_DIR)/node mkdir $(TEMP_DIR)/node
$(MKDIRRANGE) $(TEMP_DIR)/node 520 $(MKDIRRANGE) $(TEMP_DIR)/node 0 1100 0 23
#
mkdir $(TEMP_DIR)/btree_leaf
$(MKDIRRANGE) $(TEMP_DIR)/btree_leaf 0 1000 201 43
#
mkdir $(TEMP_DIR)/btree_leaf_free
$(MKDIRRANGE) $(TEMP_DIR)/btree_leaf_free 0 1200 201 43
# #
mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 600
sudo umount $(TEMP_DIR) sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV) fallocate -i -o 0 -l 1MiB $@
s512_xfs_v4_ftype0_b4k_n2b.img:
fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=2b,ftype=0 $(LOOP_DEV)p1 xfs_v4_ftype1_s05k_b2k_n8k.img:
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR) fallocate -l 63MiB $@
sudo chown $(shell whoami) $(TEMP_DIR) -R sudo mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=1 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
# #
mkdir $(TEMP_DIR)/sf mkdir $(TEMP_DIR)/sf
$(MKDIRRANGE) $(TEMP_DIR)/sf 3 $(MKDIRRANGE) $(TEMP_DIR)/sf 0 3 0 244
# #
mkdir $(TEMP_DIR)/block mkdir $(TEMP_DIR)/block
$(MKDIRRANGE) $(TEMP_DIR)/block 20 $(MKDIRRANGE) $(TEMP_DIR)/block 0 5 234 10
# #
mkdir $(TEMP_DIR)/leaf mkdir $(TEMP_DIR)/leaf
$(MKDIRRANGE) $(TEMP_DIR)/leaf 70 $(MKDIRRANGE) $(TEMP_DIR)/leaf 0 40 214 30
# #
mkdir $(TEMP_DIR)/node mkdir $(TEMP_DIR)/node
$(MKDIRRANGE) $(TEMP_DIR)/node 520 $(MKDIRRANGE) $(TEMP_DIR)/node 0 1100 0 23
#
mkdir $(TEMP_DIR)/btree_leaf
$(MKDIRRANGE) $(TEMP_DIR)/btree_leaf 0 1000 201 43
#
mkdir $(TEMP_DIR)/btree_leaf_free
$(MKDIRRANGE) $(TEMP_DIR)/btree_leaf_free 0 1200 201 43
# #
mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 600
sudo umount $(TEMP_DIR) sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV) fallocate -i -o 0 -l 1MiB $@
s512_xfs_v4_ftype1.img:
fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=1 $(LOOP_DEV)p1 xfs_v4_xattr.img:
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR) fallocate -l 63MiB $@
sudo chown $(shell whoami) $(TEMP_DIR) -R sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR) -o attr2
sudo chown $$USER $(TEMP_DIR) -R
# #
mkdir $(TEMP_DIR)/sf mkdir $(TEMP_DIR)/sf
$(MKDIRRANGE) $(TEMP_DIR)/sf 3 $(MKDIRRANGE) $(TEMP_DIR)/sf 0 900 0 244
#
mkdir $(TEMP_DIR)/block
$(MKDIRRANGE) $(TEMP_DIR)/block 20
# #
mkdir $(TEMP_DIR)/leaf mkdir $(TEMP_DIR)/leaf
$(MKDIRRANGE) $(TEMP_DIR)/leaf 70 $(MKDIRRANGE) $(TEMP_DIR)/leaf 0 600 0 244
# #
mkdir $(TEMP_DIR)/node mkdir $(TEMP_DIR)/node
$(MKDIRRANGE) $(TEMP_DIR)/node 520 $(MKDIRRANGE) $(TEMP_DIR)/node 0 600 0 244
# #
mkdir $(TEMP_DIR)/btree mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 600 $(MKDIRRANGE) $(TEMP_DIR)/btree 0 600 0 244
#
sudo umount $(TEMP_DIR) sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV) fallocate -i -o 0 -l 1MiB $@
s512_xfs_v4_ftype0_xattr.img:
fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=0 $(LOOP_DEV)p1 xfs_v4_deep_btree_dirs.img:
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR) -o attr2 fallocate -l 127MiB $@
sudo chown $(shell whoami) $(TEMP_DIR) -R sudo mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=4k,ftype=1 $@
# sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
mkdir $(TEMP_DIR)/sf sudo chown $$USER $(TEMP_DIR) -R
$(MKDIRRANGE) $(TEMP_DIR)/sf 900
#
mkdir $(TEMP_DIR)/leaf
$(MKDIRRANGE) $(TEMP_DIR)/leaf 600
#
mkdir $(TEMP_DIR)/node
$(MKDIRRANGE) $(TEMP_DIR)/node 600
# #
mkdir $(TEMP_DIR)/btree mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 600 $(MKDIRRANGE) $(TEMP_DIR)/btree 0 293181 0 244
sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_ftype1_btree_dirs.img:
fallocate -l 128MiB $@
parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=1 $(LOOP_DEV)p1
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR)
sudo chown $(shell whoami) $(TEMP_DIR) -R
# #
mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 293181
sudo umount $(TEMP_DIR) sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV) fallocate -i -o 0 -l 1MiB $@
s512_xfs_v4_files.img:
fallocate -l 128MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -n ftype=0 $(LOOP_DEV)p1 xfs_v4_files_s05k_b4k_n8k.img:
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR) fallocate -l 127MiB $@
sudo chown $(shell whoami) $(TEMP_DIR) -R sudo mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -n size=8k,ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
# #
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 65536 $(MKFILEPATTERN) $(TEMP_DIR)/no_hole 65536
# #
@ -150,42 +123,10 @@ s512_xfs_v4_files.img:
fallocate -i -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \ fallocate -i -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
fallocate -z -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \ fallocate -z -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
done done
# $(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 134217728
#
sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_files_b4k_n2b.img:
fallocate -l 128MiB $@
parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100%
sudo losetup $(LOOP_DEV) --partscan $@
sudo mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -n size=2b,ftype=0 $(LOOP_DEV)p1
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR)
sudo chown $(shell whoami) $(TEMP_DIR) -R
#
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 65536
#
$(MKFILEPATTERN) $(TEMP_DIR)/hole_begin 65536
fallocate -p -o 0 -l 16KiB $(TEMP_DIR)/hole_begin
#
$(MKFILEPATTERN) $(TEMP_DIR)/hole_middle 65536
fallocate -p -o 32KiB -l 16KiB $(TEMP_DIR)/hole_middle
#
$(MKFILEPATTERN) $(TEMP_DIR)/hole_end 65536
fallocate -p -o 48KiB -l 16KiB $(TEMP_DIR)/hole_end
#
# fallocate -l 120GiB $(TEMP_DIR)/btree_l1_no_hole
fallocate -l 4KiB $(TEMP_DIR)/btree_l1_no_hole
# $(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 2097152
# fallocate -c -l 64KiB -o $$((64*$$n))KiB $(TEMP_DIR)/btree_l1_no_hole ; \
# dd if=/dev/zero of=$(TEMP_DIR)/btree_l1_no_hole bs=1M count=128
for n in $$(seq 1 2000); do \
fallocate -i -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
fallocate -z -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
done
$(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 8196096 $(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 8196096
# #
sudo umount $(TEMP_DIR) sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV) fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100%

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
disk_add ../img/s512_xfs_v4_ftype0.img hd0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0
ls /hd0/1/sf ls /hd0/1/sf
ls /hd0/1/block ls /hd0/1/block
ls /hd0/1/leaf ls /hd0/1/leaf
ls /hd0/1/node ls /hd0/1/node
ls /hd0/1/btree ls /hd0/1/btree_leaf
ls /hd0/1/btree_leaf_free
disk_del hd0 disk_del hd0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
disk_add ../img/s512_xfs_v4_ftype1.img hd0 disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0
ls /hd0/1/sf ls /hd0/1/sf
ls /hd0/1/block ls /hd0/1/block
ls /hd0/1/leaf ls /hd0/1/leaf
ls /hd0/1/node ls /hd0/1/node
ls /hd0/1/btree ls /hd0/1/btree_leaf
ls /hd0/1/btree_leaf_free
disk_del hd0 disk_del hd0

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
disk_add ../img/s512_xfs_v4_ftype0_b4k_n2b.img hd0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0
ls /hd0/1/sf ls /hd0/1/sf
ls /hd0/1/block ls /hd0/1/block
ls /hd0/1/leaf ls /hd0/1/leaf
ls /hd0/1/node ls /hd0/1/node
ls /hd0/1/btree ls /hd0/1/btree_leaf
ls /hd0/1/btree_leaf_free
ls /hd0/1/sf/. ls /hd0/1/sf/.
ls /hd0/1/sf/.. ls /hd0/1/sf/..
disk_del hd0 disk_del hd0

View File

@ -1,4 +1,4 @@
/> disk_add ../img/s512_xfs_v4_files_b4k_n2b.img hd0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
/hd0/1: xfs /hd0/1: xfs
# zero length # zero length
/> read /hd0/1/no_hole 0 0 -b /> read /hd0/1/no_hole 0 0 -b

View File

@ -1,4 +1,4 @@
disk_add ../img/s512_xfs_v4_files_b4k_n2b.img hd0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
# zero length # zero length
read /hd0/1/no_hole 0 0 -b read /hd0/1/no_hole 0 0 -b
read /hd0/1/no_hole 1 0 -b read /hd0/1/no_hole 1 0 -b

View File

@ -1,4 +1,4 @@
/> disk_add ../img/s512_xfs_v4_ftype0_b4k_n2b.img hd0 /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0
/hd0/1: xfs /hd0/1: xfs
/> stat /hd0/1/sf/. /> stat /hd0/1/sf/.
status = 0 success status = 0 success

View File

@ -1,4 +1,4 @@
disk_add ../img/s512_xfs_v4_ftype0_b4k_n2b.img hd0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0
stat /hd0/1/sf/. stat /hd0/1/sf/.
stat /hd0/1/sf/.. stat /hd0/1/sf/..
stat /hd0/1/sf/// stat /hd0/1/sf///

View File

@ -1,4 +1,4 @@
/> disk_add ../img/s512_xfs_v4_files.img hd0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
/hd0/1: xfs /hd0/1: xfs
/> pwd /> pwd
/ /

View File

@ -1,4 +1,4 @@
disk_add ../img/s512_xfs_v4_files.img hd0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
pwd pwd
cd /hd0 cd /hd0
pwd pwd

View File

@ -1,4 +1,4 @@
/> disk_add ../img/s512_xfs_v4_files_b4k_n2b.img hd0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
/hd0/1: xfs /hd0/1: xfs
# hole begin # hole begin
# zero length # zero length

View File

@ -1,4 +1,4 @@
disk_add ../img/s512_xfs_v4_files_b4k_n2b.img hd0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0
# hole begin # hole begin
# zero length # zero length
read /hd0/1/hole_begin 0 0 -b read /hd0/1/hole_begin 0 0 -b

View File

@ -8,17 +8,18 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
unsigned begin = 0, end; unsigned begin, end;
int pat_min, pat_max;
char *path; char *path;
if (argc == 3) { if (argc == 6) {
path = argv[1];
sscanf(argv[2], "%u", &end);
} else if (argc == 4) {
path = argv[1]; path = argv[1];
sscanf(argv[2], "%u", &begin); sscanf(argv[2], "%u", &begin);
sscanf(argv[3], "%u", &end); sscanf(argv[3], "%u", &end);
sscanf(argv[4], "%i", &pat_min);
sscanf(argv[5], "%i", &pat_max);
} else { } else {
fprintf(stderr, "mkdirrange directory num_begin num_end\n"); fprintf(stderr, "mkdirrange <directory> <num_begin> <num_end> <pat_min> <pat_max>\n"
"pat_min + pat_max <= 244\n");
exit(1); exit(1);
} }
@ -33,7 +34,7 @@ int main(int argc, char *argv[])
for(unsigned current = begin; current < end; current++) { for(unsigned current = begin; current < end; current++) {
int length = sprintf(dirname, "d%10.10u_", current); int length = sprintf(dirname, "d%10.10u_", current);
dirname[length] = 'x'; dirname[length] = 'x';
length += current % 244; length += pat_min + (current % pat_max);
dirname[length] = '\0'; dirname[length] = '\0';
if(mkdirat(dirfd, dirname, 0755)) { if(mkdirat(dirfd, dirname, 0755)) {
fprintf(stderr, "Can't mkdir %s: %s\n", dirname, strerror(errno)); fprintf(stderr, "Can't mkdir %s: %s\n", dirname, strerror(errno));