From 54b3fd25813117ab8eaa6c22a963ee16c0dec224 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 28 Dec 2018 17:17:11 +0400 Subject: MDEV-17441 - InnoDB transition to C++11 atomics Trivial fil_space_t::n_pending_ios transition. Since it is not obvious which memory barriers are supposed to be issued, seq_cst memory order was preserved. --- storage/innobase/include/fil0fil.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'storage') diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 53df19d6ded..f6a597057a3 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -140,8 +140,8 @@ struct fil_space_t { The tablespace object cannot be freed while this is nonzero, but it can be detached from fil_system. Note that fil_node_t::n_pending tracks actual pending I/O requests. - Protected by fil_system.mutex and my_atomic_loadlint() and friends. */ - ulint n_pending_ios; + Protected by fil_system.mutex and std::atomic. */ + std::atomic n_pending_ios; hash_node_t hash; /*!< hash chain node */ hash_node_t name_hash;/*!< hash chain the name_hash table */ rw_lock_t latch; /*!< latch protecting the file space storage @@ -260,20 +260,11 @@ struct fil_space_t { } /** Acquire a tablespace reference for I/O. */ - void acquire_for_io() { my_atomic_addlint(&n_pending_ios, 1); } + void acquire_for_io() { n_pending_ios++; } /** Release a tablespace reference for I/O. */ - void release_for_io() - { - ut_ad(pending_io()); - my_atomic_addlint(&n_pending_ios, ulint(-1)); - } + void release_for_io() { ut_ad(pending_io()); n_pending_ios--; } /** @return whether I/O is pending */ - bool pending_io() { return my_atomic_loadlint(&n_pending_ios); } - /** @return whether I/O is pending */ - bool pending_io() const - { - return const_cast(this)->pending_io(); - } + bool pending_io() const { return n_pending_ios; } }; /** Value of fil_space_t::magic_n */ -- cgit v1.2.1