From: liuchang0812 Date: Fri, 30 Jun 2017 08:50:53 +0000 (+0800) Subject: os: export compact interface in ObjectStore and ObjectMap X-Git-Tag: v12.1.1~18^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eb5723d3abd4e1b6caec477090761d7919efc7bd;p=ceph.git os: export compact interface in ObjectStore and ObjectMap Signed-off-by: liuchang0812 --- diff --git a/src/os/ObjectMap.h b/src/os/ObjectMap.h index 68341628d2a6..67a5780ae8c2 100644 --- a/src/os/ObjectMap.h +++ b/src/os/ObjectMap.h @@ -154,6 +154,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 caf2bb779c64..e4d6e0ca5642 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -2020,6 +2020,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 9a7360001e40..3396bae44125 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2377,6 +2377,11 @@ public: RWLock::WLocker l(debug_read_error_lock); debug_mdata_error_objects.insert(o); } + void compact() override { + assert(db); + db->compact(); + } + private: bool _debug_data_eio(const ghobject_t& o) { if (!cct->_conf->bluestore_debug_inject_read_err) { diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index f60ae1753bae..3f6798d2ee28 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -230,6 +230,11 @@ public: /// Ensure that all previous operations are durable int sync(const ghobject_t *oid=0, const SequencerPosition *spos=0) override; + 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 8a3a5a1db9f6..1e2d140c3f28 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -4356,6 +4356,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 c8ebec743002..020044a03a9d 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -640,6 +640,12 @@ public: set mdata_error_set; // getattr(),stat() will return -EIO void inject_data_error(const ghobject_t &oid) override; void inject_mdata_error(const ghobject_t &oid) override; + + 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 7570756a7133..487d98470397 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -564,6 +564,11 @@ public: TrackedOpRef op = TrackedOpRef(), ThreadPool::TPHandle *handle = NULL) override; + void compact () override { + assert(db); + db->compact(); + } + private: // -------------------------------------------------------- // write ops