aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/xattr.c
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/xattr.c
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/xattr.c')
-rw-r--r--fs/ceph/xattr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 04769a3..37d6ce6 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -482,7 +482,8 @@ void __ceph_build_xattrs_blob(struct ceph_inode_info *ci)
ci->i_xattrs.prealloc_blob->vec.iov_len =
dest - ci->i_xattrs.prealloc_blob->vec.iov_base;
- ceph_buffer_put(ci->i_xattrs.blob);
+ if (ci->i_xattrs.blob)
+ ceph_buffer_put(ci->i_xattrs.blob);
ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob;
ci->i_xattrs.prealloc_blob = NULL;
ci->i_xattrs.dirty = false;
@@ -745,11 +746,12 @@ retry:
spin_unlock(&inode->i_lock);
dout(" preaallocating new blob size=%d\n", required_blob_size);
- blob = ceph_buffer_new_alloc(required_blob_size, GFP_NOFS);
+ blob = ceph_buffer_new(required_blob_size, GFP_NOFS);
if (!blob)
goto out;
spin_lock(&inode->i_lock);
- ceph_buffer_put(ci->i_xattrs.prealloc_blob);
+ if (ci->i_xattrs.prealloc_blob)
+ ceph_buffer_put(ci->i_xattrs.prealloc_blob);
ci->i_xattrs.prealloc_blob = blob;
goto retry;
}