On 8/29/23 19:53, Matthew Wilcox wrote:
On Tue, Aug 29, 2023 at 03:46:13PM +0800, Hao Xu wrote:
On 8/28/23 05:32, Matthew Wilcox wrote:
On Sun, Aug 27, 2023 at 09:28:31PM +0800, Hao Xu wrote:
From: Hao Xu
Add a boolean parameter for file_accessed() to support nowait semantics.
Currently it
From: Hao Xu
Add a boolean parameter for file_accessed() to support nowait semantics.
Currently it is true only with io_uring as its initial caller.
Signed-off-by: Hao Xu
---
arch/s390/hypfs/inode.c | 2 +-
block/fops.c| 2 +-
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c
From: Hao Xu
Choose different gfp flags to support nowait memory allocation in
_xfs_buf_alloc().
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 9f84bc3b802c..8b800ce28996 100644
From: Hao Xu
Add a nowait boolean parameter for touch_atime() to support nowait
semantics. It is true only when io_uring is the initial caller.
Signed-off-by: Hao Xu
---
fs/cachefiles/namei.c | 2 +-
fs/ecryptfs/file.c| 4 ++--
fs/inode.c| 7 ---
fs/namei.c| 4
From: Hao Xu
This causes xfstests generic/232 hung in umount process, waiting for ail
push, so I comment it for now, need some hints from xfs folks.
Not a real patch.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/fs/xfs/xfs_buf.c b/fs
From: Hao Xu
vmalloc() always succeed in 64 bit system?
Not a real patch.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_log_cil.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index f17c1799b3c4..b31830ee36dd 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b
From: Hao Xu
Apply trylock logic for xc_ctx_lock in xlog_cil_commit() in nowait
case and error out -EAGAIN for xlog_cil_commit().
Signed-off-by: Hao Xu
---
fs/xfs/xfs_log_cil.c | 12 ++--
fs/xfs/xfs_log_priv.h | 2 +-
fs/xfs/xfs_trans.c| 4 +++-
3 files changed, 14 insertions
From: Hao Xu
Add nowait parameter for xfs_inode_item_init() to support nowait
semantics.
Signed-off-by: Hao Xu
---
fs/xfs/libxfs/xfs_trans_inode.c | 3 ++-
fs/xfs/xfs_inode_item.c | 12
fs/xfs/xfs_inode_item.h | 3 ++-
3 files changed, 12 insertions(+), 6
On 8/28/23 04:44, Matthew Wilcox wrote:
On Sun, Aug 27, 2023 at 09:28:26PM +0800, Hao Xu wrote:
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2643,16 +2643,32 @@ xfs_da_read_buf(
struct xfs_buf_map map, *mapp = ↦
int nmap = 1;
int
From: Hao Xu
There are locks in xfs_trans_alloc(), spot them and apply trylock logic.
Make them return -EAGAIN when it would block. To achieve this, add
nowait parameter for those functions in the path. Besides, add a generic
transaction flag XFS_TRANS_NOWAIT to deliver nowait info.
Signed-off
From: Hao Xu
Don't sleep and wait for more space for a log ticket in
xlog_grant_head_check() when it is in nowait case.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_log.c | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
From: Hao Xu
Move file_accessed() to the beginning of iterate_dir() so that we don't
need to rollback all the work done when file_accessed() returns -EAGAIN
at the end of getdents.
Signed-off-by: Hao Xu
---
fs/readdir.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --
From: Hao Xu
Implement NOWAIT semantics for readdir. Return EAGAIN error to the
caller if it would block, like failing to get locks, or going to
do IO.
Co-developed-by: Dave Chinner
Signed-off-by: Dave Chinner
Signed-off-by: Hao Xu
[fixes deadlock issue, tweak code style]
---
fs/xfs/libxfs
From: Hao Xu
Implement NOWAIT semantics for readdir. Return EAGAIN error to the
caller if it would block, like failing to get locks, or going to
do IO.
Co-developed-by: Dave Chinner
Signed-off-by: Dave Chinner
Signed-off-by: Hao Xu
[fixes deadlock issue, tweak code style]
---
fs/xfs/libxfs
From: Hao Xu
Add a vfs helper file_pos_lock_nowait() for io_uring usage. The function
have conditional nowait logic, i.e. if nowait is needed, return -EAGAIN
when trylock fails.
Signed-off-by: Hao Xu
---
fs/file.c| 13 +
include/linux/file.h | 2 ++
2 files changed
From: Hao Xu
Move file_accessed() to the beginning of iterate_dir() so that we don't
need to rollback all the work done when file_accessed() returns -EAGAIN
at the end of getdents.
Signed-off-by: Hao Xu
---
fs/readdir.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --
On 8/28/23 05:32, Matthew Wilcox wrote:
On Sun, Aug 27, 2023 at 09:28:31PM +0800, Hao Xu wrote:
From: Hao Xu
Add a boolean parameter for file_accessed() to support nowait semantics.
Currently it is true only with io_uring as its initial caller.
So why do we need to do this as part of this
From: Hao Xu
Add comments for page allocation in nowait case in xfs_buf_find_insert()
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index eb3cd7702545..57bdc4c5dde1 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs
From: Hao Xu
Set XBF_NOWAIT for xfs_buf_read_map() if necessary.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_trans_buf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 6549e50d852c..016371f58f26 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs
From: Hao Xu
support nowait for xfs_buf_item_init() and error out -EAGAIN to
_xfs_trans_bjoin() when it would block.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf_item.c | 9 +++--
fs/xfs/xfs_buf_item.h | 2 +-
fs/xfs/xfs_buf_item_recover.c | 2 +-
fs/xfs/xfs_trans_buf.c
From: Hao Xu
Change return value of xfs_trans_ijoin() to error out -EAGAIN.
Signed-off-by: Hao Xu
---
fs/xfs/libxfs/xfs_trans_inode.c | 13 +
fs/xfs/xfs_iops.c | 4 +++-
fs/xfs/xfs_trans.h | 2 +-
3 files changed, 13 insertions(+), 6 deletions(-)
diff
From: Hao Xu
Trylock inode->i_rwsem in iterate_dir() to support nowait semantics and
error out -EAGAIN when there is contention.
Signed-off-by: Hao Xu
---
fs/readdir.c | 20 ++--
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/readdir.c b/fs/readdir.c
in
From: Hao Xu
Rather than wait for a moment and retry, we return -EAGAIN when we fail
to allocate bulk memory in xfs_buf_alloc_pages() in nowait case.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf.c | 5 +
1 file changed, 5 insertions(+)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index
From: Hao Xu
XBF_TRYLOCK means we need lock but don't block on it, we can use it to
stand for not waiting for memory allcation. Rename XBF_TRYLOCK to
XBF_NOWAIT, which is more generic.
Signed-off-by: Hao Xu
---
fs/xfs/libxfs/xfs_alloc.c | 2 +-
fs/xfs/libxfs/xfs_attr_remote.c | 2 +
From: Hao Xu
Add a new time flag S_NOWAIT to support nowait time update. Deliver it
to specific filesystem and error out -EAGAIN when it would block.
Signed-off-by: Hao Xu
---
fs/inode.c | 9 +
fs/xfs/xfs_iops.c | 8 +++-
include/linux/fs.h | 1 +
3 files changed, 13
From: Hao Xu
This add support for getdents64 to io_uring, acting exactly like the
syscall: the directory is iterated from it's current's position as
stored in the file struct, and the file's position is updated exactly as
if getdents64 had been called.
For filesystems that su
From: Hao Xu
Support nowait logic for xfs_log_reserve(), including add a nowait
boolean parameter and error out -EAGAIN for ticket allocation.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_log.c | 18 +-
fs/xfs/xfs_log.h | 5 +++--
fs/xfs/xfs_log_cil.c | 2 +-
fs/xfs
From: Hao Xu
The flags will allow passing DIR_CONTEXT_F_NOWAIT to iterate()
implementations that support it (as signaled through FMODE_NWAIT
in file->f_mode)
Notes:
- considered using IOCB_NOWAIT but if we add more flags later it
would be confusing to keep track of which values are valid,
From: Hao Xu
To enforce nowait semantics, error out -EAGAIN if atime needs to be
updated.
Signed-off-by: Hao Xu
---
fs/inode.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/inode.c b/fs/inode.c
index e83b836f2d09..32d81be65cf9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1970,6
From: Hao Xu
Add a vfs helper file_pos_lock_nowait() for io_uring usage. The function
have conditional nowait logic, i.e. if nowait is needed, return -EAGAIN
when trylock fails.
Signed-off-by: Hao Xu
---
fs/file.c| 13 +
include/linux/file.h | 2 ++
2 files changed
From: Hao Xu
Trylock inode->i_rwsem in iterate_dir() to support nowait semantics and
error out -EAGAIN when there is contention.
Signed-off-by: Hao Xu
---
fs/readdir.c | 20 ++--
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/readdir.c b/fs/readdir.c
in
From: Hao Xu
Add a nowait boolean parameter for touch_atime() to support nowait
semantics. It is true only when io_uring is the initial caller.
Signed-off-by: Hao Xu
---
fs/cachefiles/namei.c | 2 +-
fs/ecryptfs/file.c| 4 ++--
fs/inode.c| 7 ---
fs/namei.c| 4
From: Hao Xu
if the log transaction is a sync one, let's fail the nowait try and
return -EAGAIN directly since sync transaction means blocked by IO.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_trans.c | 14 +-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/f
From: Hao Xu
Add a helper to unlock f_pos_lock without any condition. Introduce this
since io_uring handles f_pos_lock not with a fd struct, thus
FDPUT_POS_UNLOCK isn't used.
Signed-off-by: Hao Xu
---
include/linux/file.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/
From: Hao Xu
-EAGAIN is internal error to indicate a retry, no needs to print a
warn.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_buf.c | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 57bdc4c5dde1..cdad80e1ae25 100644
--- a/fs/xfs
From: Hao Xu
This series introduce getdents64 to io_uring, the code logic is similar
with the snychronized version's. It first try nowait issue, and offload
it to io-wq threads if the first try fails.
Patch1 and Patch2 are some preparation
Patch3 supports nowait for xfs getdents code
Patc
From: Hao Xu
This add support for getdents64 to io_uring, acting exactly like the
syscall: the directory is iterated from it's current's position as
stored in the file struct, and the file's position is updated exactly as
if getdents64 had been called.
For filesystems that su
From: Hao Xu
This series introduce getdents64 to io_uring, the code logic is similar
with the snychronized version's. It first try nowait issue, and offload
it to io-wq threads if the first try fails.
Patch1 and Patch2 are some preparation
Patch3 supports nowait for xfs getdents code
Patc
From: Hao Xu
Previously, if we fail to get the memory we need, -ENOMEM is returned.
It can be -EAGAIN now since we support nowait now. Return the latter
when it is the case. Involved functions are: _xfs_buf_map_pages(),
xfs_buf_get_maps(), xfs_buf_alloc_kmem() and xfs_buf_alloc_pages().
Signed
From: Hao Xu
Add a helper to unlock f_pos_lock without any condition. Introduce this
since io_uring handles f_pos_lock not with a fd struct, thus
FDPUT_POS_UNLOCK isn't used.
Signed-off-by: Hao Xu
---
include/linux/file.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/
From: Hao Xu
Add a boolean parameter for file_accessed() to support nowait semantics.
Currently it is true only with io_uring as its initial caller.
Signed-off-by: Hao Xu
---
arch/s390/hypfs/inode.c | 2 +-
block/fops.c| 2 +-
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c
From: Dominique Martinet
This splits off the vfs_getdents function from the getdents64 system
call.
This will allow io_uring to call the vfs_getdents function.
Co-developed-by: Stefan Roesch
Signed-off-by: Stefan Roesch
Signed-off-by: Dominique Martinet
Signed-off-by: Hao Xu
---
fs
From: Dominique Martinet
This splits off the vfs_getdents function from the getdents64 system
call.
This will allow io_uring to call the vfs_getdents function.
Co-developed-by: Stefan Roesch
Signed-off-by: Stefan Roesch
Signed-off-by: Dominique Martinet
Signed-off-by: Hao Xu
---
fs
From: Hao Xu
The flags will allow passing DIR_CONTEXT_F_NOWAIT to iterate()
implementations that support it (as signaled through FMODE_NWAIT
in file->f_mode)
Notes:
- considered using IOCB_NOWAIT but if we add more flags later it
would be confusing to keep track of which values are valid,
From: Hao Xu
Enforce GFP_NOIO logic implicitly by set pflags if we are in nowait
time update process. Nowait semantics means no waiting for IO,
therefore GFP_NOIO is needed.
Signed-off-by: Hao Xu
---
fs/xfs/xfs_iops.c | 22 +-
1 file changed, 17 insertions(+), 5 deletions
45 matches
Mail list logo