Merge pull request #15228 from chardan/jfw-wip-halflife_atomic_t-filestore

filestore: migrate atomic_t to std::atomic<>

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-05-23 22:08:32 -05:00 committed by GitHub
commit 2ebd3e8dcc
3 changed files with 14 additions and 8 deletions

View 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.
*

View 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;

View File

@ -20,10 +20,13 @@
#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;