diff options
author | Sage Weil <sage@newdream.net> | 2009-12-07 22:37:03 +0100 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-07 22:37:03 +0100 |
commit | 415e49a9c4faf1a1480b1497da2037608e5aa2c5 (patch) | |
tree | 6c376396878b506f46e6cc57e108524916554842 /fs/ceph/osd_client.h | |
parent | ceph: use kref for struct ceph_mds_request (diff) | |
download | linux-415e49a9c4faf1a1480b1497da2037608e5aa2c5.tar.xz linux-415e49a9c4faf1a1480b1497da2037608e5aa2c5.zip |
ceph: use kref for ceph_osd_request
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osd_client.h')
-rw-r--r-- | fs/ceph/osd_client.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/ceph/osd_client.h b/fs/ceph/osd_client.h index 3d4ae6595aaa..20ee61847416 100644 --- a/fs/ceph/osd_client.h +++ b/fs/ceph/osd_client.h @@ -2,6 +2,7 @@ #define _FS_CEPH_OSD_CLIENT_H #include <linux/completion.h> +#include <linux/kref.h> #include <linux/mempool.h> #include <linux/rbtree.h> @@ -49,7 +50,7 @@ struct ceph_osd_request { int r_prepared_pages, r_got_reply; struct ceph_osd_client *r_osdc; - atomic_t r_ref; + struct kref r_kref; bool r_mempool; struct completion r_completion, r_safe_completion; ceph_osdc_callback_t r_callback, r_safe_callback; @@ -118,9 +119,13 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, static inline void ceph_osdc_get_request(struct ceph_osd_request *req) { - atomic_inc(&req->r_ref); + 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_put_request(struct ceph_osd_request *req); extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req, |