From 2e47f36a11467da40924f640ee5a6d1a943821d1 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 26 May 2017 15:07:28 +0300 Subject: [PATCH] os/bluestore: move volatile_statfs struct out of TransContext Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 2 +- src/os/bluestore/BlueStore.h | 103 +++++++++++++++++----------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d69838aa4a7..34e424c1f83 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5795,7 +5795,7 @@ int BlueStore::statfs(struct store_statfs_t *buf) bufferlist bl; int r = db->get(PREFIX_STAT, "bluestore_statfs", &bl); if (r >= 0) { - TransContext::volatile_statfs vstatfs; + volatile_statfs vstatfs; if (size_t(bl.length()) >= sizeof(vstatfs.values)) { auto it = bl.begin(); vstatfs.decode(it); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 322443bfed0..66c8a26faf7 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1392,6 +1392,57 @@ public: class OpSequencer; typedef boost::intrusive_ptr OpSequencerRef; + struct volatile_statfs{ + enum { + STATFS_ALLOCATED = 0, + STATFS_STORED, + STATFS_COMPRESSED_ORIGINAL, + STATFS_COMPRESSED, + STATFS_COMPRESSED_ALLOCATED, + STATFS_LAST + }; + int64_t values[STATFS_LAST]; + volatile_statfs() { + memset(this, 0, sizeof(volatile_statfs)); + } + void reset() { + *this = volatile_statfs(); + } + int64_t& allocated() { + return values[STATFS_ALLOCATED]; + } + int64_t& stored() { + return values[STATFS_STORED]; + } + int64_t& compressed_original() { + return values[STATFS_COMPRESSED_ORIGINAL]; + } + int64_t& compressed() { + return values[STATFS_COMPRESSED]; + } + int64_t& compressed_allocated() { + return values[STATFS_COMPRESSED_ALLOCATED]; + } + bool is_empty() { + return values[STATFS_ALLOCATED] == 0 && + values[STATFS_STORED] == 0 && + values[STATFS_COMPRESSED] == 0 && + values[STATFS_COMPRESSED_ORIGINAL] == 0 && + values[STATFS_COMPRESSED_ALLOCATED] == 0; + } + void decode(bufferlist::iterator& it) { + for (size_t i = 0; i < STATFS_LAST; i++) { + ::decode(values[i], it); + } + } + + void encode(bufferlist& bl) { + for (size_t i = 0; i < STATFS_LAST; i++) { + ::encode(values[i], bl); + } + } + }; + struct TransContext : public AioContext { MEMPOOL_CLASS_HELPERS(); @@ -1480,57 +1531,7 @@ public: bluestore_deferred_transaction_t *deferred_txn = nullptr; ///< if any interval_set allocated, released; - struct volatile_statfs{ - enum { - STATFS_ALLOCATED = 0, - STATFS_STORED, - STATFS_COMPRESSED_ORIGINAL, - STATFS_COMPRESSED, - STATFS_COMPRESSED_ALLOCATED, - STATFS_LAST - }; - int64_t values[STATFS_LAST]; - volatile_statfs() { - memset(this, 0, sizeof(volatile_statfs)); - } - void reset() { - *this = volatile_statfs(); - } - int64_t& allocated() { - return values[STATFS_ALLOCATED]; - } - int64_t& stored() { - return values[STATFS_STORED]; - } - int64_t& compressed_original() { - return values[STATFS_COMPRESSED_ORIGINAL]; - } - int64_t& compressed() { - return values[STATFS_COMPRESSED]; - } - int64_t& compressed_allocated() { - return values[STATFS_COMPRESSED_ALLOCATED]; - } - bool is_empty() { - return values[STATFS_ALLOCATED] == 0 && - values[STATFS_STORED] == 0 && - values[STATFS_COMPRESSED] == 0 && - values[STATFS_COMPRESSED_ORIGINAL] == 0 && - values[STATFS_COMPRESSED_ALLOCATED] == 0; - } - void decode(bufferlist::iterator& it) { - for (size_t i = 0; i < STATFS_LAST; i++) { - ::decode(values[i], it); - } - } - - void encode(bufferlist& bl) { - for (size_t i = 0; i < STATFS_LAST; i++) { - ::encode(values[i], bl); - } - } - } statfs_delta; - + volatile_statfs statfs_delta; IOContext ioc; bool had_ios = false; ///< true if we submitted IOs before our kv txn -- 2.39.5