aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-06-20 06:14:42 -0400
committerIlya Dryomov <ilya.dryomov@inktank.com>2014-07-08 07:08:43 -0400
commit9e94af202afd961da39f82b55ba83edd4ad30e98 (patch)
tree077b2d7a02cce19077f8ebabaf71bcbb8c093263
parent0215e44bb390a968d01404aa2f35af56f9b55fc8 (diff)
libceph: move and add dout()s to ceph_osdc_request_{get,put}()
Add dout()s to ceph_osdc_request_{get,put}(). Also move them to .c and turn kref release callback into a static function. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r--include/linux/ceph/osd_client.h11
-rw-r--r--net/ceph/osd_client.c26
2 files changed, 24 insertions, 13 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 7490a03ac163..a8d5652f589d 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -328,15 +328,8 @@ extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
328extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, 328extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc,
329 struct ceph_osd_request *req); 329 struct ceph_osd_request *req);
330 330
331static inline void ceph_osdc_get_request(struct ceph_osd_request *req) 331extern void ceph_osdc_get_request(struct ceph_osd_request *req);
332{ 332extern void ceph_osdc_put_request(struct ceph_osd_request *req);
333 kref_get(&req->r_kref);
334}
335extern void ceph_osdc_release_request(struct kref *kref);
336static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
337{
338 kref_put(&req->r_kref, ceph_osdc_release_request);
339}
340 333
341extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, 334extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
342 struct ceph_osd_request *req, 335 struct ceph_osd_request *req,
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 6202923b41ff..7406046212dc 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -297,12 +297,15 @@ static void osd_req_op_data_release(struct ceph_osd_request *osd_req,
297/* 297/*
298 * requests 298 * requests
299 */ 299 */
300void ceph_osdc_release_request(struct kref *kref) 300static void ceph_osdc_release_request(struct kref *kref)
301{ 301{
302 struct ceph_osd_request *req; 302 struct ceph_osd_request *req = container_of(kref,
303 struct ceph_osd_request, r_kref);
303 unsigned int which; 304 unsigned int which;
304 305
305 req = container_of(kref, struct ceph_osd_request, r_kref); 306 dout("%s %p (r_request %p r_reply %p)\n", __func__, req,
307 req->r_request, req->r_reply);
308
306 if (req->r_request) 309 if (req->r_request)
307 ceph_msg_put(req->r_request); 310 ceph_msg_put(req->r_request);
308 if (req->r_reply) { 311 if (req->r_reply) {
@@ -320,7 +323,22 @@ void ceph_osdc_release_request(struct kref *kref)
320 kmem_cache_free(ceph_osd_request_cache, req); 323 kmem_cache_free(ceph_osd_request_cache, req);
321 324
322} 325}
323EXPORT_SYMBOL(ceph_osdc_release_request); 326
327void ceph_osdc_get_request(struct ceph_osd_request *req)
328{
329 dout("%s %p (was %d)\n", __func__, req,
330 atomic_read(&req->r_kref.refcount));
331 kref_get(&req->r_kref);
332}
333EXPORT_SYMBOL(ceph_osdc_get_request);
334
335void ceph_osdc_put_request(struct ceph_osd_request *req)
336{
337 dout("%s %p (was %d)\n", __func__, req,
338 atomic_read(&req->r_kref.refcount));
339 kref_put(&req->r_kref, ceph_osdc_release_request);
340}
341EXPORT_SYMBOL(ceph_osdc_put_request);
324 342
325struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 343struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
326 struct ceph_snap_context *snapc, 344 struct ceph_snap_context *snapc,