diff options
author | Sage Weil <sage@newdream.net> | 2009-12-07 15:17:17 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-07 15:17:17 -0500 |
commit | b6c1d5b81ea0841ae9d3ce2cda319ab986b081cf (patch) | |
tree | c7ddbaa1acdaec0704dfb0c1c539ddaf6e8c7506 /fs/ceph/inode.c | |
parent | dd26d857a7bf1b5b734a23180c19eac3e46db944 (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/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) | |||
383 | } | 383 | } |
384 | 384 | ||
385 | __ceph_destroy_xattrs(ci); | 385 | __ceph_destroy_xattrs(ci); |
386 | ceph_buffer_put(ci->i_xattrs.blob); | 386 | if (ci->i_xattrs.blob) |
387 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); | 387 | ceph_buffer_put(ci->i_xattrs.blob); |
388 | if (ci->i_xattrs.prealloc_blob) | ||
389 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); | ||
388 | 390 | ||
389 | kmem_cache_free(ceph_inode_cachep, ci); | 391 | kmem_cache_free(ceph_inode_cachep, ci); |
390 | } | 392 | } |
@@ -526,7 +528,7 @@ static int fill_inode(struct inode *inode, | |||
526 | * bytes are the xattr count). | 528 | * bytes are the xattr count). |
527 | */ | 529 | */ |
528 | if (iinfo->xattr_len > 4) { | 530 | if (iinfo->xattr_len > 4) { |
529 | xattr_blob = ceph_buffer_new_alloc(iinfo->xattr_len, GFP_NOFS); | 531 | xattr_blob = ceph_buffer_new(iinfo->xattr_len, GFP_NOFS); |
530 | if (!xattr_blob) | 532 | if (!xattr_blob) |
531 | pr_err("fill_inode ENOMEM xattr blob %d bytes\n", | 533 | pr_err("fill_inode ENOMEM xattr blob %d bytes\n", |
532 | iinfo->xattr_len); | 534 | iinfo->xattr_len); |
@@ -715,7 +717,8 @@ no_change: | |||
715 | err = 0; | 717 | err = 0; |
716 | 718 | ||
717 | out: | 719 | out: |
718 | ceph_buffer_put(xattr_blob); | 720 | if (xattr_blob) |
721 | ceph_buffer_put(xattr_blob); | ||
719 | return err; | 722 | return err; |
720 | } | 723 | } |
721 | 724 | ||