lkml.org 
[lkml]   [2009]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/24] ceph: ref counted buffer
On Sat, 5 Dec 2009, Ingo Oeser wrote:

> On Friday 04 December 2009, Sage Weil wrote:
> > struct ceph_buffer is a simple ref-counted buffer. We transparently
> > choose between kmalloc for small buffers and vmalloc for large ones.
> >
> > This is currently used only for allocating memory for xattr data.
>
> Could you wrap parts of this refcounting logic around kref?
> see #include <linux/kref.h> and lib/kref.c
>
> It avoids a bug with memory areas for free and if anybody
> optimizes or changes refcounting stuff, you get all changes for free :-)

The only real difference it looks like are

smp_mb();

in get() and

smp_mb__after_atomic_inc();

in put. Is that needed for all other atomic_t refcounting too?

Switched to kref, and cleaned up the (partially unused) interface.

fs/ceph/buffer.c | 37 ++++++++++++++++++++++++++++++++-----
fs/ceph/buffer.h | 30 ++++++------------------------
fs/ceph/inode.c | 11 +++++++----
fs/ceph/messenger.c | 2 +-
fs/ceph/xattr.c | 8 +++++---
5 files changed, 51 insertions(+), 37 deletions(-)

sage


\
 
 \ /
  Last update: 2009-12-05 19:15    [W:0.118 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site