aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/buffer.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-12-07 12:17:17 -0800
committerSage Weil <sage@newdream.net>2009-12-07 12:17:17 -0800
commitb6c1d5b81ea0841ae9d3ce2cda319ab986b081cf (patch)
treec7ddbaa1acdaec0704dfb0c1c539ddaf6e8c7506 /fs/ceph/buffer.h
parentdd26d857a7bf1b5b734a23180c19eac3e46db944 (diff)
downloadkernel_samsung_smdk4412-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.zip
kernel_samsung_smdk4412-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.tar.gz
kernel_samsung_smdk4412-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.tar.bz2
ceph: simplify ceph_buffer interface
We never allocate the ceph_buffer and buffer separtely, so use a single constructor. Disallow put on NULL buffer; make the caller check. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/buffer.h')
-rw-r--r--fs/ceph/buffer.h20
1 files changed, 3 insertions, 17 deletions
diff --git a/fs/ceph/buffer.h b/fs/ceph/buffer.h
index 3f541a1..47b9514 100644
--- a/fs/ceph/buffer.h
+++ b/fs/ceph/buffer.h
@@ -20,8 +20,8 @@ struct ceph_buffer {
bool is_vmalloc;
};
-struct ceph_buffer *ceph_buffer_new(gfp_t gfp);
-int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp);
+extern struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp);
+extern void ceph_buffer_release(struct kref *kref);
static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
{
@@ -29,23 +29,9 @@ static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
return b;
}
-void ceph_buffer_release(struct kref *kref);
-
static inline void ceph_buffer_put(struct ceph_buffer *b)
{
- if (b)
- kref_put(&b->kref, ceph_buffer_release);
-}
-
-static inline struct ceph_buffer *ceph_buffer_new_alloc(int len, gfp_t gfp)
-{
- struct ceph_buffer *b = ceph_buffer_new(gfp);
-
- if (b && ceph_buffer_alloc(b, len, gfp) < 0) {
- ceph_buffer_put(b);
- b = NULL;
- }
- return b;
+ kref_put(&b->kref, ceph_buffer_release);
}
#endif