mirror of
https://github.com/isar/libmdbx.git
synced 2025-11-22 04:08:58 +08:00
mdbx: fix/rework cache-line alignment.
This commit is contained in:
@@ -2618,6 +2618,12 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) {
|
||||
return MDBX_PANIC;
|
||||
}
|
||||
|
||||
STATIC_ASSERT(sizeof(MDBX_reader) == MDBX_CACHELINE_SIZE);
|
||||
STATIC_ASSERT(offsetof(MDBX_lockinfo, mti_numreaders) % MDBX_CACHELINE_SIZE ==
|
||||
0);
|
||||
STATIC_ASSERT(offsetof(MDBX_lockinfo, mti_readers) % MDBX_CACHELINE_SIZE ==
|
||||
0);
|
||||
|
||||
pgno_t upper_pgno = 0;
|
||||
if (flags & MDBX_TXN_RDONLY) {
|
||||
txn->mt_flags = MDBX_TXN_RDONLY;
|
||||
@@ -2673,9 +2679,6 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) {
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_ASSERT(sizeof(MDBX_reader) == MDBX_CACHELINE_SIZE);
|
||||
STATIC_ASSERT(
|
||||
offsetof(MDBX_lockinfo, mti_readers) % MDBX_CACHELINE_SIZE == 0);
|
||||
r = &env->me_lck->mti_readers[slot];
|
||||
/* Claim the reader slot, carefully since other code
|
||||
* uses the reader table un-mutexed: First reset the
|
||||
|
||||
Reference in New Issue
Block a user