diff options
| author | Alex Elder <elder@inktank.com> | 2013-03-14 15:09:06 -0400 |
|---|---|---|
| committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:18:29 -0400 |
| commit | 36153ec9dd6287d7cedf6afb51453c445d946cee (patch) | |
| tree | 71f690eef5012f3d3c5df2723cc776701d57dc84 /include/linux | |
| parent | c851c49591ebf000c610711e39eea7da5ff05b21 (diff) | |
libceph: move cursor into message
A message will only be processing a single data item at a time, so
there's no need for each data item to have its own cursor.
Move the cursor embedded in the message data structure into the
message itself. To minimize the impact, keep the data->cursor
field, but make it be a pointer to the cursor in the message.
Move the definition of ceph_msg_data above ceph_msg_data_cursor so
the cursor can point to the data without a forward definition rather
than vice-versa.
This and the upcoming patches are part of:
http://tracker.ceph.com/issues/3761
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.h | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 4fb870a5b5fc..e7557242817c 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
| @@ -88,6 +88,25 @@ static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type) | |||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | struct ceph_msg_data { | ||
| 92 | enum ceph_msg_data_type type; | ||
| 93 | union { | ||
| 94 | #ifdef CONFIG_BLOCK | ||
| 95 | struct { | ||
| 96 | struct bio *bio; | ||
| 97 | size_t bio_length; | ||
| 98 | }; | ||
| 99 | #endif /* CONFIG_BLOCK */ | ||
| 100 | struct { | ||
| 101 | struct page **pages; /* NOT OWNER. */ | ||
| 102 | size_t length; /* total # bytes */ | ||
| 103 | unsigned int alignment; /* first page */ | ||
| 104 | }; | ||
| 105 | struct ceph_pagelist *pagelist; | ||
| 106 | }; | ||
| 107 | struct ceph_msg_data_cursor *cursor; | ||
| 108 | }; | ||
| 109 | |||
| 91 | struct ceph_msg_data_cursor { | 110 | struct ceph_msg_data_cursor { |
| 92 | size_t resid; /* bytes not yet consumed */ | 111 | size_t resid; /* bytes not yet consumed */ |
| 93 | bool last_piece; /* now at last piece of data item */ | 112 | bool last_piece; /* now at last piece of data item */ |
| @@ -112,25 +131,6 @@ struct ceph_msg_data_cursor { | |||
| 112 | }; | 131 | }; |
| 113 | }; | 132 | }; |
| 114 | 133 | ||
| 115 | struct ceph_msg_data { | ||
| 116 | enum ceph_msg_data_type type; | ||
| 117 | union { | ||
| 118 | #ifdef CONFIG_BLOCK | ||
| 119 | struct { | ||
| 120 | struct bio *bio; | ||
| 121 | size_t bio_length; | ||
| 122 | }; | ||
| 123 | #endif /* CONFIG_BLOCK */ | ||
| 124 | struct { | ||
| 125 | struct page **pages; /* NOT OWNER. */ | ||
| 126 | size_t length; /* total # bytes */ | ||
| 127 | unsigned int alignment; /* first page */ | ||
| 128 | }; | ||
| 129 | struct ceph_pagelist *pagelist; | ||
| 130 | }; | ||
| 131 | struct ceph_msg_data_cursor cursor; /* pagelist only */ | ||
| 132 | }; | ||
| 133 | |||
| 134 | /* | 134 | /* |
| 135 | * a single message. it contains a header (src, dest, message type, etc.), | 135 | * a single message. it contains a header (src, dest, message type, etc.), |
| 136 | * footer (crc values, mainly), a "front" message body, and possibly a | 136 | * footer (crc values, mainly), a "front" message body, and possibly a |
| @@ -142,8 +142,9 @@ struct ceph_msg { | |||
| 142 | struct kvec front; /* unaligned blobs of message */ | 142 | struct kvec front; /* unaligned blobs of message */ |
| 143 | struct ceph_buffer *middle; | 143 | struct ceph_buffer *middle; |
| 144 | 144 | ||
| 145 | size_t data_length; | 145 | size_t data_length; |
| 146 | struct ceph_msg_data *data; /* data payload */ | 146 | struct ceph_msg_data *data; |
| 147 | struct ceph_msg_data_cursor cursor; | ||
| 147 | 148 | ||
| 148 | struct ceph_connection *con; | 149 | struct ceph_connection *con; |
| 149 | struct list_head list_head; /* links for connection lists */ | 150 | struct list_head list_head; /* links for connection lists */ |
