Skip to content

Commit

Permalink
rgw: more fixes following rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Mar 7, 2017
1 parent 54e2573 commit 636375b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/rgw/rgw_lc.cc
Expand Up @@ -423,7 +423,7 @@ int RGWLC::bucket_lc_process(string& shard_id)
RGWObjectCtx rctx(store);
rgw_obj obj(bucket_info.bucket, obj_iter->key);
RGWObjState *state;
int ret = store->get_obj_state(&rctx, obj, &state, false);
int ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false);
if (ret < 0) {
return ret;
}
Expand Down
3 changes: 1 addition & 2 deletions src/rgw/rgw_op.cc
Expand Up @@ -5490,8 +5490,7 @@ void RGWSetAttrs::execute()
if (op_ret < 0)
return;

rgw_obj obj(s->bucket, s->object.name);
obj.set_instance(s->object.instance);
rgw_obj obj(s->bucket, s->object);

store->set_atomic(s->obj_ctx, obj);

Expand Down
34 changes: 32 additions & 2 deletions src/rgw/rgw_rados.cc
Expand Up @@ -186,6 +186,36 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool, IoCtx& ioctx, b
return 0;
}

template<>
void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(rgw_obj& obj) {
RWLock::WLocker wl(lock);
auto iter = objs_state.find(obj);
if (iter == objs_state.end()) {
return;
}
bool is_atomic = iter->second.is_atomic;
bool prefetch_data = iter->second.prefetch_data;

objs_state.erase(iter);

if (is_atomic || prefetch_data) {
auto& s = objs_state[obj];
s.is_atomic = is_atomic;
s.prefetch_data = prefetch_data;
}
}

template<>
void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(rgw_raw_obj& obj) {
RWLock::WLocker wl(lock);
auto iter = objs_state.find(obj);
if (iter == objs_state.end()) {
return;
}

objs_state.erase(iter);
}

void RGWDefaultZoneGroupInfo::dump(Formatter *f) const {
encode_json("default_zonegroup", default_zonegroup, f);
}
Expand Down Expand Up @@ -5062,7 +5092,7 @@ int RGWRados::Bucket::List::list_objects(int max, vector<rgw_bucket_dir_entry> *
rgw_obj_index_key cur_end_marker;
if (!params.ns.empty()) {
end_marker_obj = rgw_obj_key(params.end_marker.name, params.end_marker.instance, params.ns);
end_marker_obj.set_ns(params.ns);
end_marker_obj.ns = params.ns;
end_marker_obj.get_index_key(&cur_end_marker);
}
rgw_obj_index_key cur_marker;
Expand Down Expand Up @@ -8337,7 +8367,7 @@ int RGWRados::delete_raw_obj(const rgw_raw_obj& obj)

int RGWRados::delete_system_obj(rgw_raw_obj& obj, RGWObjVersionTracker *objv_tracker)
{
if (obj.get_object().empty()) {
if (obj.empty()) {
ldout(cct, 1) << "delete_system_obj got empty object name "
<< obj << ", returning EINVAL" << dendl;
return -EINVAL;
Expand Down
8 changes: 7 additions & 1 deletion src/rgw/rgw_rados.h
Expand Up @@ -2104,6 +2104,12 @@ class RGWObjectCtxImpl {
}
};

template<>
void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(rgw_obj& obj);

template<>
void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(rgw_raw_obj& obj);

struct RGWObjectCtx {
RGWRados *store;
void *user_ctx;
Expand Down Expand Up @@ -3135,7 +3141,7 @@ class RGWRados

int get_system_obj_state(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker);
int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
bool follow_olh, assume_noent = false);
bool follow_olh, bool assume_noent = false);
int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state) {
return get_obj_state(rctx, bucket_info, obj, state, true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/rgw/rgw_tools.cc
Expand Up @@ -91,10 +91,10 @@ int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_pool& pool
return 0;
}

int rgw_delete_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, const string& oid,
int rgw_delete_system_obj(RGWRados *rgwstore, rgw_pool& pool, const string& oid,
RGWObjVersionTracker *objv_tracker)
{
rgw_obj obj(bucket, oid);
rgw_raw_obj obj(pool, oid);
return rgwstore->delete_system_obj(obj, objv_tracker);
}

Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_tools.h
Expand Up @@ -21,7 +21,7 @@ int rgw_put_system_obj(RGWRados *rgwstore, rgw_pool& pool, const string& oid, co
int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_pool& pool, const string& key, bufferlist& bl,
RGWObjVersionTracker *objv_tracker, real_time *pmtime, map<string, bufferlist> *pattrs = NULL,
rgw_cache_entry_info *cache_info = NULL);
int rgw_delete_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, const string& oid,
int rgw_delete_system_obj(RGWRados *rgwstore, rgw_pool& pool, const string& oid,
RGWObjVersionTracker *objv_tracker);

int rgw_tools_init(CephContext *cct);
Expand Down

0 comments on commit 636375b

Please sign in to comment.