Re: git: afe1dec7425c - main - tests: add UFS synchronous write durability tests

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 13 Oct 2026 11:24:28 UTC
On 13 Oct 2026, at 6:29, Maxim Sobolev wrote:
> The branch main has been updated by sobomax:
>
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=afe1dec7425c9f3bec1aafcfed15229a385894eb
>
> commit afe1dec7425c9f3bec1aafcfed15229a385894eb
> Author:     Maxim Sobolev <sobomax@FreeBSD.org>
> AuthorDate: 2026-10-13 02:45:12 +0000
> Commit:     Maxim Sobolev <sobomax@FreeBSD.org>
> CommitDate: 2026-10-13 04:28:32 +0000
>
>     tests: add UFS synchronous write durability tests
>
>     Check that once fsync(2), fdatasync(2), or a write(2) with O_SYNC 
> or
>     O_DSYNC returns, the new data, the file size and every block 
> pointer
>     leading to the data are on disk.  The cases append a block, fill a 
> hole,
>     append the first block that needs an indirect block and append 
> below an
>     existing indirect block.  Two more append after another write left 
> a
>     new direct block unsynced, which with soft updates cuts the size 
> and the
>     later pointers of an inode written meanwhile.  With O_SYNC and 
> O_DSYNC
>     on soft updates, those also check that the open already made the
>     unsynced block durable.
>     Each case runs on UFS without soft updates, with soft updates and 
> with
>     SU+J.
>
>     The file systems live on md(4) and the checks read the inode, the
>     indirect block and the data block straight from the device with 
> libufs
>     right after the synchronous call returns.  There is no cache in 
> front
>     of the disk device, so this shows what would survive a crash at 
> that
>     moment without having to crash anything.
>
>     Sponsored by:   Sippy Software, Inc.
>     Reviewed by:    pho
>     Tested by:      pho
>     Differential Revision:  https://reviews.freebsd.org/D60134
>     MFC after:      1 month
>
This fails to build for me (amd64):

	--- all_subdir_tests/sys/fs/ufs ---
	/usr/src/tests/sys/fs/ufs/sync_test.c:226:9: error: cast from 'uint8_t 
*' (aka 'unsigned char *') to 'ufs1_daddr_t *' (aka 'int *') increases 
required alignment from 1 to 4 [-Werror,-Wcast-align]
	  226 |                             ((ufs1_daddr_t *)buf)[lbn - 
UFS_NDADDR] :
	      |                              ^~~~~~~~~~~~~~~~~~~
	/usr/src/tests/sys/fs/ufs/sync_test.c:227:9: error: cast from 'uint8_t 
*' (aka 'unsigned char *') to 'ufs2_daddr_t *' (aka 'long *') increases 
required alignment from 1 to 8 [-Werror,-Wcast-align]
	  227 |                             ((ufs2_daddr_t *)buf)[lbn - 
UFS_NDADDR];
	      |                              ^~~~~~~~~~~~~~~~~~~

—
Kristof