From: liuchang0812 Date: Fri, 30 Jun 2017 08:50:53 +0000 (+0800) Subject: os: export compact interface in ObjectStore and ObjectMap X-Git-Tag: v10.2.11~188^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=306510fda25af25514b784cf6cdcd857da95f5d6;p=ceph.git os: export compact interface in ObjectStore and ObjectMap Signed-off-by: liuchang0812 (cherry picked from commit eb5723d3abd4e1b6caec477090761d7919efc7bd) Conflicts: src/os/bluestore/BlueStore.h Removed declarations which are not part of this backport inject_data_error() inject_mdata_error() debug_data_eio() debug_mdata_eio() debug_oj_on_delete() src/os/filestore/FileStore.h Removed declarations which are not part of this backport set data_error_set set mdata_error_set inject_data_error() override inject_mdata_error() override --- diff --git a/src/os/ObjectMap.h b/src/os/ObjectMap.h index 95ca9a5b0553c..8f8397c8a05d9 100644 --- a/src/os/ObjectMap.h +++ b/src/os/ObjectMap.h @@ -153,6 +153,8 @@ public: virtual int check(std::ostream &out, bool repair = false) { return 0; } + virtual void compact() {} + typedef KeyValueDB::GenericIteratorImpl ObjectMapIteratorImpl; typedef ceph::shared_ptr ObjectMapIterator; virtual ObjectMapIterator get_iterator(const ghobject_t &oid) { diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index ae0584da3aac4..61b50ebe66642 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -2411,6 +2411,8 @@ public: // DEBUG virtual void inject_data_error(const ghobject_t &oid) {} virtual void inject_mdata_error(const ghobject_t &oid) {} + + virtual void compact() {} }; WRITE_CLASS_ENCODER(ObjectStore::Transaction) WRITE_CLASS_ENCODER(ObjectStore::Transaction::TransactionData) diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 91aec621603bc..c2c577fbd0803 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -840,6 +840,11 @@ public: TrackedOpRef op = TrackedOpRef(), ThreadPool::TPHandle *handle = NULL) override; + void compact() override { + assert(db); + db->compact(); + } + private: // -------------------------------------------------------- // write ops diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index 3f64802a42ed8..d9a5a2998ceb0 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -229,6 +229,11 @@ public: /// Ensure that all previous operations are durable int sync(const ghobject_t *oid=0, const SequencerPosition *spos=0); + void compact() override { + assert(db); + db->compact(); + } + /// Util, get all objects, there must be no other concurrent access int list_objects(vector *objs ///< [out] objects ); diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 58d90e0889c72..238f2ed6139f7 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -4117,6 +4117,7 @@ void FileStore::inject_mdata_error(const ghobject_t &oid) { dout(10) << __func__ << ": init error on " << oid << dendl; mdata_error_set.insert(oid); } + void FileStore::debug_obj_on_delete(const ghobject_t &oid) { Mutex::Locker l(read_error_lock); dout(10) << __func__ << ": clear error on " << oid << dendl; diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index 9d3f9c85a4e8a..7d792c499275d 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -595,6 +595,12 @@ public: set mdata_error_set; // getattr(),stat() will return -EIO void inject_data_error(const ghobject_t &oid); void inject_mdata_error(const ghobject_t &oid); + + void compact() override { + assert(object_map); + object_map->compact(); + } + void debug_obj_on_delete(const ghobject_t &oid); bool debug_data_eio(const ghobject_t &oid); bool debug_mdata_eio(const ghobject_t &oid); diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 09483de46be6d..c27df7e788cfb 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -532,6 +532,11 @@ public: TrackedOpRef op = TrackedOpRef(), ThreadPool::TPHandle *handle = NULL); + void compact () override { + assert(db); + db->compact(); + } + private: // -------------------------------------------------------- // write ops