[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-87-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:13:46 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 086/437] fs: add iterator based version of simple_transaction_read()
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
fs/libfs.c | 10 ++++++++++
include/linux/fs.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/fs/libfs.c b/fs/libfs.c
index 3280d02fc385..56b404ad4cfb 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1277,6 +1277,16 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size
}
EXPORT_SYMBOL(simple_transaction_read);
+ssize_t simple_transaction_read_iter(struct kiocb *iocb, struct iov_iter *to)
+{
+ struct simple_transaction_argresp *ar = iocb->ki_filp->private_data;
+
+ if (!ar)
+ return 0;
+ return simple_copy_to_iter(ar->data, &iocb->ki_pos, ar->size, to);
+}
+EXPORT_SYMBOL(simple_transaction_read_iter);
+
int simple_transaction_release(struct inode *inode, struct file *file)
{
free_page((unsigned long)file->private_data);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 69e4dfac2853..85db7dde4778 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3500,6 +3500,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf,
size_t size);
ssize_t simple_transaction_read(struct file *file, char __user *buf,
size_t size, loff_t *pos);
+ssize_t simple_transaction_read_iter(struct kiocb *iocb, struct iov_iter *to);
int simple_transaction_release(struct inode *inode, struct file *file);
void simple_transaction_set(struct file *file, size_t n);
--
2.43.0
Powered by blists - more mailing lists