[PATCH 054/437] net: sunrpc: convert to read/write iterators

Jens Axboe
2024-04-11T15:33:14Z

net/sunrpc/cache.c | 14 +++++++++-----
net/sunrpc/debugfs.c | 4 ++--
net/sunrpc/rpc_pipe.c | 8 +++++---
3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 95ff74706104..451b93494585 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1774,6 +1774,7 @@ static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,

return cache_read(filp, buf, count, ppos, cd);
}
+FOPS_READ_ITER_HELPER(cache_read_pipefs);

static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
@@ -1782,6 +1783,7 @@ static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf,

return cache_write(filp, buf, count, ppos, cd);
}
+FOPS_WRITE_ITER_HELPER(cache_write_pipefs);

static __poll_t cache_poll_pipefs(struct file *filp, poll_table *wait)
{
@@ -1816,8 +1818,8 @@ static int cache_release_pipefs(struct inode *inode, struct file *filp)
const struct file_operations cache_file_operations_pipefs = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .read = cache_read_pipefs,
- .write = cache_write_pipefs,
+ .read_iter = cache_read_pipefs_iter,
+ .write_iter = cache_write_pipefs_iter,
.poll = cache_poll_pipefs,
.unlocked_ioctl = cache_ioctl_pipefs, /* for FIONREAD */
.open = cache_open_pipefs,
@@ -1840,7 +1842,7 @@ static int content_release_pipefs(struct inode *inode, struct file *filp)

const struct file_operations content_file_operations_pipefs = {
.open = content_open_pipefs,
- .read = seq_read,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = content_release_pipefs,
};
@@ -1866,6 +1868,7 @@ static ssize_t read_flush_pipefs(struct file *filp, char __user *buf,

return read_flush(filp, buf, count, ppos, cd);
}
+FOPS_READ_ITER_HELPER(read_flush_pipefs);

static ssize_t write_flush_pipefs(struct file *filp,
const char __user *buf,
@@ -1875,11 +1878,12 @@ static ssize_t write_flush_pipefs(struct file *filp,

return write_flush(filp, buf, count, ppos, cd);
}
+FOPS_WRITE_ITER_HELPER(write_flush_pipefs);

const struct file_operations cache_flush_operations_pipefs = {
.open = open_flush_pipefs,
- .read = read_flush_pipefs,
- .write = write_flush_pipefs,
+ .read_iter = read_flush_pipefs_iter,
+ .write_iter = write_flush_pipefs_iter,
.release = release_flush_pipefs,
.llseek = no_llseek,
};
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index a176d5a0b0ee..8fb085c614ef 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -112,7 +112,7 @@ tasks_release(struct inode *inode, struct file *filp)
static const struct file_operations tasks_fops = {
.owner = THIS_MODULE,
.open = tasks_open,
- .read = seq_read,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = tasks_release,
};
@@ -211,7 +211,7 @@ xprt_info_release(struct inode *inode, struct file *filp)
static const struct file_operations xprt_info_fops = {
.owner = THIS_MODULE,
.open = xprt_info_open,
- .read = seq_read,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = xprt_info_release,
};
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 910a5d850d04..73189ac4d9f7 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -320,6 +320,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)
inode_unlock(inode);
return res;
}
+FOPS_READ_ITER_HELPER(rpc_pipe_read);

static ssize_t
rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *offset)
@@ -334,6 +335,7 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *of
inode_unlock(inode);
return res;
}
+FOPS_WRITE_ITER_HELPER(rpc_pipe_write);

static __poll_t
rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
@@ -386,8 +388,8 @@ rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
static const struct file_operations rpc_pipe_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .read = rpc_pipe_read,
- .write = rpc_pipe_write,
+ .read_iter = rpc_pipe_read_iter,
+ .write_iter = rpc_pipe_write_iter,
.poll = rpc_pipe_poll,
.unlocked_ioctl = rpc_pipe_ioctl,
.open = rpc_pipe_open,
@@ -449,7 +451,7 @@ rpc_info_release(struct inode *inode, struct file *file)
static const struct file_operations rpc_info_operations = {
.owner = THIS_MODULE,
.open = rpc_info_open,
- .read = seq_read,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = rpc_info_release,
};
--
2.43.0