From: Li Wang <liwang@redhat.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: akpm@linux-foundation.org, rppt@kernel.org, ljs@kernel.org,
Liam.Howlett@oracle.com, vbabka@kernel.org, surenb@google.com,
mhocko@suse.com, shuah@kernel.org, aubaker@redhat.com,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3] selftests/mm: skip hugetlb_dio tests when DIO alignment is incompatible
Date: Mon, 30 Mar 2026 19:35:50 +0800 [thread overview]
Message-ID: <acpgFlG4qj646hYp@redhat.com> (raw)
In-Reply-To: <a1054c28-b574-4fcc-afe9-5e902209a22c@kernel.org>
> > int main(void)
> > {
> > ...
> > fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664);
> > if (fd < 0)
> > ksft_exit_skip("Unable to allocate file: %s\n", strerror(errno));
> >
> > if (get_dio_alignment(fd) < 0)
>
> I would suggest that you query the alignment only once, and forward it
> to the test.
Sure thing, I declare a global variable 'dio_offset_align' to get the value
only once via get_dio_alignment(fd).
(sorry for not posting in the above email)
static unsigned int dio_offset_align;
static int get_dio_alignment(int fd)
{
struct statx stx;
int ret;
ret = syscall(__NR_statx, fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx);
if (ret < 0)
return -1;
if (!(stx.stx_mask & STATX_DIOALIGN) || !stx.stx_dio_offset_align)
dio_offset_align = 1;
else
dio_offset_align = stx.stx_dio_offset_align;
return 0;
}
--
Regards,
Li Wang
next prev parent reply other threads:[~2026-03-30 11:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 5:39 [PATCH v3] selftests/mm: skip hugetlb_dio tests when DIO alignment is incompatible Li Wang
2026-03-30 6:02 ` David Hildenbrand (Arm)
2026-03-30 7:23 ` Li Wang
2026-03-30 10:10 ` Li Wang
2026-03-30 10:43 ` David Hildenbrand (Arm)
2026-03-30 11:35 ` Li Wang [this message]
2026-03-30 11:57 ` Li Wang
2026-03-30 9:58 ` Li Wang
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=acpgFlG4qj646hYp@redhat.com \
--to=liwang@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=aubaker@redhat.com \
--cc=david@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.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.