]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Adding statfs api to KeyValueDB 5562/head
authorVarada Kari <varada.kari@sandisk.com>
Thu, 13 Aug 2015 05:31:40 +0000 (11:01 +0530)
committerVarada Kari <varada.kari@sandisk.com>
Thu, 13 Aug 2015 05:35:50 +0000 (11:05 +0530)
If any backend supports and implements statfs will extract the
stats from backend to show correct utilization in the status.

Signed-off-by: Varada Kari <varada.kari@sandisk.com>
src/os/KeyValueDB.h
src/os/KeyValueStore.cc

index 6568df8968924590e67562cd583c49de000591be..a49c49bc9684ab33eaeb545a83ea65cbf56ee54e 100644 (file)
@@ -176,6 +176,9 @@ public:
   }
 
   virtual uint64_t get_estimated_size(map<string,uint64_t> &extra) = 0;
+  virtual int get_statfs(struct statfs *buf) {
+    return -EOPNOTSUPP;
+  }
 
   virtual ~KeyValueDB() {}
 
index 4b3cf71579b05a516305d78f3c0885c2f0bac0ce..bcb6b250d32b8b17a28e069c034f20993098bfea 100644 (file)
@@ -592,9 +592,12 @@ KeyValueStore::~KeyValueStore()
 
 int KeyValueStore::statfs(struct statfs *buf)
 {
-  if (::statfs(basedir.c_str(), buf) < 0) {
-    int r = -errno;
-    return r;
+  int r = backend->db->get_statfs(buf);
+  if (r < 0) {
+    if (::statfs(basedir.c_str(), buf) < 0) {
+      int r = -errno;
+      return r;
+    }
   }
   return 0;
 }