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

Liu Yuan namei.unix at gmail.com
Wed Jul 10 09:36:51 CEST 2013


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?

Thanks
Yuan



More information about the sheepdog mailing list