aio-dio-append-write-fallocate-race: fix directio buffer alignment bugs

This program fails on filesystems where the stat() block size isn't a
strict power of two because it foolishly feeds that to posix_memalign to
allocate an aligned memory buffer for directio.  posix_memalign requires
the alignment value to be a power of two, so generic/586 fails.

The system page size generally works well for directio buffers, so use
that instead.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2021-05-19 16:57:16 -07:00
committed by Eryu Guan
parent 993887b25c
commit 74128e70c4
@@ -65,7 +65,7 @@ test(
}
blocksize = sbuf.st_blksize;
ret = posix_memalign((void **)&buf, blocksize, blocksize);
ret = posix_memalign((void **)&buf, sysconf(_SC_PAGESIZE), blocksize);
if (ret) {
errno = ret;
perror("buffer");