aboutsummaryrefslogtreecommitdiff
path: root/include/linux/ceph/messenger.h
diff options
context:
space:
mode:
authorAlex Elder2013-03-01 18:00:16 -0600
committerSage Weil2013-05-01 21:16:54 -0700
commitf9e15777afd87585f2222dfd446c2e52deb65eba (patch)
treed7f3d460c4384d502a8a7b16bcd530f803a54192 /include/linux/ceph/messenger.h
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/ceph/messenger.h')
-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 {
u32 required_features;
};
-#define ceph_msg_has_pages(m) ((m)->pages != NULL)
-#define ceph_msg_has_pagelist(m) ((m)->pagelist != NULL)
+#define ceph_msg_has_pages(m) ((m)->p.pages != NULL)
+#define ceph_msg_has_pagelist(m) ((m)->l.pagelist != NULL)
#ifdef CONFIG_BLOCK
-#define ceph_msg_has_bio(m) ((m)->bio != NULL)
+#define ceph_msg_has_bio(m) ((m)->b.bio != NULL)
#endif /* CONFIG_BLOCK */
-#define ceph_msg_has_trail(m) ((m)->trail != NULL)
+#define ceph_msg_has_trail(m) ((m)->t.trail != NULL)
/*
* a single message. it contains a header (src, dest, message type, etc.),
@@ -82,16 +82,25 @@ struct ceph_msg {
struct kvec front; /* unaligned blobs of message */
struct ceph_buffer *middle;
- struct page **pages; /* data payload. NOT OWNER. */
- unsigned int page_alignment; /* io offset in first page */
- size_t length; /* # data bytes in array or list */
- struct ceph_pagelist *pagelist; /* instead of pages */
+ /* data payload */
+ struct {
+ struct page **pages; /* NOT OWNER. */
+ size_t length; /* # data bytes in array */
+ unsigned int alignment; /* first page */
+ } p;
+ struct {
+ struct ceph_pagelist *pagelist;
+ } l;
#ifdef CONFIG_BLOCK
- unsigned int bio_seg; /* current bio segment */
- struct bio *bio; /* instead of pages/pagelist */
- struct bio *bio_iter; /* bio iterator */
+ struct {
+ struct bio *bio_iter; /* iterator */
+ struct bio *bio;
+ unsigned int bio_seg; /* current seg in bio */
+ } b;
#endif /* CONFIG_BLOCK */
- struct ceph_pagelist *trail; /* the trailing part of the data */
+ struct {
+ struct ceph_pagelist *trail; /* trailing part of data */
+ } t;
struct ceph_connection *con;
struct list_head list_head; /* links for connection lists */