]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: export compact interface in ObjectStore and ObjectMap
authorliuchang0812 <liuchang0812@gmail.com>
Fri, 30 Jun 2017 08:50:53 +0000 (16:50 +0800)
committerliuchang0812 <liuchang0812@gmail.com>
Thu, 13 Jul 2017 14:06:35 +0000 (22:06 +0800)
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
src/os/ObjectMap.h
src/os/ObjectStore.h
src/os/bluestore/BlueStore.h
src/os/filestore/DBObjectMap.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h
src/os/kstore/KStore.h

index 68341628d2a638bf9591c9a72d93f327158d571c..67a5780ae8c283882173862d8f32beff7828de49 100644 (file)
@@ -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<ObjectMapIteratorImpl> ObjectMapIterator;
   virtual ObjectMapIterator get_iterator(const ghobject_t &oid) {
index caf2bb779c644684a973072669190101210bea2f..e4d6e0ca56427e316e518882d541f50b0b61c6b0 100644 (file)
@@ -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)
index 9a7360001e4059c15b6ec392d03693170dc851ea..3396bae44125e78b8edca85c374d975678e14d2b 100644 (file)
@@ -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) {
index f60ae1753bae6add5420b146305765256778ec0e..3f6798d2ee28f46de92bb3203df581ae0267e120 100644 (file)
@@ -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<ghobject_t> *objs ///< [out] objects
     );
index 8a3a5a1db9f61aa11c198e3b4bac50bae09f3e88..1e2d140c3f28d6ba14402af5102ab6e356877962 100644 (file)
@@ -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;
index c8ebec7430025cf9d5124d3e85fa2c98b4cf511b..020044a03a9d8cc78aecfff0666533554b69c097 100644 (file)
@@ -640,6 +640,12 @@ public:
   set<ghobject_t> 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);
index 7570756a71333cac463799fac9f6f7a477b77cb2..487d984703978557ad606b995a92a952ec689f59 100644 (file)
@@ -564,6 +564,11 @@ public:
     TrackedOpRef op = TrackedOpRef(),
     ThreadPool::TPHandle *handle = NULL) override;
 
+  void compact () override {
+    assert(db);
+    db->compact();
+  }
+  
 private:
   // --------------------------------------------------------
   // write ops