public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: [email protected], Jens Axboe <[email protected]>
Cc: Dominique Martinet <[email protected]>,
	Pavel Begunkov <[email protected]>,
	Christian Brauner <[email protected]>,
	Alexander Viro <[email protected]>,
	Stefan Roesch <[email protected]>, Clay Harris <[email protected]>,
	Dave Chinner <[email protected]>,
	"Darrick J . Wong" <[email protected]>,
	[email protected], [email protected],
	[email protected], Wanpeng Li <[email protected]>
Subject: [PATCH 5/7] add llseek_nowait support for xfs
Date: Wed, 26 Jul 2023 18:26:01 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Hao Xu <[email protected]>

Add llseek_nowait() operation for xfs, it acts just like llseek(). The
thing different is it delivers nowait parameter to iomap layer.

Signed-off-by: Hao Xu <[email protected]>
---
 fs/xfs/xfs_file.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 73adc0aee2ff..cba82264221d 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1257,10 +1257,11 @@ xfs_file_readdir(
 }
 
 STATIC loff_t
-xfs_file_llseek(
+__xfs_file_llseek(
 	struct file	*file,
 	loff_t		offset,
-	int		whence)
+	int		whence,
+	bool		nowait)
 {
 	struct inode		*inode = file->f_mapping->host;
 
@@ -1282,6 +1283,28 @@ xfs_file_llseek(
 	return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
 }
 
+STATIC loff_t
+xfs_file_llseek(
+	struct file	*file,
+	loff_t		offset,
+	int		whence)
+{
+	return __xfs_file_llseek(file, offset, whence, false);
+}
+
+STATIC loff_t
+xfs_file_llseek_nowait(
+	struct file	*file,
+	loff_t		offset,
+	int		whence,
+	bool		nowait)
+{
+	if (file->f_op == &xfs_file_operations)
+		return __xfs_file_llseek(file, offset, whence, nowait);
+	else
+		return generic_file_llseek(file, offset, whence);
+}
+
 #ifdef CONFIG_FS_DAX
 static inline vm_fault_t
 xfs_dax_fault(
@@ -1442,6 +1465,7 @@ xfs_file_mmap(
 
 const struct file_operations xfs_file_operations = {
 	.llseek		= xfs_file_llseek,
+	.llseek_nowait	= xfs_file_llseek_nowait,
 	.read_iter	= xfs_file_read_iter,
 	.write_iter	= xfs_file_write_iter,
 	.splice_read	= xfs_file_splice_read,
@@ -1467,6 +1491,7 @@ const struct file_operations xfs_dir_file_operations = {
 	.read		= generic_read_dir,
 	.iterate_shared	= xfs_file_readdir,
 	.llseek		= generic_file_llseek,
+	.llseek_nowait	= xfs_file_llseek_nowait,
 	.unlocked_ioctl	= xfs_file_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= xfs_file_compat_ioctl,
-- 
2.25.1


  parent reply	other threads:[~2023-07-26 10:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 10:25 [RFC 0/7] io_uring lseek Hao Xu
2023-07-26 10:25 ` [PATCH 1/7] iomap: merge iomap_seek_hole() and iomap_seek_data() Hao Xu
2023-07-26 21:50   ` Dave Chinner
2023-07-27 12:10     ` Hao Xu
2023-07-26 10:25 ` [PATCH 2/7] xfs: add nowait support for xfs_seek_iomap_begin() Hao Xu
2023-07-26 21:55   ` Dave Chinner
2023-07-26 22:14     ` Darrick J. Wong
2023-07-27 12:17       ` Hao Xu
2023-07-26 10:25 ` [PATCH 3/7] add nowait parameter for iomap_seek() Hao Xu
2023-07-26 22:01   ` Dave Chinner
2023-07-26 10:26 ` [PATCH 4/7] add llseek_nowait() for struct file_operations Hao Xu
2023-07-27 13:25   ` Matthew Wilcox
2023-07-26 10:26 ` Hao Xu [this message]
2023-07-26 22:14   ` [PATCH 5/7] add llseek_nowait support for xfs Dave Chinner
2023-07-27 12:26     ` Hao Xu
2023-07-26 10:26 ` [PATCH 6/7] add vfs_lseek_nowait() Hao Xu
2023-07-26 10:26 ` [PATCH 7/7] add lseek for io_uring Hao Xu
2023-07-26 13:22 ` [RFC 0/7] io_uring lseek Christian Brauner
2023-07-27 12:30 ` Hao Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox