Skip to contentSkip to conversation

check stx_dio_offset_align to determine if DIO is supported

PATCH In review Wu Bo 3 participants 5 messages Sep 23, 2024 – Oct 11, 2024

lore
Share & tools
lore

Wu Bo

author
#0 lore raw

PATCH 1/1 check stx_dio_offset_align to determine if DIO is supported

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.

---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/min_dio_alignment.c +1 -1
index 131f6023..c50ae8c3 100644
@@ -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;
 
 	/*
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Wu Bo

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/[email protected]/

(but not merged yet)

Thanks.

Quoted 23 lines
---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/min_dio_alignment.c +1 -2
index 131f6023..c50ae8c3 100644
@@ -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

#2 lore raw
Quoted 10 lines · Filipe Manana
Quoted 3 lines · Wu Bo

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/[email protected]/

(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

Quoted 27 lines

Thanks.

Quoted 23 lines
---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/min_dio_alignment.c +1 -2
index 131f6023..c50ae8c3 100644
@@ -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

#3 lore raw
Quoted 9 lines · Zorro Lang
Quoted 7 lines · Filipe Manana
Quoted 3 lines · Wu Bo

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:

Quoted 7 lines
Quoted 3 lines

https://lore.kernel.org/fstests/[email protected]/

(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.

Quoted 32 lines

Thanks,
Zorro

Quoted 27 lines

Thanks.

Quoted 23 lines
---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/min_dio_alignment.c +1 -2
index 131f6023..c50ae8c3 100644
@@ -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

#4 lore raw
Quoted 12 lines · Filipe Manana
Quoted 11 lines · Zorro Lang
Quoted 9 lines · Filipe Manana
Quoted 3 lines · Wu Bo

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/[email protected]/

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

(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 :)

Quoted 36 lines

Thanks.

Quoted 32 lines

Thanks,
Zorro

Quoted 27 lines

Thanks.

Quoted 23 lines
---
 src/min_dio_alignment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/min_dio_alignment.c +1 -2
index 131f6023..c50ae8c3 100644
@@ -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