]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: CLEANUP: Change getattr_maybe_cache() to reflect how it is being used
authorDavid Zafman <dzafman@redhat.com>
Tue, 12 Sep 2017 22:09:14 +0000 (15:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Tue, 23 Jan 2018 19:13:34 +0000 (11:13 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 143111a112ec64724226f83ed285f66ee52204b2)

src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index 3dd4eff09893b04f12545410058f70eac0261b7d..a0f881a9db353b896245c6323e8e4ce2e28a7ffa 100644 (file)
@@ -5432,8 +5432,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        map<string, bufferlist> out;
        result = getattrs_maybe_cache(
          ctx->obc,
-         &out,
-         true);
+         &out);
         
         bufferlist bl;
         ::encode(out, bl);
@@ -6196,8 +6195,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        /* rm_attrs */
        map<string,bufferlist> rmattrs;
        result = getattrs_maybe_cache(ctx->obc,
-                   &rmattrs,
-                   true);
+                   &rmattrs);
        if (result < 0) {
          return result;
        }
@@ -7854,8 +7852,7 @@ int PrimaryLogPG::do_copy_get(OpContext *ctx, bufferlist::iterator& bp,
   if (!cursor.attr_complete) {
     result = getattrs_maybe_cache(
       ctx->obc,
-      &out_attrs,
-      true);
+      &out_attrs);
     if (result < 0) {
       if (cb) {
         delete cb;
@@ -14548,26 +14545,23 @@ int PrimaryLogPG::getattr_maybe_cache(
 
 int PrimaryLogPG::getattrs_maybe_cache(
   ObjectContextRef obc,
-  map<string, bufferlist> *out,
-  bool user_only)
+  map<string, bufferlist> *out)
 {
   int r = 0;
+  assert(out);
   if (pool.info.require_rollback()) {
-    if (out)
-      *out = obc->attr_cache;
+    *out = obc->attr_cache;
   } else {
     r = pgbackend->objects_get_attrs(obc->obs.oi.soid, out);
   }
-  if (out && user_only) {
-    map<string, bufferlist> tmp;
-    for (map<string, bufferlist>::iterator i = out->begin();
-        i != out->end();
-        ++i) {
-      if (i->first.size() > 1 && i->first[0] == '_')
-       tmp[i->first.substr(1, i->first.size())].claim(i->second);
-    }
-    tmp.swap(*out);
+  map<string, bufferlist> tmp;
+  for (map<string, bufferlist>::iterator i = out->begin();
+       i != out->end();
+       ++i) {
+    if (i->first.size() > 1 && i->first[0] == '_')
+      tmp[i->first.substr(1, i->first.size())].claim(i->second);
   }
+  tmp.swap(*out);
   return r;
 }
 
index df2a45f5877bbff4625124f7e0a5bbbba3f09e89..5289e78b0bad19037bd471f5731f1e357051edd8 100644 (file)
@@ -1802,8 +1802,7 @@ public:
     bufferlist *val);
   int getattrs_maybe_cache(
     ObjectContextRef obc,
-    map<string, bufferlist> *out,
-    bool user_only = false);
+    map<string, bufferlist> *out);
 };
 
 inline ostream& operator<<(ostream& out, const PrimaryLogPG::RepGather& repop)