]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: more simplification, no need to take reference to op
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 5 Aug 2015 20:58:55 +0000 (13:58 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 9 Feb 2016 20:59:41 +0000 (12:59 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_sync.cc

index 34f68ab52b3c3b7e3e12cb9e505290916f66b44f..aa6f89a0188556290a77405d08a74bb0ed0ccd0a 100644 (file)
@@ -512,7 +512,7 @@ class RGWReadSyncStatusOp : public RGWSimpleAsyncOp {
   RGWObjectCtx& obj_ctx;
   bufferlist bl;
 
-  RGWMetaSyncGlobalStatus global_status;
+  RGWMetaSyncGlobalStatus *global_status;
   rgw_obj global_status_obj;
 
   RGWMetaSyncStatusManager sync_store;
@@ -520,9 +520,11 @@ class RGWReadSyncStatusOp : public RGWSimpleAsyncOp {
 
 public:
   RGWReadSyncStatusOp(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
-                     RGWObjectCtx& _obj_ctx) : RGWSimpleAsyncOp(_store->ctx()),
+                     RGWObjectCtx& _obj_ctx,
+                     RGWMetaSyncGlobalStatus *_gs) : RGWSimpleAsyncOp(_store->ctx()),
                                                 async_rados(_async_rados), store(_store),
-                                                obj_ctx(_obj_ctx), sync_store(_store), req(NULL) {}
+                                                obj_ctx(_obj_ctx), global_status(_gs),
+                                                sync_store(_store), req(NULL) {}
                                                          
   ~RGWReadSyncStatusOp() {
     delete req;
@@ -531,8 +533,6 @@ public:
   int init();
   int send_request();
   int request_complete();
-
-  RGWMetaSyncGlobalStatus& get_global_status() { return global_status; }
 };
 
 int RGWReadSyncStatusOp::init()
@@ -562,10 +562,12 @@ int RGWReadSyncStatusOp::request_complete()
     }
     bufferlist::iterator iter = bl.begin();
     try {
-      ::decode(global_status, iter);
+      ::decode(*global_status, iter);
     } catch (buffer::error& err) {
       ldout(store->ctx(), 0) << "ERROR: failed to decode global mdlog status" << dendl;
     }
+  } else {
+    *global_status = RGWMetaSyncGlobalStatus();
   }
 
   return 0;
@@ -899,8 +901,7 @@ int RGWRemoteMetaLog::get_sync_status(RGWMetaSyncGlobalStatus *sync_status)
   list<RGWAsyncOpsStack *> stacks;
   RGWAsyncOpsStack *stack = new RGWAsyncOpsStack(store->ctx(), this);
   RGWObjectCtx obj_ctx(store, NULL);
-  RGWReadSyncStatusOp *op = new RGWReadSyncStatusOp(async_rados, store, obj_ctx);
-  op->get();
+  RGWReadSyncStatusOp *op = new RGWReadSyncStatusOp(async_rados, store, obj_ctx, sync_status);
   int r = stack->call(op);
 #if 0
   int ret = status_manager.read_global_status();
@@ -922,10 +923,7 @@ int RGWRemoteMetaLog::get_sync_status(RGWMetaSyncGlobalStatus *sync_status)
     ldout(store->ctx(), 0) << "ERROR: run(stacks) returned r=" << r << dendl;
   }
 
-  *sync_status = op->get_global_status();
-
   delete stack;
-  op->put();
 
   return r;
 }