Message ID | 1403716607-13535-5-git-send-email-ilya.dryomov@inktank.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/25/2014 12:16 PM, Ilya Dryomov wrote: > Add dout()s to ceph_osdc_request_{get,put}(). Also move them to .c and > turn kref release callback into a static function. You can pretty much take the identical comments from what I said on [PATCH 03/14]. Reviewed-by: Alex Elder <elder@linaro.org> > Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> > --- > include/linux/ceph/osd_client.h | 11 ++--------- > net/ceph/osd_client.c | 26 ++++++++++++++++++++++---- > 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, > extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, > struct ceph_osd_request *req); > > -static inline void ceph_osdc_get_request(struct ceph_osd_request *req) > -{ > - kref_get(&req->r_kref); > -} > -extern void ceph_osdc_release_request(struct kref *kref); > -static inline void ceph_osdc_put_request(struct ceph_osd_request *req) > -{ > - kref_put(&req->r_kref, ceph_osdc_release_request); > -} > +extern void ceph_osdc_get_request(struct ceph_osd_request *req); > +extern void ceph_osdc_put_request(struct ceph_osd_request *req); > > extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, > 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, > /* > * requests > */ > -void ceph_osdc_release_request(struct kref *kref) > +static void ceph_osdc_release_request(struct kref *kref) > { > - struct ceph_osd_request *req; > + struct ceph_osd_request *req = container_of(kref, > + struct ceph_osd_request, r_kref); > unsigned int which; > > - req = container_of(kref, struct ceph_osd_request, r_kref); > + dout("%s %p (r_request %p r_reply %p)\n", __func__, req, > + req->r_request, req->r_reply); > + > if (req->r_request) > ceph_msg_put(req->r_request); > if (req->r_reply) { > @@ -320,7 +323,22 @@ void ceph_osdc_release_request(struct kref *kref) > kmem_cache_free(ceph_osd_request_cache, req); > > } > -EXPORT_SYMBOL(ceph_osdc_release_request); > + > +void ceph_osdc_get_request(struct ceph_osd_request *req) > +{ > + dout("%s %p (was %d)\n", __func__, req, > + atomic_read(&req->r_kref.refcount)); > + kref_get(&req->r_kref); > +} > +EXPORT_SYMBOL(ceph_osdc_get_request); > + > +void ceph_osdc_put_request(struct ceph_osd_request *req) > +{ > + dout("%s %p (was %d)\n", __func__, req, > + atomic_read(&req->r_kref.refcount)); > + kref_put(&req->r_kref, ceph_osdc_release_request); > +} > +EXPORT_SYMBOL(ceph_osdc_put_request); > > struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, > struct ceph_snap_context *snapc, > -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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, extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req); -static inline void ceph_osdc_get_request(struct ceph_osd_request *req) -{ - kref_get(&req->r_kref); -} -extern void ceph_osdc_release_request(struct kref *kref); -static inline void ceph_osdc_put_request(struct ceph_osd_request *req) -{ - kref_put(&req->r_kref, ceph_osdc_release_request); -} +extern void ceph_osdc_get_request(struct ceph_osd_request *req); +extern void ceph_osdc_put_request(struct ceph_osd_request *req); extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, 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, /* * requests */ -void ceph_osdc_release_request(struct kref *kref) +static void ceph_osdc_release_request(struct kref *kref) { - struct ceph_osd_request *req; + struct ceph_osd_request *req = container_of(kref, + struct ceph_osd_request, r_kref); unsigned int which; - req = container_of(kref, struct ceph_osd_request, r_kref); + dout("%s %p (r_request %p r_reply %p)\n", __func__, req, + req->r_request, req->r_reply); + if (req->r_request) ceph_msg_put(req->r_request); if (req->r_reply) { @@ -320,7 +323,22 @@ void ceph_osdc_release_request(struct kref *kref) kmem_cache_free(ceph_osd_request_cache, req); } -EXPORT_SYMBOL(ceph_osdc_release_request); + +void ceph_osdc_get_request(struct ceph_osd_request *req) +{ + dout("%s %p (was %d)\n", __func__, req, + atomic_read(&req->r_kref.refcount)); + kref_get(&req->r_kref); +} +EXPORT_SYMBOL(ceph_osdc_get_request); + +void ceph_osdc_put_request(struct ceph_osd_request *req) +{ + dout("%s %p (was %d)\n", __func__, req, + atomic_read(&req->r_kref.refcount)); + kref_put(&req->r_kref, ceph_osdc_release_request); +} +EXPORT_SYMBOL(ceph_osdc_put_request); struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, struct ceph_snap_context *snapc,
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> --- include/linux/ceph/osd_client.h | 11 ++--------- net/ceph/osd_client.c | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 13 deletions(-)