]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
filestore: migrate atomic_t to std::atomic<>
authorJesse Williamson <jwilliamson@suse.de>
Tue, 2 May 2017 15:00:24 +0000 (08:00 -0700)
committerJesse Williamson <jwilliamson@suse.de>
Tue, 23 May 2017 09:09:21 +0000 (02:09 -0700)
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
src/os/filestore/FileJournal.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h

index ff65cdb33b7443f6499008583349476d67870e78..532fe2eae84190ad0fdda54b3eeb212f666ac0d4 100644 (file)
@@ -31,6 +31,9 @@ using std::deque;
 # include <libaio.h>
 #endif
 
+// re-include our assert to clobber the system one; fix dout:
+#include "include/assert.h"
+
 /**
  * Implements journaling on top of block device or file.
  *
index d262725f65b136f5ddf64c557a2f270ae039323c..1d527e0c12004ca2c99bbd87de015b3972b756f6 100644 (file)
@@ -574,7 +574,7 @@ FileStore::FileStore(CephContext* cct, const std::string &base,
   m_filestore_max_inline_xattrs(0),
   m_filestore_max_xattr_value_size(0)
 {
-  m_filestore_kill_at.set(cct->_conf->filestore_kill_at);
+  m_filestore_kill_at = cct->_conf->filestore_kill_at;
   for (int i = 0; i < m_ondisk_finisher_num; ++i) {
     ostringstream oss;
     oss << "filestore-ondisk-" << i;
@@ -2094,7 +2094,7 @@ int FileStore::queue_transactions(Sequencer *posr, vector<Transaction>& tls,
     osr = static_cast<OpSequencer *>(posr->p.get());
     dout(5) << "queue_transactions existing " << osr << " " << *osr << dendl;
   } else {
-    osr = new OpSequencer(cct, next_osr_id.inc());
+    osr = new OpSequencer(cct, ++next_osr_id);
     osr->set_cct(cct);
     osr->parent = posr;
     posr->p = osr;
@@ -5399,8 +5399,8 @@ int FileStore::_collection_move_rename(const coll_t& oldcid, const ghobject_t& o
 
 void FileStore::_inject_failure()
 {
-  if (m_filestore_kill_at.read()) {
-    int final = m_filestore_kill_at.dec();
+  if (m_filestore_kill_at) {
+    int final = --m_filestore_kill_at;
     dout(5) << "_inject_failure " << (final+1) << " -> " << final << dendl;
     if (final == 0) {
       derr << "_inject_failure KILLING" << dendl;
@@ -5738,7 +5738,7 @@ void FileStore::handle_conf_change(const struct md_config_t *conf,
     Mutex::Locker l(lock);
     m_filestore_min_sync_interval = conf->filestore_min_sync_interval;
     m_filestore_max_sync_interval = conf->filestore_max_sync_interval;
-    m_filestore_kill_at.set(conf->filestore_kill_at);
+    m_filestore_kill_at = conf->filestore_kill_at;
     m_filestore_fail_eio = conf->filestore_fail_eio;
     m_filestore_fadvise = conf->filestore_fadvise;
     m_filestore_sloppy_crc = conf->filestore_sloppy_crc;
index f80b807bd78ea2fcbdfc36f60b47cfa15e486c8c..63523ec11fe15366d4cf4e9a7f6c53a1793ba904 100644 (file)
 
 #include <map>
 #include <deque>
-#include <boost/scoped_ptr.hpp>
+#include <atomic>
 #include <fstream>
+
 using namespace std;
 
+#include <boost/scoped_ptr.hpp>
+
 #include "include/unordered_map.h"
 
 #include "include/assert.h"
@@ -364,7 +367,7 @@ private:
   FDCache fdcache;
   WBThrottle wbthrottle;
 
-  atomic_t next_osr_id;
+  std::atomic<int64_t> next_osr_id = { 0 };
   bool m_disable_wbthrottle;
   deque<OpSequencer*> op_queue;
   BackoffThrottle throttle_ops, throttle_bytes;
@@ -766,7 +769,7 @@ private:
   bool m_filestore_do_dump;
   std::ofstream m_filestore_dump;
   JSONFormatter m_filestore_dump_fmt;
-  atomic_t m_filestore_kill_at;
+  std::atomic<int64_t> m_filestore_kill_at = { 0 };
   bool m_filestore_sloppy_crc;
   int m_filestore_sloppy_crc_block_size;
   uint64_t m_filestore_max_alloc_hint_size;