[ANNOUNCE v2] work tree for untorn filesystem writes
From: Darrick J. Wong
Date: Tue Nov 05 2024 - 19:57:58 EST
Hi everyone,
Here's a slightly updated working branch for the filesystem side of
atomic write changes for 6.13:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/log/?h=fs-atomic_2024-11-05
This branch is, like yesterday's, based off of axboe's
for-6.13/block-atomic branch:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/log/?h=for-6.13/block-atomic
The only difference is that I added Ojaswin's Tested-by: tags to the end
of the xfs series. I have done basic testing with the shell script at
the end of this email and am satisfied that it at least seems to do the
(limited) things that I think we're targeting for 6.13.
Christian: Could you pull this fs-atomic branch into your vfs.git work
for 6.13, please? Or would you rather I ask rothwell to include this
branch into for-next/fs-next and send the PR to Linus myself?
(Actually I might just ask rothwell to do that tomorrow regardless...)
--D
#!/bin/bash -x
# Mess around with atomic writes via scsi_debug
mnt=/opt
true "${FSTYP:=xfs}"
true "${MIN_ATOMIC:=32768}"
true "${SECTOR_SIZE:=512}"
true "${FSBLOCK_SIZE:=4096}"
umount $mnt
rmmod "$FSTYP"
rmmod scsi_debug
modprobe scsi_debug atomic_wr=1 dev_size_mb=300 \
SECTOR_SIZE=$SECTOR_SIZE \
atomic_wr_align=$((MIN_ATOMIC / SECTOR_SIZE)) \
atomic_wr_gran=$((MIN_ATOMIC / SECTOR_SIZE))
sleep 1
dev="$(readlink -m /dev/disk/by-id/wwn-0x3333333000*)"
sysfs=/sys/block/$(basename "$dev")
sysfs-dump $sysfs/queue/atomic_write_*
for ((i = 9; i < 20; i++)); do
xfs_io -d -c "pwrite -b 1m -V 1 -AD $((2 ** i)) $((2 ** i))" $dev
done
case "$FSTYP" in
"xfs")
mkfs.xfs -f $dev -b size=$MIN_ATOMIC
;;
"ext4")
mkfs.ext4 -F $dev -b $FSBLOCK_SIZE -C $MIN_ATOMIC -O bigalloc
;;
*)
echo "$FSTYP: not recognized"
exit 1
;;
esac
mount $dev $mnt
xfs_io -f -c 'falloc 0 1m' -c fsync $mnt/a
filefrag -v $mnt/a
for ((i = 9; i < 20; i++)); do
xfs_io -d -c "pwrite -b 1m -V 1 -AD $((2 ** i)) $((2 ** i))" $mnt/a
done
# does not support buffered io
xfs_io -c "pwrite -b 1m -V 1 -AD 0 $MIN_ATOMIC" $mnt/a
# does not support unaligned directio
xfs_io -c "pwrite -b 1m -V 1 -AD $SECTOR_SIZE $MIN_ATOMIC" $mnt/a