]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pg_pool_t: clean up code.
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 9 Jan 2015 03:04:10 +0000 (11:04 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 23 Jan 2015 01:32:36 +0000 (09:32 +0800)
Using has_flag() insteand of get_flags() & pg_pool_t::FLAG_*

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/mon/OSDMonitor.cc
src/osd/OSDMap.cc
src/osd/ReplicatedPG.cc

index 6029bf0a3dfddead0d84bf710f0a653dace09429..281f123465761761644b5b677598a3494a0aa37b 100644 (file)
@@ -3411,7 +3411,7 @@ bool OSDMonitor::update_pools_status()
       (pool.quota_max_bytes > 0 && (uint64_t)sum.num_bytes >= pool.quota_max_bytes) ||
       (pool.quota_max_objects > 0 && (uint64_t)sum.num_objects >= pool.quota_max_objects);
 
-    if (pool.get_flags() & pg_pool_t::FLAG_FULL) {
+    if (pool.has_flag(pg_pool_t::FLAG_FULL)) {
       if (pool_is_full)
         continue;
 
@@ -3458,7 +3458,7 @@ void OSDMonitor::get_pools_health(
     const pg_pool_t &pool = it->second;
     const string& pool_name = osdmap.get_pool_name(it->first);
 
-    if (pool.get_flags() & pg_pool_t::FLAG_FULL) {
+    if (pool.has_flag(pg_pool_t::FLAG_FULL)) {
       // uncomment these asserts if/when we update the FULL flag on pg_stat update
       //assert((pool.quota_max_objects > 0) || (pool.quota_max_bytes > 0));
 
@@ -3477,7 +3477,7 @@ void OSDMonitor::get_pools_health(
       health_status_t status = HEALTH_OK;
       if ((uint64_t)sum.num_objects >= pool.quota_max_objects) {
        // uncomment these asserts if/when we update the FULL flag on pg_stat update
-        //assert(pool.get_flags() & pg_pool_t::FLAG_FULL);
+        //assert(pool.has_flag(pg_pool_t::FLAG_FULL));
       } else if (crit_threshold > 0 &&
                 sum.num_objects >= pool.quota_max_objects*crit_threshold) {
         ss << "pool '" << pool_name
@@ -3504,7 +3504,7 @@ void OSDMonitor::get_pools_health(
       stringstream ss;
       if ((uint64_t)sum.num_bytes >= pool.quota_max_bytes) {
        // uncomment these asserts if/when we update the FULL flag on pg_stat update
-       //assert(pool.get_flags() & pg_pool_t::FLAG_FULL);
+       //assert(pool.has_flag(pg_pool_t::FLAG_FULL));
       } else if (crit_threshold > 0 &&
                 sum.num_bytes >= pool.quota_max_bytes*crit_threshold) {
         ss << "pool '" << pool_name
index cc158617575f838d14fbdd0b7bfc4cc682333d1a..c3624b13e32fa8428347fafea2fb56c6ced35f04 100644 (file)
@@ -1037,7 +1037,7 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const
   mask |= CEPH_FEATURES_CRUSH;
 
   for (map<int64_t,pg_pool_t>::const_iterator p = pools.begin(); p != pools.end(); ++p) {
-    if (p->second.flags & pg_pool_t::FLAG_HASHPSPOOL) {
+    if (p->second.has_flag(pg_pool_t::FLAG_HASHPSPOOL)) {
       features |= CEPH_FEATURE_OSDHASHPSPOOL;
     }
     if (p->second.is_erasure() &&
index ab9f519c96eee8ca4af60c2016f2c6cd5b510707..91f02ef5d72531d226ab3cbcac14fc1565b13d03 100644 (file)
@@ -2230,7 +2230,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx)
 
   // check for full
   if (ctx->delta_stats.num_bytes > 0 &&
-      pool.info.get_flags() & pg_pool_t::FLAG_FULL) {
+      pool.info.has_flag(pg_pool_t::FLAG_FULL)) {
     reply_ctx(ctx, -ENOSPC);
     return;
   }