Open kdave opened 3 years ago
nullb0 and b1 are 2G devices, reproducer script, expects to be run in btrfs-progs and uses .git
#!/bin/sh -x
dev=/dev/nullb0
dev2=/dev/nullb1
umount mnt
blkzone reset $dev
blkzone reset $dev2
blkzone report $dev
blkzone report $dev2
./mkfs.btrfs -L ZONED -f -d single -m single $dev
blkzone report $dev
mount $dev mnt || { echo error; exit 1; }
for i in `seq 20`; do
dd if=/dev/zero of=mnt/file$i bs=1M count=65 status=progress
./btrfs filesystem sync mnt
done
for i in `seq 1 2 10`; do
rm -f mnt/file$i
done
./btrfs filesystem df mnt; df -h mnt; blkzone report $dev
sync
echo "zones are probably full"
for i in `seq 10`; do
rm -f mnt/file$i
done
sync
./btrfs filesystem df mnt; df -h mnt; blkzone report $dev
./btrfs device add -f $dev2 mnt
for i in `seq 10`; do
dd if=/dev/zero of=mnt/file2$i bs=1M count=65 status=progress
./btrfs filesystem sync mnt
done
./btrfs filesystem df mnt; df -h mnt; blkzone report $dev
./btrfs subvolume create mnt/git
cp -a .git mnt/git
( cd mnt/git
git checkout -f master
for id in $(git rev-list master | shuf); do
git checkout -f $id
btrfs subvolume snapshot . ../snap-$id
done
)
until ./btrfs device delete $dev mnt; do
sleep 1
break;
done
umount mnt