Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1511565 > unrolled thread
| Started by | Ming Lei <tom.leiming@gmail.com> |
|---|---|
| First post | 2016-10-29 10:20 +0200 |
| Last post | 2016-10-29 17:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 01/60] block: bio: introduce bio_init_with_vec_table() Ming Lei <tom.leiming@gmail.com> - 2016-10-29 10:20 +0200
Re: [PATCH 01/60] block: bio: introduce bio_init_with_vec_table() Christoph Hellwig <hch@infradead.org> - 2016-10-29 17:30 +0200
| From | Ming Lei <tom.leiming@gmail.com> |
|---|---|
| Date | 2016-10-29 10:20 +0200 |
| Subject | [PATCH 01/60] block: bio: introduce bio_init_with_vec_table() |
| Message-ID | <sxx1W-3GR-77@gated-at.bofh.it> |
Some drivers often uses external bvec table, so introduce
this helper for this case. It is always safe to access the
bio->bi_io_vec in this way for this case.
After converting to this helper, it will becomes a bit easier
to evaluate the remaining direct access to bio->bi_io_vec,
so it can help to prepare for the following multipage bvec
support.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
include/linux/bio.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 97cb48f03dc7..8634bd24984c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -664,6 +664,16 @@ static inline void bio_inc_remaining(struct bio *bio)
atomic_inc(&bio->__bi_remaining);
}
+static inline void bio_init_with_vec_table(struct bio *bio,
+ struct bio_vec *table,
+ unsigned max_vecs)
+{
+ bio_init(bio);
+ bio->bi_io_vec = table;
+ bio->bi_max_vecs = max_vecs;
+}
+
+
/*
* bio_set is used to allow other portions of the IO system to
* allocate their own private memory pools for bio and iovec structures.
--
2.7.4
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Date | 2016-10-29 17:30 +0200 |
| Message-ID | <sxDK1-7WB-23@gated-at.bofh.it> |
| In reply to | #1511565 |
Just add the two arguments to bio_init instead of adding a second function with a way too long name.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web