diff mbox series

check stx_dio_offset_align to determine if DIO is supported

Message ID 20240923090607.953579-1-wubo.oduw@gmail.com (mailing list archive)
State New, archived
Headers show
Series check stx_dio_offset_align to determine if DIO is supported | expand

Commit Message

Wu Bo Sept. 23, 2024, 9:06 a.m. UTC
According to the statx manual, if stx_dio_offset_align is 0, it
indicates that Direct I/O (DIO) is not supported on this file.

Signed-off-by: Wu Bo <wubo.oduw@gmail.com>
---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Filipe Manana Sept. 23, 2024, 11:01 a.m. UTC | #1
On Mon, Sep 23, 2024 at 10:06 AM Wu Bo <wubo.oduw@gmail.com> wrote:
>
> According to the statx manual, if stx_dio_offset_align is 0, it
> indicates that Direct I/O (DIO) is not supported on this file.

There's already a patch for this:

https://lore.kernel.org/fstests/20240911035333.364961-1-chao@kernel.org/

(but not merged yet)

Thanks.

>
> Signed-off-by: Wu Bo <wubo.oduw@gmail.com>
> ---
>  src/min_dio_alignment.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
> index 131f6023..c50ae8c3 100644
> --- a/src/min_dio_alignment.c
> +++ b/src/min_dio_alignment.c
> @@ -28,7 +28,7 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
>         fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
>         if (fd >= 0 &&
>             xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> -           (stx.stx_mask & STATX_DIOALIGN))
> +           (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align)
>                 return stx.stx_dio_offset_align;
>
>         /*
> --
> 2.34.1
>
>
Zorro Lang Sept. 23, 2024, 1:46 p.m. UTC | #2
On Mon, Sep 23, 2024 at 12:01:22PM +0100, Filipe Manana wrote:
> On Mon, Sep 23, 2024 at 10:06 AM Wu Bo <wubo.oduw@gmail.com> wrote:
> >
> > According to the statx manual, if stx_dio_offset_align is 0, it
> > indicates that Direct I/O (DIO) is not supported on this file.
> 
> There's already a patch for this:
> 
> https://lore.kernel.org/fstests/20240911035333.364961-1-chao@kernel.org/
> 
> (but not merged yet)

Thanks Filipe. Yes, this's fixed by Chao Yu. You can check it in
"patches-in-queue" branch, it'll be merged to for-next soon (this
week I hope).

Thanks,
Zorro

> 
> Thanks.
> 
> >
> > Signed-off-by: Wu Bo <wubo.oduw@gmail.com>
> > ---
> >  src/min_dio_alignment.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
> > index 131f6023..c50ae8c3 100644
> > --- a/src/min_dio_alignment.c
> > +++ b/src/min_dio_alignment.c
> > @@ -28,7 +28,7 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
> >         fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
> >         if (fd >= 0 &&
> >             xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> > -           (stx.stx_mask & STATX_DIOALIGN))
> > +           (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align)
> >                 return stx.stx_dio_offset_align;
> >
> >         /*
> > --
> > 2.34.1
> >
> >
>
Filipe Manana Oct. 7, 2024, 12:14 p.m. UTC | #3
On Mon, Sep 23, 2024 at 2:46 PM Zorro Lang <zlang@redhat.com> wrote:
>
> On Mon, Sep 23, 2024 at 12:01:22PM +0100, Filipe Manana wrote:
> > On Mon, Sep 23, 2024 at 10:06 AM Wu Bo <wubo.oduw@gmail.com> wrote:
> > >
> > > According to the statx manual, if stx_dio_offset_align is 0, it
> > > indicates that Direct I/O (DIO) is not supported on this file.
> >
> > There's already a patch for this:
> >
> > https://lore.kernel.org/fstests/20240911035333.364961-1-chao@kernel.org/
> >
> > (but not merged yet)
>
> Thanks Filipe. Yes, this's fixed by Chao Yu. You can check it in
> "patches-in-queue" branch, it'll be merged to for-next soon (this
> week I hope).

It missed the last update and it's still not in the "patches-in-queue" branch.

Thanks.

>
> Thanks,
> Zorro
>
> >
> > Thanks.
> >
> > >
> > > Signed-off-by: Wu Bo <wubo.oduw@gmail.com>
> > > ---
> > >  src/min_dio_alignment.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
> > > index 131f6023..c50ae8c3 100644
> > > --- a/src/min_dio_alignment.c
> > > +++ b/src/min_dio_alignment.c
> > > @@ -28,7 +28,7 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
> > >         fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
> > >         if (fd >= 0 &&
> > >             xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> > > -           (stx.stx_mask & STATX_DIOALIGN))
> > > +           (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align)
> > >                 return stx.stx_dio_offset_align;
> > >
> > >         /*
> > > --
> > > 2.34.1
> > >
> > >
> >
>
Zorro Lang Oct. 11, 2024, 5:50 a.m. UTC | #4
On Mon, Oct 07, 2024 at 01:14:09PM +0100, Filipe Manana wrote:
> On Mon, Sep 23, 2024 at 2:46 PM Zorro Lang <zlang@redhat.com> wrote:
> >
> > On Mon, Sep 23, 2024 at 12:01:22PM +0100, Filipe Manana wrote:
> > > On Mon, Sep 23, 2024 at 10:06 AM Wu Bo <wubo.oduw@gmail.com> wrote:
> > > >
> > > > According to the statx manual, if stx_dio_offset_align is 0, it
> > > > indicates that Direct I/O (DIO) is not supported on this file.
> > >
> > > There's already a patch for this:
> > >
> > > https://lore.kernel.org/fstests/20240911035333.364961-1-chao@kernel.org/
> > >
> > > (but not merged yet)
> >
> > Thanks Filipe. Yes, this's fixed by Chao Yu. You can check it in
> > "patches-in-queue" branch, it'll be merged to for-next soon (this
> > week I hope).
> 
> It missed the last update and it's still not in the "patches-in-queue" branch.

Yes, sorry I missed that patch, my bad. It'll be in the release of this weekend,
I'm sure about that :)

> 
> Thanks.
> 
> >
> > Thanks,
> > Zorro
> >
> > >
> > > Thanks.
> > >
> > > >
> > > > Signed-off-by: Wu Bo <wubo.oduw@gmail.com>
> > > > ---
> > > >  src/min_dio_alignment.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
> > > > index 131f6023..c50ae8c3 100644
> > > > --- a/src/min_dio_alignment.c
> > > > +++ b/src/min_dio_alignment.c
> > > > @@ -28,7 +28,7 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
> > > >         fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
> > > >         if (fd >= 0 &&
> > > >             xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> > > > -           (stx.stx_mask & STATX_DIOALIGN))
> > > > +           (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align)
> > > >                 return stx.stx_dio_offset_align;
> > > >
> > > >         /*
> > > > --
> > > > 2.34.1
> > > >
> > > >
> > >
> >
>
diff mbox series

Patch

diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
index 131f6023..c50ae8c3 100644
--- a/src/min_dio_alignment.c
+++ b/src/min_dio_alignment.c
@@ -28,7 +28,7 @@  static int min_dio_alignment(const char *mntpnt, const char *devname)
 	fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
 	if (fd >= 0 &&
 	    xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
-	    (stx.stx_mask & STATX_DIOALIGN))
+	    (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align)
 		return stx.stx_dio_offset_align;
 
 	/*