summaryrefslogtreecommitdiffstats
path: root/fs/ceph/messenger.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-12-08 00:55:05 +0100
committerSage Weil <sage@newdream.net>2009-12-08 00:55:05 +0100
commitc2e552e76e2c6907ca50cd9a4b747a2e2e8c615e (patch)
tree4251e189caeb4de3f4a8763ae70600fc9d3acb51 /fs/ceph/messenger.h
parentceph: use kref for ceph_osd_request (diff)
downloadlinux-c2e552e76e2c6907ca50cd9a4b747a2e2e8c615e.tar.xz
linux-c2e552e76e2c6907ca50cd9a4b747a2e2e8c615e.zip
ceph: use kref for ceph_msg
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/messenger.h')
-rw-r--r--fs/ceph/messenger.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/ceph/messenger.h b/fs/ceph/messenger.h
index f9c9f6487302..981b7c08ad82 100644
--- a/fs/ceph/messenger.h
+++ b/fs/ceph/messenger.h
@@ -1,6 +1,7 @@
#ifndef __FS_CEPH_MESSENGER_H
#define __FS_CEPH_MESSENGER_H
+#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/net.h>
#include <linux/radix-tree.h>
@@ -85,7 +86,7 @@ struct ceph_msg {
struct page **pages; /* data payload. NOT OWNER. */
unsigned nr_pages; /* size of page array */
struct list_head list_head;
- atomic_t nref;
+ struct kref kref;
bool front_is_vmalloc;
bool more_to_follow;
int front_max;
@@ -243,11 +244,13 @@ extern int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg);
static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg)
{
- dout("ceph_msg_get %p %d -> %d\n", msg, atomic_read(&msg->nref),
- atomic_read(&msg->nref)+1);
- atomic_inc(&msg->nref);
+ kref_get(&msg->kref);
return msg;
}
-extern void ceph_msg_put(struct ceph_msg *msg);
+extern void ceph_msg_last_put(struct kref *kref);
+static inline void ceph_msg_put(struct ceph_msg *msg)
+{
+ kref_put(&msg->kref, ceph_msg_last_put);
+}
#endif