]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: implement Objecter::osdmap_pool_full
authorJohn Spray <john.spray@redhat.com>
Tue, 31 Mar 2015 13:14:53 +0000 (14:14 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 12 May 2015 09:20:42 +0000 (10:20 +0100)
This is for checking whether the global
full flag *or* the per-pool full flag is
set.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 93768c0e74b101985b1f73d40b3c7e5f15d6fdcf..0edbbc6e5688efc8fbecb64a20d981709f42bd65 100644 (file)
@@ -2297,13 +2297,7 @@ start:
   return ret;
 }
 
-/**
- * Any write op which is in progress at the start of this call shall no longer
- * be in progress when this call ends.  Operations started after the start
- * of this call may still be in progress when this call ends.
- *
- * @return the latest possible epoch in which a cancelled op could have existed
- */
+
 epoch_t Objecter::op_cancel_writes(int r, int64_t pool)
 {
   rwlock.get_write();
@@ -2377,6 +2371,23 @@ bool Objecter::osdmap_full_flag() const
   return _osdmap_full_flag();
 }
 
+bool Objecter::osdmap_pool_full(const int64_t pool_id) const
+{
+  RWLock::RLocker rl(rwlock);
+
+  if (_osdmap_full_flag()) {
+    return true;
+  }
+
+  const pg_pool_t *pool = osdmap->get_pg_pool(pool_id);
+  if (pool == NULL) {
+    ldout(cct, 4) << __func__ << ": DNE pool " << pool_id << dendl;
+    return false;
+  }
+
+  return pool->has_flag(pg_pool_t::FLAG_FULL);
+}
+
 /**
  * Wrapper around osdmap->test_flag for special handling of the FULL flag.
  */
index baf902f4cccad18484541c2f34288cd417c9db1f..03c91d739c4199edab76ae1f6ed1fd88437b16de 100644 (file)
@@ -1694,6 +1694,14 @@ public:
 
   bool osdmap_full_flag() const;
 
+  /**
+   * Test pg_pool_t::FLAG_FULL on a pool
+   *
+   * @return true if the pool exists and has the flag set, or
+   *         the global full flag is set, else false
+   */
+  bool osdmap_pool_full(const int64_t pool_id) const;
+
  private:
   map<uint64_t, LingerOp*>  linger_ops;
   // we use this just to confirm a cookie is valid before dereferencing the ptr