[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-373-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:18:32 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 372/437] drivers/md: convert bcache to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
drivers/md/bcache/debug.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 7510d1c983a5..6c28c8ca5629 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -169,10 +169,10 @@ static bool dump_pred(struct keybuf *buf, struct bkey *k)
return true;
}
-static ssize_t bch_dump_read(struct file *file, char __user *buf,
- size_t size, loff_t *ppos)
+static ssize_t bch_dump_read(struct kiocb *iocb, struct iov_iter *to)
{
- struct dump_iterator *i = file->private_data;
+ struct dump_iterator *i = iocb->ki_filp->private_data;
+ size_t size = iov_iter_count(to);
ssize_t ret = 0;
char kbuf[80];
@@ -180,11 +180,10 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf,
struct keybuf_key *w;
unsigned int bytes = min(i->bytes, size);
- if (copy_to_user(buf, i->buf, bytes))
+ if (!copy_to_iter_full(i->buf, bytes, to))
return -EFAULT;
ret += bytes;
- buf += bytes;
size -= bytes;
i->bytes -= bytes;
memmove(i->buf, i->buf + bytes, i->bytes);
@@ -230,7 +229,7 @@ static int bch_dump_release(struct inode *inode, struct file *file)
static const struct file_operations cache_set_debug_ops = {
.owner = THIS_MODULE,
.open = bch_dump_open,
- .read = bch_dump_read,
+ .read_iter = bch_dump_read,
.release = bch_dump_release
};
--
2.43.0
Powered by blists - more mailing lists