All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: David Howells <dhowells@redhat.com>
Cc: fstests@vger.kernel.org, linux-afs@lists.infradead.org
Subject: Re: [PATCH 8/9] generic/465: Fix handling of DIO alignment < sizeof(long)
Date: Tue, 25 May 2021 09:25:14 -0700	[thread overview]
Message-ID: <20210525162514.GH202095@locust> (raw)
In-Reply-To: <162194968267.4011860.3593730881184557924.stgit@warthog.procyon.org.uk>

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;
> 
> 

  reply	other threads:[~2021-05-25 16:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 13:33 [PATCH 0/9] Add support for using xfstests to test AFS David Howells
2021-05-25 13:33 ` [PATCH 1/9] Add AFS support David Howells
2021-05-25 13:34 ` [PATCH 2/9] generic/294, afs: Allow for mknod subtest failing if mknod not supported David Howells
2021-05-25 16:09   ` Darrick J. Wong
2021-05-25 16:19   ` David Howells
2021-05-25 16:26     ` Darrick J. Wong
2021-05-30 12:49   ` Eryu Guan
2021-06-01 14:31   ` David Howells
2021-06-06 11:58     ` Eryu Guan
2021-05-25 13:34 ` [PATCH 3/9] generic/314, afs: Allow for a filesystem that doesn't honour SGID inheritance David Howells
2021-05-25 16:10   ` Darrick J. Wong
2021-05-25 13:34 ` [PATCH 4/9] generic/317, afs: Allow for a filesystem not to honour the local uid/gid David Howells
2021-05-25 16:17   ` Darrick J. Wong
2021-05-25 16:41   ` David Howells
2021-05-25 13:34 ` [PATCH 5/9] generic/123, generic/128, afs: Allow for an fs that does its own perm management David Howells
2021-05-25 16:19   ` Darrick J. Wong
2021-05-25 16:44   ` David Howells
2021-05-25 16:51     ` Darrick J. Wong
2021-05-25 13:34 ` [PATCH 6/9] Add the ability to require O_TMPFILE to be supported for a test David Howells
2021-05-25 16:19   ` Darrick J. Wong
2021-05-30 12:54   ` Eryu Guan
2021-05-25 13:34 ` [PATCH 7/9] afs: Indicate the minimum DIO alignment is 1 David Howells
2021-05-25 13:34 ` [PATCH 8/9] generic/465: Fix handling of DIO alignment < sizeof(long) David Howells
2021-05-25 16:25   ` Darrick J. Wong [this message]
2021-05-25 16:46   ` David Howells
2021-05-25 13:34 ` [PATCH 9/9] Fix other posix_memalign() alignment issues David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210525162514.GH202095@locust \
    --to=djwong@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-afs@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.