diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-30 19:41:07 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-30 19:41:07 +0300 |
commit | 90792e4a437e68be86627797229d54e82648cc25 (patch) | |
tree | 3fc11afac8755f6a99065e938815b90421eec0d2 /storage/innobase/include/fil0fil.h | |
parent | eb7e24932b7cb190a4b96e5d6d9f9262c68814b3 (diff) | |
parent | a1267724cb1d1837026a3a5f49e55931038e43e7 (diff) | |
download | mariadb-git-90792e4a437e68be86627797229d54e82648cc25.tar.gz |
Merge 10.5 into 10.6
Diffstat (limited to 'storage/innobase/include/fil0fil.h')
-rw-r--r-- | storage/innobase/include/fil0fil.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index fadaf36f83b..b9db9afdb5e 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -538,15 +538,16 @@ public: private: MY_ATTRIBUTE((warn_unused_result)) - /** Try to acquire a tablespace reference. - @return the old reference count (if STOPPING is set, it was not acquired) */ - uint32_t acquire_low() + /** Try to acquire a tablespace reference (increment referenced()). + @param avoid when these flags are set, nothing will be acquired + @return the old reference count */ + uint32_t acquire_low(uint32_t avoid= STOPPING) { uint32_t n= 0; while (!n_pending.compare_exchange_strong(n, n + 1, std::memory_order_acquire, std::memory_order_relaxed) && - !(n & STOPPING)); + !(n & avoid)); return n; } public: @@ -560,10 +561,8 @@ public: @return whether the file is usable */ bool acquire() { - uint32_t n= acquire_low(); - if (UNIV_LIKELY(!(n & (STOPPING | CLOSING)))) - return true; - return UNIV_LIKELY(!(n & STOPPING)) && prepare(); + const auto flags= acquire_low(STOPPING | CLOSING) & (STOPPING | CLOSING); + return UNIV_LIKELY(!flags) || (flags == CLOSING && acquire_and_prepare()); } /** Acquire another tablespace reference for I/O. */ @@ -1092,7 +1091,9 @@ public: private: /** @return whether the file is usable for io() */ - ATTRIBUTE_COLD bool prepare(bool have_mutex= false); + ATTRIBUTE_COLD bool prepare_acquired(); + /** @return whether the file is usable for io() */ + ATTRIBUTE_COLD bool acquire_and_prepare(); #endif /*!UNIV_INNOCHECKSUM */ }; |