diff options
author | Sage Weil <sage@newdream.net> | 2009-12-07 12:17:17 -0800 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-07 12:17:17 -0800 |
commit | b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf (patch) | |
tree | c7ddbaa1acdaec0704dfb0c1c539ddaf6e8c7506 /fs/ceph/inode.c | |
parent | dd26d857a7bf1b5b734a23180c19eac3e46db944 (diff) | |
download | blackbird-op-linux-b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf.tar.gz blackbird-op-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/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 074ee42bd344..db684686f48a 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -383,8 +383,10 @@ void ceph_destroy_inode(struct inode *inode) } __ceph_destroy_xattrs(ci); - ceph_buffer_put(ci->i_xattrs.blob); - ceph_buffer_put(ci->i_xattrs.prealloc_blob); + if (ci->i_xattrs.blob) + ceph_buffer_put(ci->i_xattrs.blob); + if (ci->i_xattrs.prealloc_blob) + ceph_buffer_put(ci->i_xattrs.prealloc_blob); kmem_cache_free(ceph_inode_cachep, ci); } @@ -526,7 +528,7 @@ static int fill_inode(struct inode *inode, * bytes are the xattr count). */ if (iinfo->xattr_len > 4) { - xattr_blob = ceph_buffer_new_alloc(iinfo->xattr_len, GFP_NOFS); + xattr_blob = ceph_buffer_new(iinfo->xattr_len, GFP_NOFS); if (!xattr_blob) pr_err("fill_inode ENOMEM xattr blob %d bytes\n", iinfo->xattr_len); @@ -715,7 +717,8 @@ no_change: err = 0; out: - ceph_buffer_put(xattr_blob); + if (xattr_blob) + ceph_buffer_put(xattr_blob); return err; } |