diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2018-05-04 10:57:30 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-05-10 04:15:05 -0400 |
commit | 0010f7052d6cb71c4b120238e28cd3fa413913d1 (patch) | |
tree | b9ff5672180e16d61f47b66ef21febb4537c773f /net | |
parent | 3a15b38fd2efc1d648cb33186bf71e9138c93491 (diff) |
libceph: add osd_req_op_extent_osd_data_bvecs()
... and store num_bvecs for client code's convenience.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/osd_client.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index ea2a6c9fb7ce..d2667e5dddc3 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -157,10 +157,12 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data, | |||
157 | #endif /* CONFIG_BLOCK */ | 157 | #endif /* CONFIG_BLOCK */ |
158 | 158 | ||
159 | static void ceph_osd_data_bvecs_init(struct ceph_osd_data *osd_data, | 159 | static void ceph_osd_data_bvecs_init(struct ceph_osd_data *osd_data, |
160 | struct ceph_bvec_iter *bvec_pos) | 160 | struct ceph_bvec_iter *bvec_pos, |
161 | u32 num_bvecs) | ||
161 | { | 162 | { |
162 | osd_data->type = CEPH_OSD_DATA_TYPE_BVECS; | 163 | osd_data->type = CEPH_OSD_DATA_TYPE_BVECS; |
163 | osd_data->bvec_pos = *bvec_pos; | 164 | osd_data->bvec_pos = *bvec_pos; |
165 | osd_data->num_bvecs = num_bvecs; | ||
164 | } | 166 | } |
165 | 167 | ||
166 | #define osd_req_op_data(oreq, whch, typ, fld) \ | 168 | #define osd_req_op_data(oreq, whch, typ, fld) \ |
@@ -237,6 +239,22 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req, | |||
237 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); | 239 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); |
238 | #endif /* CONFIG_BLOCK */ | 240 | #endif /* CONFIG_BLOCK */ |
239 | 241 | ||
242 | void osd_req_op_extent_osd_data_bvecs(struct ceph_osd_request *osd_req, | ||
243 | unsigned int which, | ||
244 | struct bio_vec *bvecs, u32 num_bvecs, | ||
245 | u32 bytes) | ||
246 | { | ||
247 | struct ceph_osd_data *osd_data; | ||
248 | struct ceph_bvec_iter it = { | ||
249 | .bvecs = bvecs, | ||
250 | .iter = { .bi_size = bytes }, | ||
251 | }; | ||
252 | |||
253 | osd_data = osd_req_op_data(osd_req, which, extent, osd_data); | ||
254 | ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs); | ||
255 | } | ||
256 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvecs); | ||
257 | |||
240 | void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, | 258 | void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, |
241 | unsigned int which, | 259 | unsigned int which, |
242 | struct ceph_bvec_iter *bvec_pos) | 260 | struct ceph_bvec_iter *bvec_pos) |
@@ -244,7 +262,7 @@ void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, | |||
244 | struct ceph_osd_data *osd_data; | 262 | struct ceph_osd_data *osd_data; |
245 | 263 | ||
246 | osd_data = osd_req_op_data(osd_req, which, extent, osd_data); | 264 | osd_data = osd_req_op_data(osd_req, which, extent, osd_data); |
247 | ceph_osd_data_bvecs_init(osd_data, bvec_pos); | 265 | ceph_osd_data_bvecs_init(osd_data, bvec_pos, 0); |
248 | } | 266 | } |
249 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvec_pos); | 267 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvec_pos); |
250 | 268 | ||
@@ -287,7 +305,8 @@ EXPORT_SYMBOL(osd_req_op_cls_request_data_pages); | |||
287 | 305 | ||
288 | void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, | 306 | void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, |
289 | unsigned int which, | 307 | unsigned int which, |
290 | struct bio_vec *bvecs, u32 bytes) | 308 | struct bio_vec *bvecs, u32 num_bvecs, |
309 | u32 bytes) | ||
291 | { | 310 | { |
292 | struct ceph_osd_data *osd_data; | 311 | struct ceph_osd_data *osd_data; |
293 | struct ceph_bvec_iter it = { | 312 | struct ceph_bvec_iter it = { |
@@ -296,7 +315,7 @@ void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, | |||
296 | }; | 315 | }; |
297 | 316 | ||
298 | osd_data = osd_req_op_data(osd_req, which, cls, request_data); | 317 | osd_data = osd_req_op_data(osd_req, which, cls, request_data); |
299 | ceph_osd_data_bvecs_init(osd_data, &it); | 318 | ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs); |
300 | osd_req->r_ops[which].cls.indata_len += bytes; | 319 | osd_req->r_ops[which].cls.indata_len += bytes; |
301 | osd_req->r_ops[which].indata_len += bytes; | 320 | osd_req->r_ops[which].indata_len += bytes; |
302 | } | 321 | } |