Re: [PATCH v3] selftests/mm: skip hugetlb_dio tests when DIO alignment is incompatible

Li Wang
2026-03-30T11:57:42Z

On Mon, Mar 30, 2026 at 07:35:50PM +0800, Li Wang wrote:
> > > 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.

Oh, I suddenly realized that you meant to store it in a local and forward
it through to check_dio_alignment() and run_test() as an explicit argument.

Sure, I'm ok with that minor change:

int main(void)
{
...

alignment = get_dio_alignment(fd);
if (alignment < 0)
ksft_exit_skip(...);

run_test(fd, start_off, end_off, alignment);
}

--
Regards,
Li Wang