summaryrefslogtreecommitdiffstats
path: root/fs/ceph/xattr.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-12-07 21:17:17 +0100
committerSage Weil <sage@newdream.net>2009-12-07 21:17:17 +0100
commitb6c1d5b81ea0841ae9d3ce2cda319ab986b081cf (patch)
treec7ddbaa1acdaec0704dfb0c1c539ddaf6e8c7506 /fs/ceph/xattr.c
parentceph: use kref for ceph_buffer (diff)
downloadlinux-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.tar.xz
linux-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.zip
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 04769a3ab832..37d6ce645691 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;
}