diff options
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r-- | net/ceph/osd_client.c | 48 |
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 | |||
118 | struct ceph_osd_data * | 124 | struct ceph_osd_data * |
119 | osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req, | 125 | osd_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 | } |
126 | EXPORT_SYMBOL(osd_req_op_extent_osd_data); | 130 | EXPORT_SYMBOL(osd_req_op_extent_osd_data); |
127 | 131 | ||
128 | struct ceph_osd_data * | 132 | struct ceph_osd_data * |
129 | osd_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 | } | ||
136 | EXPORT_SYMBOL(osd_req_op_cls_request_info); /* ??? */ | ||
137 | |||
138 | struct ceph_osd_data * | ||
139 | osd_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 | } | ||
146 | EXPORT_SYMBOL(osd_req_op_cls_request_data); /* ??? */ | ||
147 | |||
148 | struct ceph_osd_data * | ||
149 | osd_req_op_cls_response_data(struct ceph_osd_request *osd_req, | 133 | osd_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 | } |
156 | EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ | 138 | EXPORT_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 | } |
179 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_pagelist); | 161 | EXPORT_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 | } |
189 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); | 172 | EXPORT_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 | } |
211 | EXPORT_SYMBOL(osd_req_op_cls_request_data_pagelist); | 194 | EXPORT_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 | |||
245 | static void ceph_osd_data_release(struct ceph_osd_data *osd_data) | 227 | static 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) { |