On Wed, Aug 28, 2013 at 12:28:10PM +0900, Hitoshi Mitake wrote: > sys->vdi_inuse should be operated in atomic manner because it is manipulated > by > multiple threads. This patch implements a new bit operator atomic_set_bit() > and > lets get_vdis_from() use this. > > Signed-off-by: Hitoshi Mitake <[email protected]> > --- > > v2: > - removed needless variable > - replace more set_bit() for vdi_inuse > > include/bitops.h | 5 +++++ > sheep/group.c | 2 +- > sheep/ops.c | 4 ++-- > sheep/plain_store.c | 2 +- > 4 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/include/bitops.h b/include/bitops.h > index c4e8f74..c676c3a 100644 > --- a/include/bitops.h > +++ b/include/bitops.h > @@ -135,6 +135,11 @@ static inline void set_bit(int nr, unsigned long *addr) > addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG); > } > > +static inline void atomic_set_bit(int nr, unsigned long *addr) > +{ > + uatomic_or(addr + nr / BITS_PER_LONG, 1UL << (nr % BITS_PER_LONG);
forgot last )? Thanks Yuan -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
