Message ID | 162194968267.4011860.3593730881184557924.stgit@warthog.procyon.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for using xfstests to test AFS | expand |
On Tue, May 25, 2021 at 02:34:42PM +0100, David Howells wrote: > generic/465 will fail if the minimun DIO alignment is less than the minimum > size permitted by the posix_memalign() syscall calls made in > aio-dio-append-write-read-race. AFS has a DIO alignment of 1. > > Fix this by setting the minimum alignment to sizeof(long). > > Signed-off-by: David Howells <dhowells@redhat.com> I wonder if you ought to just change the posix_memalign call to match (somewhat more closely) what the other directio testers do: ret = posix_memalign((void **)&wbuf, sysconf(_SC_PAGESIZE), blksize); Since the alignment of the memory buffer doesn't necessarily have anything to do with the alignment of the read/write offset. (Longer term it would be /really/ nice to hoist DIOINFO to all the filesystems, and refactor fstests to use it consistently, but that's way too big of a request for this patchset.) --D > --- > > .../aio-dio-append-write-read-race.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/aio-dio-regress/aio-dio-append-write-read-race.c b/src/aio-dio-regress/aio-dio-append-write-read-race.c > index 911f2723..8268fb4e 100644 > --- a/src/aio-dio-regress/aio-dio-append-write-read-race.c > +++ b/src/aio-dio-regress/aio-dio-append-write-read-race.c > @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) > int i, j, c; > int use_aio = 1; > int ret = 0; > - int io_align = 4096; > + int io_align = 4096, mem_align; > char *prog; > char *testfile; > > @@ -146,14 +146,15 @@ int main(int argc, char *argv[]) > goto err; > } > > - ret = posix_memalign((void **)&wbuf, io_align, blksize); > + mem_align = (io_align >= sizeof(long) ? io_align : sizeof(long)); > + ret = posix_memalign((void **)&wbuf, mem_align, blksize); > if (ret) { > fail("failed to alloc memory: %s\n", strerror(ret)); > ret = 1; > goto err; > } > > - ret = posix_memalign((void **)&rbuf, io_align, blksize); > + ret = posix_memalign((void **)&rbuf, mem_align, blksize); > if (ret) { > fail("failed to alloc memory: %s\n", strerror(ret)); > ret = 1; > >
Darrick J. Wong <djwong@kernel.org> wrote: > I wonder if you ought to just change the posix_memalign call to match > (somewhat more closely) what the other directio testers do: > > ret = posix_memalign((void **)&wbuf, sysconf(_SC_PAGESIZE), blksize); > > Since the alignment of the memory buffer doesn't necessarily have > anything to do with the alignment of the read/write offset. Fine by me, but I don't know if someone specifically wanted it to work like this. > (Longer term it would be /really/ nice to hoist DIOINFO to all the > filesystems, and refactor fstests to use it consistently, but that's way > too big of a request for this patchset.) One thing I wanted for fsinfo() it to use the information exported by that to inform testsuites of what a filesystem's capabilities are. David
diff --git a/src/aio-dio-regress/aio-dio-append-write-read-race.c b/src/aio-dio-regress/aio-dio-append-write-read-race.c index 911f2723..8268fb4e 100644 --- a/src/aio-dio-regress/aio-dio-append-write-read-race.c +++ b/src/aio-dio-regress/aio-dio-append-write-read-race.c @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) int i, j, c; int use_aio = 1; int ret = 0; - int io_align = 4096; + int io_align = 4096, mem_align; char *prog; char *testfile; @@ -146,14 +146,15 @@ int main(int argc, char *argv[]) goto err; } - ret = posix_memalign((void **)&wbuf, io_align, blksize); + mem_align = (io_align >= sizeof(long) ? io_align : sizeof(long)); + ret = posix_memalign((void **)&wbuf, mem_align, blksize); if (ret) { fail("failed to alloc memory: %s\n", strerror(ret)); ret = 1; goto err; } - ret = posix_memalign((void **)&rbuf, io_align, blksize); + ret = posix_memalign((void **)&rbuf, mem_align, blksize); if (ret) { fail("failed to alloc memory: %s\n", strerror(ret)); ret = 1;
generic/465 will fail if the minimun DIO alignment is less than the minimum size permitted by the posix_memalign() syscall calls made in aio-dio-append-write-read-race. AFS has a DIO alignment of 1. Fix this by setting the minimum alignment to sizeof(long). Signed-off-by: David Howells <dhowells@redhat.com> --- .../aio-dio-append-write-read-race.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)