* [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported
@ 2024-09-23 6:37 Wu Bo
2024-09-23 7:43 ` [f2fs-dev] " Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Wu Bo @ 2024-09-23 6:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, Wu Bo, Wu Bo
According to the definition of statx.stx_mask:
It simply informs the caller which values are supported by the kernel
and filesystem via the statx.stx_mask field.
(quote from the "Linux Programmer's Manual").
Therefore, if the filesystem does not support DIO, it should not set
the STATX_DIOALIGN flag.
Signed-off-by: Wu Bo <bo.wu@vivo.com>
---
fs/f2fs/file.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 168f08507004..bbb66be0deba 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -908,14 +908,13 @@ int f2fs_getattr(struct mnt_idmap *idmap, const struct path *path,
* f2fs sometimes supports DIO reads but not DIO writes. STATX_DIOALIGN
* cannot represent that, so in that case we report no DIO support.
*/
- if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
+ if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode) &&
+ !f2fs_force_buffered_io(inode, WRITE)) {
unsigned int bsize = i_blocksize(inode);
stat->result_mask |= STATX_DIOALIGN;
- if (!f2fs_force_buffered_io(inode, WRITE)) {
- stat->dio_mem_align = bsize;
- stat->dio_offset_align = bsize;
- }
+ stat->dio_mem_align = bsize;
+ stat->dio_offset_align = bsize;
}
flags = fi->i_flags;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported
2024-09-23 6:37 [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported Wu Bo
@ 2024-09-23 7:43 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2024-09-23 7:43 UTC (permalink / raw)
To: Wu Bo; +Cc: linux-kernel, Wu Bo, Jaegeuk Kim, linux-f2fs-devel
On Mon, Sep 23, 2024 at 12:37:32AM -0600, Wu Bo via Linux-f2fs-devel wrote:
> Therefore, if the filesystem does not support DIO, it should not set
> the STATX_DIOALIGN flag.
No, that's incorrect. STATX_DIOALIGN supports reporting that DIO is
unsupported, via the alignments being 0. See the statx man page.
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-23 7:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-23 6:37 [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported Wu Bo
2024-09-23 7:43 ` [f2fs-dev] " Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®