[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <160596806531.154728.6113611661561602930.stgit@warthog.procyon.org.uk>
Date: Sat, 21 Nov 2020 14:14:25 +0000
From: David Howells <dhowells@...hat.com>
To: Pavel Begunkov <asml.silence@...il.com>,
Matthew Wilcox <willy@...radead.org>,
Jens Axboe <axboe@...nel.dk>,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: dhowells@...hat.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 08/29] iov_iter: Split the iterate_all_kinds() macro
Split the iterate_all_kinds() macro into iovec, bvec and kvec variants.
It doesn't handle pipes and the discard variant is a no-op and can be built
in directly.
Signed-off-by: David Howells <dhowells@...hat.com>
---
lib/iov_iter.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 5b18dfe0dcc7..934193627540 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -106,6 +106,33 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n);
} \
}
+#define iterate_over_iovec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ const struct iovec *iov; \
+ struct iovec v; \
+ iterate_iovec(i, n, v, iov, skip, (CMD)) \
+ } \
+}
+
+#define iterate_over_bvec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ struct bio_vec v; \
+ struct bvec_iter __bi; \
+ iterate_bvec(i, n, v, __bi, skip, (CMD)) \
+ } \
+}
+
+#define iterate_over_kvec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ const struct kvec *kvec; \
+ struct kvec v; \
+ iterate_kvec(i, n, v, kvec, skip, (CMD)) \
+ } \
+}
+
#define iterate_and_advance(i, n, v, I, B, K) { \
if (unlikely(i->count < n)) \
n = i->count; \
Powered by blists - more mailing lists