[sheepdog] [PATCH v2 2/4] util: introduce a new data type refcnt_t for reference counting

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Jul 10 09:53:47 CEST 2013


At Wed, 10 Jul 2013 15:36:51 +0800,
Liu Yuan wrote:
> 
> On Wed, Jul 10, 2013 at 04:21:03PM +0900, MORITA Kazutaka wrote:
> > At Tue, 9 Jul 2013 16:59:27 +0800,
> > Liu Yuan wrote:
> > > 
> > > I don't think this refcnt_dec_return is atomic operatoin. You should rely on the
> > > atomic_sub_return()...anyway, I am not yet convinced to use wrapper instead of
> > > atomic helpers.
> > 
> > I'd vote for introducing the wrappers.  assert() in refcnt_dec() would
> > help us to detect a bug.
> 
> Get type check and overflow check looks okay to me. I'd suggest name as
> refcount_{dec, inc}. But maybe sometimes we allow refcount < -1 like your
> reclaim patch?

The reference counter of my patch is a more complex structure, which
has the concept of generation.  I think refcnt_t is not appropriate
for it.

Thanks,

Kazutaka



More information about the sheepdog mailing list