[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230726102603.155522-3-hao.xu@linux.dev>
Date: Wed, 26 Jul 2023 18:25:58 +0800
From: Hao Xu <hao.xu@...ux.dev>
To: io-uring@...r.kernel.org, Jens Axboe <axboe@...nel.dk>
Cc: Dominique Martinet <asmadeus@...ewreck.org>,
Pavel Begunkov <asml.silence@...il.com>,
Christian Brauner <brauner@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Stefan Roesch <shr@...com>, Clay Harris <bugs@...ycon.org>,
Dave Chinner <david@...morbit.com>,
"Darrick J . Wong" <djwong@...nel.org>,
linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-ext4@...r.kernel.org, Wanpeng Li <wanpengli@...cent.com>
Subject: [PATCH 2/7] xfs: add nowait support for xfs_seek_iomap_begin()
From: Hao Xu <howeyxu@...cent.com>
To support nowait llseek(), IOMAP_NOWAIT semantics should be respected.
In xfs, xfs_seek_iomap_begin() is the only place which may be blocked
by ilock and extent loading. Let's turn it into trylock logic just like
what we've done in xfs_readdir().
Signed-off-by: Hao Xu <howeyxu@...cent.com>
---
fs/xfs/xfs_iomap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 18c8f168b153..bbd7c6b27701 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1294,7 +1294,9 @@ xfs_seek_iomap_begin(
if (xfs_is_shutdown(mp))
return -EIO;
- lockmode = xfs_ilock_data_map_shared(ip);
+ lockmode = xfs_ilock_data_map_shared_generic(ip, flags & IOMAP_NOWAIT);
+ if (!lockmode)
+ return -EAGAIN;
error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);
if (error)
goto out_unlock;
--
2.25.1
Powered by blists - more mailing lists