aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/xattr.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-12-07 15:17:17 -0500
committerSage Weil <sage@newdream.net>2009-12-07 15:17:17 -0500
commitb6c1d5b81ea0841ae9d3ce2cda319ab986b081cf (patch)
treec7ddbaa1acdaec0704dfb0c1c539ddaf6e8c7506 /fs/ceph/xattr.c
parentdd26d857a7bf1b5b734a23180c19eac3e46db944 (diff)
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)
482 ci->i_xattrs.prealloc_blob->vec.iov_len = 482 ci->i_xattrs.prealloc_blob->vec.iov_len =
483 dest - ci->i_xattrs.prealloc_blob->vec.iov_base; 483 dest - ci->i_xattrs.prealloc_blob->vec.iov_base;
484 484
485 ceph_buffer_put(ci->i_xattrs.blob); 485 if (ci->i_xattrs.blob)
486 ceph_buffer_put(ci->i_xattrs.blob);
486 ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob; 487 ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob;
487 ci->i_xattrs.prealloc_blob = NULL; 488 ci->i_xattrs.prealloc_blob = NULL;
488 ci->i_xattrs.dirty = false; 489 ci->i_xattrs.dirty = false;
@@ -745,11 +746,12 @@ retry:
745 746
746 spin_unlock(&inode->i_lock); 747 spin_unlock(&inode->i_lock);
747 dout(" preaallocating new blob size=%d\n", required_blob_size); 748 dout(" preaallocating new blob size=%d\n", required_blob_size);
748 blob = ceph_buffer_new_alloc(required_blob_size, GFP_NOFS); 749 blob = ceph_buffer_new(required_blob_size, GFP_NOFS);
749 if (!blob) 750 if (!blob)
750 goto out; 751 goto out;
751 spin_lock(&inode->i_lock); 752 spin_lock(&inode->i_lock);
752 ceph_buffer_put(ci->i_xattrs.prealloc_blob); 753 if (ci->i_xattrs.prealloc_blob)
754 ceph_buffer_put(ci->i_xattrs.prealloc_blob);
753 ci->i_xattrs.prealloc_blob = blob; 755 ci->i_xattrs.prealloc_blob = blob;
754 goto retry; 756 goto retry;
755 } 757 }