Dear FreeBSD developers,
Inside a QEMU-VM, I inserted calls to g_print_bio in the first lines of
sys/cam/ata/ata_da.c:adastrategy() and
sys/dev/virtio/block/virtio_blk.c:vtblk_strategy() of a FreeBSD 14.2,
and added an image file with -drive file=test.img,format=raw[,if=virtio].
While using the virtual disk, I observe BIO_WRITE request, but never a
BIO_FLUSH.
Usage was by
- creating a UFS filesystem (newfs /dev/vtbd0)
- mounting it in /mnt
- write a file with
dd of=/mnt/a bs=4k count=20 if=/dev/urandom
sync
dd of=/mnt/a bs=4k count=20 if=/dev/urandom conv=fdatasync
dd of=/mnt/a bs=4k count=20 if=/dev/urandom oflag=sync
- repeating this with a geli layer (no special parameters to geli
init) and with msdosfs instead of UFS
The differences between the dd calls with and without sync options was
that the WRITEs were immediately issued with conv=fdatasync or
oflag=sync, but no FLUSHs were observed (with one exception: geli clear)
This is why I wonder when BIO_FLUSH is used and if it means something
different.
I am interested for these reasons:
- In a university research project, I am trying to suspend+resume a
system without calling the DEVICE_SUSPEND functions. Therefore I wonder
when I can assume that a BIO_WRITE has really arrived on disk
- The GELI class seems to reorder WRITEs and FLUSHes. (at least in my
understanding while looking for code example on writing a geom class)
This was also discussed here 12 years ago, where I could not find a
resolution:
https://freebsd-geom.freebsd.narkive.com/KruBpS7r/geli-and-bio-flush-and-or-bio-ordered-issue
(writes are queued, flush is passed g_down immediately,
https://cgit.freebsd.org/src/tree/sys/geom/eli/g_eli.c#n507 )
Thanks and Happy Hacking,
thejonny