From 1d4c6079e3aca6df085fdbcfd0903da6c9b4ba30 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 11 Mar 2016 15:35:16 -0500 Subject: [PATCH] rgw: adapt to narrow stat2() and mtime2() The librados stat2() and mtime2() ops no longer provide an override for the internal ceph_realtime type. Signed-off-by: Matt Benjamin --- src/rgw/rgw_cr_rados.cc | 10 +++++----- src/rgw/rgw_cr_rados.h | 20 ++++++++++---------- src/rgw/rgw_rados.cc | 13 +++++++++---- src/rgw/rgw_rest_log.cc | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index c627fadc4e147..b4c782519d958 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -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), diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 03cc3e5dd6e1c..8f42e0e17e71b 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -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; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 61cc18717da0a..cc589d9a0c27a 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; } diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 0df093565bf57..f8bc6fde2d0ca 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -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; } -- 2.39.5