]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: invalidate statfs completely when destaging allocations
authorIgor Fedotov <igor.fedotov@croit.io>
Tue, 4 Oct 2022 13:11:26 +0000 (16:11 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 4 Oct 2022 13:11:26 +0000 (16:11 +0300)
Signed-off-by: Igor Fedotov <ifedotov@croit.io>
src/os/bluestore/BlueStore.cc

index 39ffa942f338205af14abd75af7b85fc6283a501..a49ba12220df9d60a9f25b08b4b1c66744ea8d27 100644 (file)
@@ -6786,6 +6786,18 @@ void BlueStore::_close_db()
     auto t = db->get_transaction();
     store_statfs_t s;
     if (per_pool_stat_collection) {
+      KeyValueDB::Iterator it = db->get_iterator(PREFIX_STAT, KeyValueDB::ITERATOR_NOCACHE);
+      uint64_t pool_id;
+      for (it->upper_bound(string()); it->valid(); it->next()) {
+        int r = get_key_pool_stat(it->key(), &pool_id);
+        if (r >= 0) {
+          dout(10) << __func__ << " wiping statfs for: " << pool_id << dendl;
+        } else {
+          derr << __func__ << " wiping invalid statfs key: " << it->key() << dendl;
+        }
+        t->rmkey(PREFIX_STAT, it->key());
+      }
+
       std::lock_guard l(vstatfs_lock);
       for(auto &p : osd_pools) {
         string key;
@@ -6795,14 +6807,9 @@ void BlueStore::_close_db()
           p.second.encode(bl);
           p.second.publish(&s);
           t->set(PREFIX_STAT, key, bl);
-          dout(10) << __func__ << "persisting: "
+          dout(10) << __func__ << " persisting: "
                    << p.first << "->"  << s
                    << dendl;
-        } else {
-          t->rmkey(PREFIX_STAT, key);
-          dout(10) << __func__ << "persisting: "
-                   << p.first << "-> <empty>"
-                   << dendl;
         }
       }
     } else {
@@ -6970,7 +6977,7 @@ void BlueStore::_open_statfs()
         st.decode(p);
         vstatfs += st;
 
-        dout(30) << __func__ << " pool " << std::hex << pool_id
+        dout(10) << __func__ << " pool " << std::hex << pool_id
                 << " statfs(hex) " << st
                 << std::dec << dendl;
       } catch (ceph::buffer::error& e) {
@@ -6979,7 +6986,7 @@ void BlueStore::_open_statfs()
       }   
     }
   }
-  dout(30) << __func__ << " statfs " << std::hex
+  dout(10) << __func__ << " statfs " << std::hex
            << vstatfs  << std::dec << dendl;
 
 }