Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1582518
| From | Ming Lei <tom.leiming@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 04/17] md: introduce helpers for dealing with fetch/store preallocated pages in bio |
| Date | 2017-02-16 13:00 +0100 |
| Message-ID | <tbsT8-5Hw-9@gated-at.bofh.it> (permalink) |
| References | <tbsJr-5E4-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Both raid1 and raid10 uses bio's bvec table to store pre-allocated
pages, then fetch and add it to bio.
This patch introduces two helpers for dealing with the special case,
like what bio_iov_iter_get_pages() does.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
drivers/md/md.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index a86ad62079de..21897cb514af 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -708,4 +708,25 @@ static inline void mddev_clear_unsupported_flags(struct mddev *mddev,
{
mddev->flags &= ~unsupported_flags;
}
+
+/*
+ * Both raid1 and raid10 use bio's bvec table to store the preallocated
+ * pages, so we introduces the following helpers for this kind of usage.
+ *
+ * Actually the usage is a bit similar with bio_iov_iter_get_pages().
+ *
+ * Please make sure .bi_io_vec[idx] points to one unused vector by the
+ * bio.
+ */
+static inline struct page *mdev_get_page_from_bio(struct bio *bio, unsigned idx)
+{
+ return bio->bi_io_vec[idx].bv_page;
+}
+
+static inline void mdev_put_page_to_bio(struct bio *bio, unsigned idx,
+ struct page *page)
+{
+ bio->bi_io_vec[idx].bv_page = page;
+}
+
#endif /* _MD_MD_H */
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] md: cleanup on direct access to bvec table Ming Lei <tom.leiming@gmail.com> - 2017-02-16 12:50 +0100
[PATCH 17/17] md: raid10: avoid direct access to bvec table in handle_reshape_read_error Ming Lei <tom.leiming@gmail.com> - 2017-02-16 12:50 +0100
[PATCH 16/17] md: raid10: avoid direct access to bvec table in reshape_request Ming Lei <tom.leiming@gmail.com> - 2017-02-16 12:50 +0100
[PATCH 08/17] md: raid1: simplify r1buf_pool_free() Ming Lei <tom.leiming@gmail.com> - 2017-02-16 12:50 +0100
[PATCH 09/17] md: raid1/raid10: use bio helper in *_pool_free Ming Lei <tom.leiming@gmail.com> - 2017-02-16 13:00 +0100
[PATCH 06/17] md: raid1/raid10: borrow .bi_error as pre-allocated page index Ming Lei <tom.leiming@gmail.com> - 2017-02-16 13:00 +0100
[PATCH 04/17] md: introduce helpers for dealing with fetch/store preallocated pages in bio Ming Lei <tom.leiming@gmail.com> - 2017-02-16 13:00 +0100
[PATCH 01/17] block: introduce bio_segments_all() Ming Lei <tom.leiming@gmail.com> - 2017-02-16 13:00 +0100
Re: [PATCH 00/17] md: cleanup on direct access to bvec table Shaohua Li <shli@kernel.org> - 2017-02-16 23:20 +0100
Re: [PATCH 00/17] md: cleanup on direct access to bvec table Ming Lei <tom.leiming@gmail.com> - 2017-02-17 02:30 +0100
Re: [PATCH 00/17] md: cleanup on direct access to bvec table Shaohua Li <shli@kernel.org> - 2017-02-17 05:20 +0100
csiph-web