RDS: Use spinlock to protect 64b value update on 32b archs
We have a 64bit value that needs to be set atomically. This is easy and quick on all 64bit archs, and can also be done on x86/32 with set_64bit() (uses cmpxchg8b). However other 32b archs don't have this. I actually changed this to the current state in preparation for mainline because the old way (using a spinlock on 32b) resulted in unsightly #ifdefs in the code. But obviously, being correct takes precedence. Signed-off-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
745cbccac3
commit
8cbd9606a6
14
net/rds/ib.h
14
net/rds/ib.h
@ -108,7 +108,12 @@ struct rds_ib_connection {
|
||||
|
||||
/* sending acks */
|
||||
unsigned long i_ack_flags;
|
||||
#ifdef KERNEL_HAS_ATOMIC64
|
||||
atomic64_t i_ack_next; /* next ACK to send */
|
||||
#else
|
||||
spinlock_t i_ack_lock; /* protect i_ack_next */
|
||||
u64 i_ack_next; /* next ACK to send */
|
||||
#endif
|
||||
struct rds_header *i_ack;
|
||||
struct ib_send_wr i_ack_wr;
|
||||
struct ib_sge i_ack_sge;
|
||||
@ -363,13 +368,4 @@ rds_ib_data_sge(struct rds_ib_connection *ic, struct ib_sge *sge)
|
||||
return &sge[1];
|
||||
}
|
||||
|
||||
static inline void rds_ib_set_64bit(u64 *ptr, u64 val)
|
||||
{
|
||||
#if BITS_PER_LONG == 64
|
||||
*ptr = val;
|
||||
#else
|
||||
set_64bit(ptr, val);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user