aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-15 15:50:36 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:18:59 -0400
commit863c7eb590c154c7c2cfac40914f5bedcad1a166 (patch)
tree23049e44f416e0937615cf39c3f9d737e9ce4fd9 /net/ceph
parent406e2c9f9286fc93ae2191a7abf477dea05aadc9 (diff)
libceph: clean up osd data field access functions
There are a bunch of functions defined to encapsulate getting the address of a data field for a particular op in an osd request. They're all defined the same way, so create a macro to take the place of all of them. Two of these are used outside the osd client code, so preserve them (but convert them to use the new macro internally). Stop exporting the ones that aren't used elsewhere. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osd_client.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 409c443c8d1f..3c0715977de3 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -115,43 +115,25 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data,
115} 115}
116#endif /* CONFIG_BLOCK */ 116#endif /* CONFIG_BLOCK */
117 117
118#define osd_req_op_data(oreq, whch, typ, fld) \
119 ({ \
120 BUG_ON(whch >= (oreq)->r_num_ops); \
121 &(oreq)->r_ops[whch].typ.fld; \
122 })
123
118struct ceph_osd_data * 124struct ceph_osd_data *
119osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req, 125osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req,
120 unsigned int which) 126 unsigned int which)
121{ 127{
122 BUG_ON(which >= osd_req->r_num_ops); 128 return osd_req_op_data(osd_req, which, extent, osd_data);
123
124 return &osd_req->r_ops[which].extent.osd_data;
125} 129}
126EXPORT_SYMBOL(osd_req_op_extent_osd_data); 130EXPORT_SYMBOL(osd_req_op_extent_osd_data);
127 131
128struct ceph_osd_data * 132struct ceph_osd_data *
129osd_req_op_cls_request_info(struct ceph_osd_request *osd_req,
130 unsigned int which)
131{
132 BUG_ON(which >= osd_req->r_num_ops);
133
134 return &osd_req->r_ops[which].cls.request_info;
135}
136EXPORT_SYMBOL(osd_req_op_cls_request_info); /* ??? */
137
138struct ceph_osd_data *
139osd_req_op_cls_request_data(struct ceph_osd_request *osd_req,
140 unsigned int which)
141{
142 BUG_ON(which >= osd_req->r_num_ops);
143
144 return &osd_req->r_ops[which].cls.request_data;
145}
146EXPORT_SYMBOL(osd_req_op_cls_request_data); /* ??? */
147
148struct ceph_osd_data *
149osd_req_op_cls_response_data(struct ceph_osd_request *osd_req, 133osd_req_op_cls_response_data(struct ceph_osd_request *osd_req,
150 unsigned int which) 134 unsigned int which)
151{ 135{
152 BUG_ON(which >= osd_req->r_num_ops); 136 return osd_req_op_data(osd_req, which, cls, response_data);
153
154 return &osd_req->r_ops[which].cls.response_data;
155} 137}
156EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ 138EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */
157 139
@@ -162,7 +144,7 @@ void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *osd_req,
162{ 144{
163 struct ceph_osd_data *osd_data; 145 struct ceph_osd_data *osd_data;
164 146
165 osd_data = osd_req_op_extent_osd_data(osd_req, which); 147 osd_data = osd_req_op_data(osd_req, which, extent, osd_data);
166 ceph_osd_data_pages_init(osd_data, pages, length, alignment, 148 ceph_osd_data_pages_init(osd_data, pages, length, alignment,
167 pages_from_pool, own_pages); 149 pages_from_pool, own_pages);
168} 150}
@@ -173,7 +155,7 @@ void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *osd_req,
173{ 155{
174 struct ceph_osd_data *osd_data; 156 struct ceph_osd_data *osd_data;
175 157
176 osd_data = osd_req_op_extent_osd_data(osd_req, which); 158 osd_data = osd_req_op_data(osd_req, which, extent, osd_data);
177 ceph_osd_data_pagelist_init(osd_data, pagelist); 159 ceph_osd_data_pagelist_init(osd_data, pagelist);
178} 160}
179EXPORT_SYMBOL(osd_req_op_extent_osd_data_pagelist); 161EXPORT_SYMBOL(osd_req_op_extent_osd_data_pagelist);
@@ -183,7 +165,8 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req,
183 unsigned int which, struct bio *bio, size_t bio_length) 165 unsigned int which, struct bio *bio, size_t bio_length)
184{ 166{
185 struct ceph_osd_data *osd_data; 167 struct ceph_osd_data *osd_data;
186 osd_data = osd_req_op_extent_osd_data(osd_req, which); 168
169 osd_data = osd_req_op_data(osd_req, which, extent, osd_data);
187 ceph_osd_data_bio_init(osd_data, bio, bio_length); 170 ceph_osd_data_bio_init(osd_data, bio, bio_length);
188} 171}
189EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); 172EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio);
@@ -195,7 +178,7 @@ static void osd_req_op_cls_request_info_pagelist(
195{ 178{
196 struct ceph_osd_data *osd_data; 179 struct ceph_osd_data *osd_data;
197 180
198 osd_data = osd_req_op_cls_request_info(osd_req, which); 181 osd_data = osd_req_op_data(osd_req, which, cls, request_info);
199 ceph_osd_data_pagelist_init(osd_data, pagelist); 182 ceph_osd_data_pagelist_init(osd_data, pagelist);
200} 183}
201 184
@@ -205,7 +188,7 @@ void osd_req_op_cls_request_data_pagelist(
205{ 188{
206 struct ceph_osd_data *osd_data; 189 struct ceph_osd_data *osd_data;
207 190
208 osd_data = osd_req_op_cls_request_data(osd_req, which); 191 osd_data = osd_req_op_data(osd_req, which, cls, request_data);
209 ceph_osd_data_pagelist_init(osd_data, pagelist); 192 ceph_osd_data_pagelist_init(osd_data, pagelist);
210} 193}
211EXPORT_SYMBOL(osd_req_op_cls_request_data_pagelist); 194EXPORT_SYMBOL(osd_req_op_cls_request_data_pagelist);
@@ -216,7 +199,7 @@ void osd_req_op_cls_response_data_pages(struct ceph_osd_request *osd_req,
216{ 199{
217 struct ceph_osd_data *osd_data; 200 struct ceph_osd_data *osd_data;
218 201
219 osd_data = osd_req_op_cls_response_data(osd_req, which); 202 osd_data = osd_req_op_data(osd_req, which, cls, response_data);
220 ceph_osd_data_pages_init(osd_data, pages, length, alignment, 203 ceph_osd_data_pages_init(osd_data, pages, length, alignment,
221 pages_from_pool, own_pages); 204 pages_from_pool, own_pages);
222} 205}
@@ -241,7 +224,6 @@ static u64 ceph_osd_data_length(struct ceph_osd_data *osd_data)
241 } 224 }
242} 225}
243 226
244
245static void ceph_osd_data_release(struct ceph_osd_data *osd_data) 227static void ceph_osd_data_release(struct ceph_osd_data *osd_data)
246{ 228{
247 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES && osd_data->own_pages) { 229 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES && osd_data->own_pages) {