]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: adapt to narrow stat2() and mtime2()
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 11 Mar 2016 20:35:16 +0000 (15:35 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 15 Mar 2016 04:44:40 +0000 (21:44 -0700)
The librados stat2() and mtime2() ops no longer provide an override
for the internal ceph_realtime type.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_log.cc

index c627fadc4e1474ee35e2092dfc6f5dc4558df702..b4c782519d958dfc55bc4612e394734394d01102 100644 (file)
@@ -466,10 +466,10 @@ int RGWAsyncFetchRemoteObj::_send_request()
                        src_obj,
                        bucket_info, /* dest */
                        bucket_info, /* source */
-                       NULL, /* time_t *src_mtime, */
-                       NULL, /* time_t *mtime, */
-                       NULL, /* const time_t *mod_ptr, */
-                       NULL, /* const time_t *unmod_ptr, */
+                       NULL, /* real_time* src_mtime, */
+                       NULL, /* real_time* mtime, */
+                       NULL, /* const real_time* mod_ptr, */
+                       NULL, /* const real_time* unmod_ptr, */
                        NULL, /* const char *if_match, */
                        NULL, /* const char *if_nomatch, */
                        RGWRados::ATTRSMOD_NONE,
@@ -624,7 +624,7 @@ int RGWAsyncStatObj::_send_request()
 
 RGWStatObjCR::RGWStatObjCR(RGWAsyncRadosProcessor *async_rados, RGWRados *store,
                            const rgw_obj& obj, uint64_t *psize,
-                          ceph::real_time *pmtime, uint64_t *pepoch,
+                           real_time* pmtime, uint64_t *pepoch,
                            RGWObjVersionTracker *objv_tracker)
   : RGWSimpleCoroutine(store->ctx()), store(store), async_rados(async_rados),
     obj(obj), psize(psize), pmtime(pmtime), pepoch(pepoch),
index 03cc3e5dd6e1cbdf6f1d75db68a2de128649e393..8f42e0e17e71bd3cbe7fc12e79be4e91be157af0 100644 (file)
@@ -634,7 +634,7 @@ class RGWAsyncFetchRemoteObj : public RGWAsyncRadosRequest {
   rgw_obj_key key;
   uint64_t versioned_epoch;
 
-  time_t src_mtime;
+  real_time src_mtime;
 
   bool copy_if_newer;
 
@@ -665,7 +665,7 @@ class RGWFetchRemoteObjCR : public RGWSimpleCoroutine {
   rgw_obj_key key;
   uint64_t versioned_epoch;
 
-  time_t src_mtime;
+  real_time src_mtime;
 
   bool copy_if_newer;
 
@@ -896,7 +896,7 @@ class RGWAsyncStatObj : public RGWAsyncRadosRequest {
   RGWRados *store;
   rgw_obj obj;
   uint64_t *psize;
-  ceph::real_time *pmtime;
+  real_time *pmtime;
   uint64_t *pepoch;
   RGWObjVersionTracker *objv_tracker;
 protected:
@@ -904,10 +904,10 @@ protected:
 public:
   RGWAsyncStatObj(RGWAioCompletionNotifier *cn, RGWRados *store,
                   const rgw_obj& obj, uint64_t *psize = nullptr,
-                  ceph::real_time *pmtime = nullptr, uint64_t *pepoch = nullptr,
+                  real_time *pmtime = nullptr, uint64_t *pepoch = nullptr,
                   RGWObjVersionTracker *objv_tracker = nullptr)
-    : RGWAsyncRadosRequest(cn), store(store), obj(obj), psize(psize),
-      pmtime(pmtime), pepoch(pepoch), objv_tracker(objv_tracker) {}
+         : RGWAsyncRadosRequest(cn), store(store), obj(obj), psize(psize),
+         pmtime(pmtime), pepoch(pepoch), objv_tracker(objv_tracker) {}
 };
 
 class RGWStatObjCR : public RGWSimpleCoroutine {
@@ -915,15 +915,15 @@ class RGWStatObjCR : public RGWSimpleCoroutine {
   RGWAsyncRadosProcessor *async_rados;
   rgw_obj obj;
   uint64_t *psize;
-  ceph::real_time  *pmtime;
+  real_time *pmtime;
   uint64_t *pepoch;
   RGWObjVersionTracker *objv_tracker;
   RGWAsyncStatObj *req = nullptr;
  public:
   RGWStatObjCR(RGWAsyncRadosProcessor *async_rados, RGWRados *store,
-               const rgw_obj& obj, uint64_t *psize = nullptr,
-               ceph::real_time *pmtime = nullptr, uint64_t *pepoch = nullptr,
-               RGWObjVersionTracker *objv_tracker = nullptr);
+         const rgw_obj& obj, uint64_t *psize = nullptr,
+         real_time* pmtime = nullptr, uint64_t *pepoch = nullptr,
+         RGWObjVersionTracker *objv_tracker = nullptr);
   ~RGWStatObjCR();
 
   int send_request() override;
index 61cc18717da0a13741e387850781cb64cc811344..cc589d9a0c27aab45f4990441dddbdcbef07702f 100644 (file)
@@ -5514,6 +5514,7 @@ int RGWRados::move_rados_obj(librados::IoCtx& src_ioctx,
   uint64_t chunk_size = COPY_BUF_SIZE;
   uint64_t ofs = 0;
   int ret = 0;
+  real_time mtime;
   struct timespec mtime_ts;
   uint64_t size;
 
@@ -5531,6 +5532,7 @@ int RGWRados::move_rados_obj(librados::IoCtx& src_ioctx,
 
     if (ofs == 0) {
       rop.stat2(&size, &mtime_ts, NULL);
+      mtime = real_clock::from_timespec(mtime_ts);
     }
     rop.read(ofs, chunk_size, &data, NULL);
     ret = src_ioctx.operate(src_oid, &rop, NULL);
@@ -5545,6 +5547,7 @@ int RGWRados::move_rados_obj(librados::IoCtx& src_ioctx,
     if (ofs == 0) {
       wop.create(true); /* make it exclusive */
       wop.mtime2(&mtime_ts);
+      mtime = real_clock::from_timespec(mtime_ts);
     }
     wop.write(ofs, data);
     ret = dst_ioctx.operate(dst_oid, &wop);
@@ -5781,7 +5784,8 @@ int RGWRados::Object::Write::write_meta(uint64_t size,
   if (state->is_olh) {
     op.setxattr(RGW_ATTR_OLH_ID_TAG, state->olh_tag);
   }
-  struct timespec mtime_ts = ceph::real_clock::to_timespec(meta.set_mtime);
+
+  struct timespec mtime_ts = real_clock::to_timespec(meta.set_mtime);
   op.mtime2(&mtime_ts);
 
   if (meta.data) {
@@ -6006,8 +6010,7 @@ int RGWRados::put_system_obj_impl(rgw_obj& obj, uint64_t size, real_time *mtime,
     set_mtime = real_clock::now();
   }
 
-  struct timespec mtime_ts = ceph::real_clock::to_timespec(set_mtime);
-
+  struct timespec mtime_ts = real_clock::to_timespec(set_mtime);
   op.mtime2(&mtime_ts);
   op.write_full(data);
 
@@ -7850,7 +7853,9 @@ int RGWRados::Object::Stat::stat_async()
   state.io_ctx.locator_set_key(loc);
   r = state.io_ctx.aio_operate(oid, state.completion, &op, NULL);
   if (r < 0) {
-    ldout(store->ctx(), 5) << __func__ << ": ERROR: aio_operate() returned ret=" << r << dendl;
+    ldout(store->ctx(), 5) << __func__
+                                                  << ": ERROR: aio_operate() returned ret=" << r
+                                                  << dendl;
     return r;
   }
 
index 0df093565bf57be15c9ca2d97d30693588a97675..f8bc6fde2d0ca76be54f6d895a4345633c0eaae0 100644 (file)
@@ -260,7 +260,7 @@ void RGWOp_MDLog_Lock::execute() {
     return;
   }
   http_ret = meta_log.lock_exclusive(shard_id, timespan(dur), zone_id,
-                                     locker_id);
+                                    locker_id);
   if (http_ret == -EBUSY)
     http_ret = -ERR_LOCKED;
 }