aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-01 19:00:16 -0500
committerSage Weil <sage@inktank.com>2013-05-02 00:16:54 -0400
commitf9e15777afd87585f2222dfd446c2e52deb65eba (patch)
treed7f3d460c4384d502a8a7b16bcd530f803a54192 /include/linux
parent97fb1c7f6637ee61c90b8bc186d464cfd426b063 (diff)
libceph: be explicit about message data representation
A ceph message has a data payload portion. The memory for that data (either the source of data to send or the location to place data that is received) is specified in several ways. The ceph_msg structure includes fields for all of those ways, but this mispresents the fact that not all of them are used at a time. Specifically, the data in a message can be in: - an array of pages - a list of pages - a list of Linux bios - a second list of pages (the "trail") (The two page lists are currently only ever used for outgoing data.) Impose more structure on the ceph message, making the grouping of some of these fields explicit. Shorten the name of the "page_alignment" field. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ceph/messenger.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 889fe4720133..fb2b18a20c13 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -64,12 +64,12 @@ struct ceph_messenger {
64 u32 required_features; 64 u32 required_features;
65}; 65};
66 66
67#define ceph_msg_has_pages(m) ((m)->pages != NULL) 67#define ceph_msg_has_pages(m) ((m)->p.pages != NULL)
68#define ceph_msg_has_pagelist(m) ((m)->pagelist != NULL) 68#define ceph_msg_has_pagelist(m) ((m)->l.pagelist != NULL)
69#ifdef CONFIG_BLOCK 69#ifdef CONFIG_BLOCK
70#define ceph_msg_has_bio(m) ((m)->bio != NULL) 70#define ceph_msg_has_bio(m) ((m)->b.bio != NULL)
71#endif /* CONFIG_BLOCK */ 71#endif /* CONFIG_BLOCK */
72#define ceph_msg_has_trail(m) ((m)->trail != NULL) 72#define ceph_msg_has_trail(m) ((m)->t.trail != NULL)
73 73
74/* 74/*
75 * a single message. it contains a header (src, dest, message type, etc.), 75 * a single message. it contains a header (src, dest, message type, etc.),
@@ -82,16 +82,25 @@ struct ceph_msg {
82 struct kvec front; /* unaligned blobs of message */ 82 struct kvec front; /* unaligned blobs of message */
83 struct ceph_buffer *middle; 83 struct ceph_buffer *middle;
84 84
85 struct page **pages; /* data payload. NOT OWNER. */ 85 /* data payload */
86 unsigned int page_alignment; /* io offset in first page */ 86 struct {
87 size_t length; /* # data bytes in array or list */ 87 struct page **pages; /* NOT OWNER. */
88 struct ceph_pagelist *pagelist; /* instead of pages */ 88 size_t length; /* # data bytes in array */
89 unsigned int alignment; /* first page */
90 } p;
91 struct {
92 struct ceph_pagelist *pagelist;
93 } l;
89#ifdef CONFIG_BLOCK 94#ifdef CONFIG_BLOCK
90 unsigned int bio_seg; /* current bio segment */ 95 struct {
91 struct bio *bio; /* instead of pages/pagelist */ 96 struct bio *bio_iter; /* iterator */
92 struct bio *bio_iter; /* bio iterator */ 97 struct bio *bio;
98 unsigned int bio_seg; /* current seg in bio */
99 } b;
93#endif /* CONFIG_BLOCK */ 100#endif /* CONFIG_BLOCK */
94 struct ceph_pagelist *trail; /* the trailing part of the data */ 101 struct {
102 struct ceph_pagelist *trail; /* trailing part of data */
103 } t;
95 104
96 struct ceph_connection *con; 105 struct ceph_connection *con;
97 struct list_head list_head; /* links for connection lists */ 106 struct list_head list_head; /* links for connection lists */