static bool rgw_get_obj_data_pool(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params,
- const rgw_obj& obj, rgw_pool *pool)
+ const string& placement_id, const rgw_obj& obj, rgw_pool *pool)
{
- if (!zone_params.get_data_pool(obj, pool)) {
+ if (!zone_params.get_head_data_pool(placement_id, obj, pool)) {
RGWZonePlacementInfo placement;
if (!zone_params.get_placement(zonegroup.default_placement, &placement)) {
return false;
return true;
}
-bool rgw_obj_to_raw(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params,
- const rgw_obj& obj, rgw_raw_obj *raw_obj)
+static bool rgw_obj_to_raw(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params,
+ const string& placement_id, const rgw_obj& obj, rgw_raw_obj *raw_obj)
{
get_obj_bucket_and_oid_loc(obj, raw_obj->oid, raw_obj->loc);
- return rgw_get_obj_data_pool(zonegroup, zone_params, obj, &raw_obj->pool);
+ return rgw_get_obj_data_pool(zonegroup, zone_params, placement_id, obj, &raw_obj->pool);
}
rgw_raw_obj rgw_obj_select::get_raw_obj(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params) const
{
if (!is_raw) {
rgw_raw_obj r;
- rgw_obj_to_raw(zonegroup, zone_params, obj, &r);
+ rgw_obj_to_raw(zonegroup, zone_params, placement_rule, obj, &r);
return r;
}
return raw_obj;
{
if (!is_raw) {
rgw_raw_obj r;
- store->obj_to_raw(obj, &r);
+ store->obj_to_raw(placement_rule, obj, &r);
return r;
}
return raw_obj;
update_location();
}
-int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m, rgw_bucket& _b, rgw_obj& _obj)
+int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m, const string& placement_rule, rgw_bucket& _b, rgw_obj& _obj)
{
manifest = _m;
- manifest->set_tail_bucket(_b);
- manifest->set_head(_obj, 0);
+ manifest->set_tail_placement(placement_rule, _b);
+ manifest->set_head(placement_rule, _obj, 0);
last_ofs = 0;
if (manifest->get_prefix().empty()) {
if (ofs == 0) {
part.loc = obj;
} else {
- rgw_raw_obj_to_obj(tail_bucket, raw_loc, &part.loc);
+ rgw_raw_obj_to_obj(tail_placement.bucket, raw_loc, &part.loc);
}
++iter;
uint64_t next_ofs = iter.get_stripe_ofs();
rgw_raw_obj raw_head;
if (!head_obj.empty()) {
- store->obj_to_raw(head_obj, &raw_head);
+ store->obj_to_raw(bucket_info.placement_rule, head_obj, &raw_head);
}
/**
{
RGWPutObjProcessor_Aio::prepare(store, oid_rand);
- int r = store->get_max_chunk_size(head_obj, &max_chunk_size);
+ int r = store->get_max_chunk_size(bucket_info.placement_rule, head_obj, &max_chunk_size);
if (r < 0) {
return r;
}
manifest.set_trivial_rule(max_chunk_size, store->ctx()->_conf->rgw_obj_stripe_size);
- r = manifest_gen.create_begin(store->ctx(), &manifest, head_obj.bucket, head_obj);
+ r = manifest_gen.create_begin(store->ctx(), &manifest, bucket_info.placement_rule, head_obj.bucket, head_obj);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::get_max_chunk_size(const rgw_obj& obj, uint64_t *max_chunk_size)
+int RGWRados::get_max_chunk_size(const string& placement_rule, const rgw_obj& obj, uint64_t *max_chunk_size)
{
rgw_pool pool;
- if (!get_obj_data_pool(obj, &pool)) {
+ if (!get_obj_data_pool(placement_rule, obj, &pool)) {
ldout(cct, 0) << "ERROR: failed to get data pool for object " << obj << dendl;
return -EIO;
}
return 0;
}
-bool RGWRados::get_obj_data_pool(const rgw_obj& obj, rgw_pool *pool)
+bool RGWRados::get_obj_data_pool(const string& placement_rule, const rgw_obj& obj, rgw_pool *pool)
{
- return rgw_get_obj_data_pool(zonegroup, zone_params, obj, pool);
+ return rgw_get_obj_data_pool(zonegroup, zone_params, placement_rule, obj, pool);
}
-bool RGWRados::obj_to_raw(const rgw_obj& obj, rgw_raw_obj *raw_obj)
+bool RGWRados::obj_to_raw(const string& placement_rule, const rgw_obj& obj, rgw_raw_obj *raw_obj)
{
get_obj_bucket_and_oid_loc(obj, raw_obj->oid, raw_obj->loc);
- return get_obj_data_pool(obj, &raw_obj->pool);
+ return get_obj_data_pool(placement_rule, obj, &raw_obj->pool);
}
int RGWRados::update_placement_map()
return 0;
}
-int RGWRados::get_obj_ioctx(const rgw_obj& obj, librados::IoCtx *ioctx)
+int RGWRados::get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx)
{
string oid, key;
get_obj_bucket_and_oid_loc(obj, oid, key);
rgw_pool pool;
- if (!get_obj_data_pool(obj, &pool)) {
+ if (!get_obj_data_pool(bucket_info.placement_rule, obj, &pool)) {
ldout(cct, 0) << "ERROR: cannot get data pool for obj=" << obj << ", probably misconfiguration" << dendl;
return -EIO;
}
return 0;
}
-int RGWRados::get_obj_ref(const rgw_obj& obj, rgw_rados_ref *ref)
+int RGWRados::get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_rados_ref *ref)
{
get_obj_bucket_and_oid_loc(obj, ref->oid, ref->key);
rgw_pool pool;
- if (!get_obj_data_pool(obj, &pool)) {
+ if (!get_obj_data_pool(bucket_info.placement_rule, obj, &pool)) {
ldout(cct, 0) << "ERROR: cannot get data pool for obj=" << obj << ", probably misconfiguration" << dendl;
return -EIO;
}
* fixes an issue where head objects were supposed to have a locator created, but ended
* up without one
*/
-int RGWRados::fix_head_obj_locator(rgw_bucket& bucket, bool copy_obj, bool remove_bad, rgw_obj_key& key)
+int RGWRados::fix_head_obj_locator(const RGWBucketInfo& bucket_info, bool copy_obj, bool remove_bad, rgw_obj_key& key)
{
+ const rgw_bucket& bucket = bucket_info.bucket;
string oid;
string locator;
librados::IoCtx ioctx;
- int ret = get_obj_ioctx(obj, &ioctx);
+ int ret = get_obj_head_ioctx(bucket_info, obj, &ioctx);
if (ret < 0) {
- cerr << "ERROR: get_obj_ioctx() returned ret=" << ret << std::endl;
+ cerr << "ERROR: get_obj_head_ioctx() returned ret=" << ret << std::endl;
return ret;
}
ioctx.locator_set_key(string()); /* override locator for this object, use empty locator */
* fixes an issue where head objects were supposed to have a locator created, but ended
* up without one
*/
-int RGWRados::fix_tail_obj_locator(rgw_bucket& bucket, rgw_obj_key& key, bool fix, bool *need_fix)
+int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix)
{
+ const rgw_bucket& bucket = bucket_info.bucket;
rgw_obj obj(bucket, key);
if (need_fix) {
}
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
RGWObjState *astate = NULL;
RGWObjectCtx rctx(this);
- r = get_obj_state(&rctx, obj, &astate, false);
+ r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
if (r < 0)
return r;
string oid;
string locator;
- rgw_raw_obj_to_obj(manifest.get_tail_bucket(), raw_loc, &loc);
+ rgw_raw_obj_to_obj(manifest.get_tail_placement().bucket, raw_loc, &loc);
if (loc.key.ns.empty()) {
/* continue, we're only interested in tail objects */
obj_ctx.obj.set_atomic(obj);
RGWObjState * state = nullptr;
- int r = get_obj_state(&obj_ctx, obj, &state, false);
+ int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false);
if (r < 0) {
return r;
}
return -EIO;
}
- r = store->get_obj_ref(obj, &ref);
+ r = store->get_obj_head_ref(target->get_bucket_info(), obj, &ref);
if (r < 0)
return r;
uint64_t max_chunk_size;
- ret = get_max_chunk_size(obj, &max_chunk_size);
+ ret = get_max_chunk_size(dest_bucket_info.placement_rule, obj, &max_chunk_size);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to get max_chunk_size() for bucket " << obj.bucket << dendl;
return ret;
if (copy_if_newer) {
/* need to get mtime for destination */
- ret = get_obj_state(&obj_ctx, dest_obj, &dest_state, false);
+ ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
if (ret < 0)
goto set_err_state;
if (copy_if_newer && cb.is_canceled()) {
ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl;
obj_ctx.obj.invalidate(dest_obj); /* object was overwritten */
- ret = get_obj_state(&obj_ctx, dest_obj, &dest_state, false);
+ ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
if (ret < 0) {
ldout(cct, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
goto set_err_state;
RGWObjManifest manifest;
RGWObjState *astate = NULL;
- ret = get_obj_state(&obj_ctx, src_obj, &astate);
+ ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate);
if (ret < 0) {
return ret;
}
}
uint64_t max_chunk_size;
- ret = get_max_chunk_size(dest_obj, &max_chunk_size);
+ ret = get_max_chunk_size(dest_bucket_info.placement_rule, dest_obj, &max_chunk_size);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to get max_chunk_size() for bucket " << dest_obj.bucket << dendl;
return ret;
rgw_pool src_pool;
rgw_pool dest_pool;
- if (!get_obj_data_pool(src_obj, &src_pool)) {
+ if (!get_obj_data_pool(src_bucket_info.placement_rule, src_obj, &src_pool)) {
ldout(cct, 0) << "ERROR: failed to locate data pool for " << src_obj << dendl;
return -EIO;
}
- if (!get_obj_data_pool(dest_obj, &dest_pool)) {
+ if (!get_obj_data_pool(dest_bucket_info.placement_rule, dest_obj, &dest_pool)) {
ldout(cct, 0) << "ERROR: failed to locate data pool for " << dest_obj << dendl;
return -EIO;
}
if (!copy_itself) {
manifest = astate->manifest;
- rgw_bucket& tail_bucket = manifest.get_tail_bucket();
- if (tail_bucket.name.empty()) {
- manifest.set_tail_bucket(src_obj.bucket);
+ const rgw_bucket_placement& tail_placement = manifest.get_tail_placement();
+ if (tail_placement.bucket.name.empty()) {
+ manifest.set_tail_placement(tail_placement.placement_rule, src_obj.bucket);
}
string oid, key;
for (; miter != astate->manifest.obj_end(); ++miter) {
goto done_ret;
}
- pmanifest->set_head(dest_obj, first_chunk.length());
+ pmanifest->set_head(dest_bucket_info.placement_rule, dest_obj, first_chunk.length());
} else {
- pmanifest->set_head(dest_obj, 0);
+ pmanifest->set_head(dest_bucket_info.placement_rule, dest_obj, 0);
}
write_op.meta.data = &first_chunk;
{
RGWObjManifest::obj_iterator iter;
rgw_raw_obj raw_head;
- obj_to_raw(head_obj, &raw_head);
+ obj_to_raw(manifest.get_head_placement_rule(), head_obj, &raw_head);
for (iter = manifest.obj_begin(); iter != manifest.obj_end(); ++iter) {
const rgw_raw_obj& mobj = iter.get_location().get_raw_obj(this);
if (mobj == raw_head)
}
-int RGWRados::defer_gc(void *ctx, rgw_obj& obj)
+int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj)
{
RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
std::string oid, key;
RGWObjState *state = NULL;
- int r = get_obj_state(rctx, obj, &state, false);
+ int r = get_obj_state(rctx, bucket_info, obj, &state, false);
if (r < 0)
return r;
} else {
rgw_bucket_dir_entry dirent;
- int r = store->bi_get_instance(obj, &dirent);
+ int r = store->bi_get_instance(target->get_bucket_info(), obj, &dirent);
if (r < 0) {
return r;
}
}
rgw_rados_ref ref;
- int r = store->get_obj_ref(obj, &ref);
+ int r = store->get_obj_head_ref(target->get_bucket_info(), obj, &ref);
if (r < 0) {
return r;
}
}
int RGWRados::delete_obj(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& bucket_info,
+ const RGWBucketInfo& bucket_info,
const rgw_obj& obj,
int versioning_status,
uint16_t bilog_flags,
return (iter != attrs.end());
}
-int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const rgw_obj& obj, RGWObjState *olh_state,
- RGWObjState **target_state)
+int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+ RGWObjState *olh_state, RGWObjState **target_state)
{
assert(olh_state->is_olh);
rgw_obj target;
- int r = RGWRados::follow_olh(obj_ctx, olh_state, obj, &target); /* might return -EAGAIN */
+ int r = RGWRados::follow_olh(bucket_info, obj_ctx, olh_state, obj, &target); /* might return -EAGAIN */
if (r < 0) {
return r;
}
- r = get_obj_state(&obj_ctx, target, target_state, false);
+ r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false);
if (r < 0) {
return r;
}
return ret;
}
-int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
+int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+ RGWObjState **state, bool follow_olh, bool assume_noent)
{
bool need_follow_olh = follow_olh && obj.key.instance.empty();
*state = s;
if (s->has_attrs) {
if (s->is_olh && need_follow_olh) {
- return get_olh_target_state(*rctx, obj, s, state);
+ return get_olh_target_state(*rctx, bucket_info, obj, s, state);
}
return 0;
}
s->obj = obj;
rgw_raw_obj raw_obj;
- obj_to_raw(obj, &raw_obj);
+ obj_to_raw(bucket_info.placement_rule, obj, &raw_obj);
int r = -ENOENT;
try {
::decode(s->manifest, miter);
s->has_manifest = true;
- s->manifest.set_head(obj, s->size); /* patch manifest to reflect the head we just read, some manifests might be
+ s->manifest.set_head(bucket_info.placement_rule, obj, s->size); /* patch manifest to reflect the head we just read, some manifests might be
broken due to old bugs */
s->size = s->manifest.get_obj_size();
} catch (buffer::error& err) {
ldout(cct, 20) << __func__ << ": setting s->olh_tag to " << string(s->olh_tag.c_str(), s->olh_tag.length()) << dendl;
if (need_follow_olh) {
- return get_olh_target_state(*rctx, obj, s, state);
+ return get_olh_target_state(*rctx, bucket_info, obj, s, state);
}
}
return 0;
}
-int RGWRados::get_obj_state(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
+int RGWRados::get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
+ bool follow_olh, bool assume_noent)
{
int ret;
do {
- ret = get_obj_state_impl(rctx, obj, state, follow_olh, assume_noent);
+ ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, assume_noent);
} while (ret == -EAGAIN);
return ret;
string loc;
get_obj_bucket_and_oid_loc(obj, oid, loc);
- int r = store->get_obj_ioctx(obj, &state.io_ctx);
+ int r = store->get_obj_head_ioctx(source->get_bucket_info(), obj, &state.io_ctx);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::append_atomic_test(RGWObjectCtx *rctx, const rgw_obj& obj,
- ObjectOperation& op, RGWObjState **pstate)
+int RGWRados::append_atomic_test(RGWObjectCtx *rctx,
+ const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+ ObjectOperation& op, RGWObjState **pstate)
{
if (!rctx)
return 0;
- int r = get_obj_state(rctx, obj, pstate, false);
+ int r = get_obj_state(rctx, bucket_info, obj, pstate, false);
if (r < 0)
return r;
int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, bool assume_noent)
{
- return store->get_obj_state(&ctx, obj, pstate, follow_olh, assume_noent);
+ return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, assume_noent);
}
void RGWRados::Object::invalidate_state()
* bl: the contents of the attr
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::set_attr(void *ctx, rgw_obj& obj, const char *name, bufferlist& bl)
+int RGWRados::set_attr(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl)
{
map<string, bufferlist> attrs;
attrs[name] = bl;
- return set_attrs(ctx, obj, attrs, NULL);
+ return set_attrs(ctx, bucket_info, obj, attrs, NULL);
}
-int RGWRados::set_attrs(void *ctx, rgw_obj& obj,
+int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj,
map<string, bufferlist>& attrs,
map<string, bufferlist>* rmattrs)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
ObjectWriteOperation op;
RGWObjState *state = NULL;
- r = append_atomic_test(rctx, obj, op, &state);
+ r = append_atomic_test(rctx, bucket_info, obj, op, &state);
if (r < 0)
return r;
RGWObjectCtx obj_ctx(this);
- RGWBucketInfo bucket_info;
- int ret = get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL);
- if (ret < 0) {
- ldout(cct, 0) << "ERROR: " << __func__ << "() get_bucket_instance_info(bucket=" << bucket << ") returned ret=" << ret << dendl;
- return ret;
- }
-
bufferlist bl;
RGWRados::Bucket bop(this, bucket_info);
RGWRados::Bucket::UpdateIndex index_op(&bop, obj);
return -ENOENT;
}
+ const RGWBucketInfo& bucket_info = source->get_bucket_info();
+
state.obj = astate->obj;
- store->obj_to_raw(state.obj, &state.head_obj);
+ store->obj_to_raw(bucket_info.placement_rule, state.obj, &state.head_obj);
- r = store->get_obj_ioctx(state.obj, &state.io_ctx);
+ r = store->get_obj_head_ioctx(bucket_info, state.obj, &state.io_ctx);
if (r < 0) {
return r;
}
if (reading_from_head) {
/* only when reading from the head object do we need to do the atomic test */
- r = store->append_atomic_test(&source->get_ctx(), state.obj, op, &astate);
+ r = store->append_atomic_test(&source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate);
if (r < 0)
return r;
}
};
-static int _get_obj_iterate_cb(const rgw_obj& obj, const rgw_raw_obj& read_obj, off_t obj_ofs, off_t read_ofs, off_t len, bool is_head_obj, RGWObjState *astate, void *arg)
+static int _get_obj_iterate_cb(const RGWBucketInfo& bucket_info, const rgw_obj& obj, const rgw_raw_obj& read_obj, off_t obj_ofs, off_t read_ofs, off_t len, bool is_head_obj, RGWObjState *astate, void *arg)
{
struct get_obj_data *d = (struct get_obj_data *)arg;
- return d->rados->get_obj_iterate_cb(d->ctx, astate, obj, read_obj, obj_ofs, read_ofs, len, is_head_obj, arg);
+ return d->rados->get_obj_iterate_cb(d->ctx, astate, bucket_info, obj, read_obj, obj_ofs, read_ofs, len, is_head_obj, arg);
}
static void _get_obj_aio_completion_cb(completion_t cb, void *arg)
}
int RGWRados::get_obj_iterate_cb(RGWObjectCtx *ctx, RGWObjState *astate,
+ const RGWBucketInfo& bucket_info,
const rgw_obj& obj,
const rgw_raw_obj& read_obj,
off_t obj_ofs,
if (is_head_obj) {
/* only when reading from the head object do we need to do the atomic test */
- r = append_atomic_test(rctx, obj, op, &astate);
+ r = append_atomic_test(rctx, bucket_info, obj, op, &astate);
if (r < 0)
return r;
data->io_ctx.dup(state.io_ctx);
data->client_cb = cb;
- int r = store->iterate_obj(obj_ctx, state.obj, ofs, end, cct->_conf->rgw_get_obj_max_req_size, _get_obj_iterate_cb, (void *)data);
+ int r = store->iterate_obj(obj_ctx, source->get_bucket_info(), state.obj, ofs, end, cct->_conf->rgw_get_obj_max_req_size, _get_obj_iterate_cb, (void *)data);
if (r < 0) {
data->cancel_all_io();
goto done;
return r;
}
-int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, rgw_obj& obj,
+int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx,
+ const RGWBucketInfo& bucket_info, const rgw_obj& obj,
off_t ofs, off_t end,
uint64_t max_chunk_size,
- int (*iterate_obj_cb)(const rgw_obj& obj, const rgw_raw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
+ int (*iterate_obj_cb)(const RGWBucketInfo&, const rgw_obj& obj,
+ const rgw_raw_obj&, off_t, off_t, off_t, bool,
+ RGWObjState *, void *),
void *arg)
{
rgw_raw_obj head_obj;
bool reading_from_head = true;
RGWObjState *astate = NULL;
- obj_to_raw(obj, &head_obj);
+ obj_to_raw(bucket_info.placement_rule, obj, &head_obj);
- int r = get_obj_state(&obj_ctx, obj, &astate, false);
+ int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false);
if (r < 0) {
return r;
}
}
reading_from_head = (read_obj == head_obj);
- r = iterate_obj_cb(obj, read_obj, ofs, read_ofs, read_len, reading_from_head, astate, arg);
+ r = iterate_obj_cb(bucket_info, obj, read_obj, ofs, read_ofs, read_len, reading_from_head, astate, arg);
if (r < 0) {
return r;
}
read_obj = head_obj;
uint64_t read_len = min(len, max_chunk_size);
- r = iterate_obj_cb(obj, read_obj, ofs, ofs, read_len, reading_from_head, astate, arg);
+ r = iterate_obj_cb(bucket_info, obj, read_obj, ofs, ofs, read_len, reading_from_head, astate, arg);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::obj_operate(const rgw_obj& obj, ObjectWriteOperation *op)
+int RGWRados::obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, ObjectWriteOperation *op)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
return ref.ioctx.operate(ref.oid, op);
}
-int RGWRados::obj_operate(const rgw_obj& obj, ObjectReadOperation *op)
+int RGWRados::obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, ObjectReadOperation *op)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
return ref.ioctx.operate(ref.oid, op, &outbl);
}
-int RGWRados::olh_init_modification_impl(RGWObjState& state, const rgw_obj& olh_obj, string *op_tag)
+int RGWRados::olh_init_modification_impl(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, string *op_tag)
{
ObjectWriteOperation op;
op.setxattr(attr_name.c_str(), bl);
- ret = obj_operate(olh_obj, &op);
+ ret = obj_operate(bucket_info, olh_obj, &op);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRados::olh_init_modification(RGWObjState& state, const rgw_obj& obj, string *op_tag)
+int RGWRados::olh_init_modification(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj, string *op_tag)
{
int ret;
- ret = olh_init_modification_impl(state, obj, op_tag);
+ ret = olh_init_modification_impl(bucket_info, state, obj, op_tag);
if (ret == -EEXIST) {
ret = -ECANCELED;
}
return ret;
}
-int RGWRados::bucket_index_link_olh(RGWObjState& olh_state, const rgw_obj& obj_instance, bool delete_marker,
+int RGWRados::bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjState& olh_state, const rgw_obj& obj_instance,
+ bool delete_marker,
const string& op_tag,
struct rgw_bucket_dir_entry_meta *meta,
uint64_t olh_epoch,
real_time unmod_since, bool high_precision_time)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj_instance, &ref);
+ int r = get_obj_head_ref(bucket_info, obj_instance, &ref);
if (r < 0) {
return r;
}
op.cmpxattr(RGW_ATTR_OLH_ID_TAG, CEPH_OSD_CMPXATTR_OP_EQ, olh_state.olh_tag);
}
-int RGWRados::bucket_index_unlink_instance(const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch)
+int RGWRados::bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance,
+ const string& op_tag, const string& olh_tag, uint64_t olh_epoch)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj_instance, &ref);
+ int r = get_obj_head_ref(bucket_info, obj_instance, &ref);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::bucket_index_read_olh_log(RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker,
+int RGWRados::bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state,
+ const rgw_obj& obj_instance, uint64_t ver_marker,
map<uint64_t, vector<rgw_bucket_olh_log_entry> > *log,
bool *is_truncated)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj_instance, &ref);
+ int r = get_obj_head_ref(bucket_info, obj_instance, &ref);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver)
+int RGWRados::bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj_instance, &ref);
+ int r = get_obj_head_ref(bucket_info, obj_instance, &ref);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::bucket_index_clear_olh(RGWObjState& state, const rgw_obj& obj_instance)
+int RGWRados::bucket_index_clear_olh(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj_instance, &ref);
+ int r = get_obj_head_ref(bucket_info, obj_instance, &ref);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, RGWBucketInfo& bucket_info, const rgw_obj& obj,
+int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
bufferlist& olh_tag, map<uint64_t, vector<rgw_bucket_olh_log_entry> >& log,
uint64_t *plast_ver)
{
}
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
return r;
}
- r = bucket_index_trim_olh_log(state, obj, last_ver);
+ r = bucket_index_trim_olh_log(bucket_info, state, obj, last_ver);
if (r < 0) {
ldout(cct, 0) << "ERROR: could not trim olh log, r=" << r << dendl;
return r;
/*
* only clear if was successful, otherwise we might clobber pending operations on this object
*/
- r = bucket_index_clear_olh(state, obj);
+ r = bucket_index_clear_olh(bucket_info, state, obj);
if (r < 0) {
ldout(cct, 0) << "ERROR: could not clear bucket index olh entries r=" << r << dendl;
return r;
/*
* read olh log and apply it
*/
-int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, const rgw_obj& obj)
+int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj)
{
map<uint64_t, vector<rgw_bucket_olh_log_entry> > log;
bool is_truncated;
uint64_t ver_marker = 0;
do {
- int ret = bucket_index_read_olh_log(*state, obj, ver_marker, &log, &is_truncated);
+ int ret = bucket_index_read_olh_log(bucket_info, *state, obj, ver_marker, &log, &is_truncated);
if (ret < 0) {
return ret;
}
obj_ctx.obj.invalidate(olh_obj);
}
- ret = get_obj_state(&obj_ctx, olh_obj, &state, false); /* don't follow olh */
+ ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
if (ret < 0) {
return ret;
}
- ret = olh_init_modification(*state, olh_obj, &op_tag);
+ ret = olh_init_modification(bucket_info, *state, olh_obj, &op_tag);
if (ret < 0) {
ldout(cct, 20) << "olh_init_modification() target_obj=" << target_obj << " delete_marker=" << (int)delete_marker << " returned " << ret << dendl;
if (ret == -ECANCELED) {
}
return ret;
}
- ret = bucket_index_link_olh(*state, target_obj, delete_marker, op_tag, meta, olh_epoch, unmod_since, high_precision_time);
+ ret = bucket_index_link_olh(bucket_info, *state, target_obj, delete_marker, op_tag, meta, olh_epoch, unmod_since, high_precision_time);
if (ret < 0) {
ldout(cct, 20) << "bucket_index_link_olh() target_obj=" << target_obj << " delete_marker=" << (int)delete_marker << " returned " << ret << dendl;
if (ret == -ECANCELED) {
obj_ctx.obj.invalidate(olh_obj);
}
- ret = get_obj_state(&obj_ctx, olh_obj, &state, false); /* don't follow olh */
+ ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
if (ret < 0)
return ret;
- ret = olh_init_modification(*state, olh_obj, &op_tag);
+ ret = olh_init_modification(bucket_info, *state, olh_obj, &op_tag);
if (ret < 0) {
ldout(cct, 20) << "olh_init_modification() target_obj=" << target_obj << " returned " << ret << dendl;
if (ret == -ECANCELED) {
string olh_tag(state->olh_tag.c_str(), state->olh_tag.length());
- ret = bucket_index_unlink_instance(target_obj, op_tag, olh_tag, olh_epoch);
+ ret = bucket_index_unlink_instance(bucket_info, target_obj, op_tag, olh_tag, olh_epoch);
if (ret < 0) {
- ldout(cct, 20) << "bucket_index_link_olh() target_obj=" << target_obj << " returned " << ret << dendl;
+ ldout(cct, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl;
if (ret == -ECANCELED) {
continue;
}
}
}
-int RGWRados::get_olh(const rgw_obj& obj, RGWOLHInfo *olh)
+int RGWRados::get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWOLHInfo *olh)
{
map<string, bufferlist> unfiltered_attrset;
op.getxattrs(&unfiltered_attrset, NULL);
bufferlist outbl;
- int r = obj_operate(obj, &op);
+ int r = obj_operate(bucket_info, obj, &op);
if (r < 0) {
return r;
}
}
-int RGWRados::remove_olh_pending_entries(RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs)
+int RGWRados::remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs)
{
ObjectWriteOperation op;
}
rgw_rados_ref ref;
- int r = get_obj_ref(olh_obj, &ref);
+ int r = get_obj_head_ref(bucket_info, olh_obj, &ref);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::follow_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target)
+int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target)
{
map<string, bufferlist> pending_entries;
filter_attrset(state->attrset, RGW_ATTR_OLH_PENDING_PREFIX, &pending_entries);
check_pending_olh_entries(pending_entries, &rm_pending_entries);
if (!rm_pending_entries.empty()) {
- int ret = remove_olh_pending_entries(*state, olh_obj, rm_pending_entries);
+ int ret = remove_olh_pending_entries(bucket_info, *state, olh_obj, rm_pending_entries);
if (ret < 0) {
ldout(cct, 20) << "ERROR: rm_pending_entries returned ret=" << ret << dendl;
return ret;
if (!pending_entries.empty()) {
ldout(cct, 20) << __func__ << "(): found pending entries, need to update_olh() on bucket=" << olh_obj.bucket << dendl;
- /* we could save a few cpu cycles if we drilled through all the layers and passed the bucket
- * info in, but this is supposed to be a rare call and it doesn't seem compelling enough
- * for cluttering everything
- */
- RGWBucketInfo bucket_info;
- int ret = get_bucket_instance_info(obj_ctx, olh_obj.bucket, bucket_info, NULL, NULL);
- if (ret < 0) {
- ldout(cct, 0) << "ERROR: get_bucket_instance_info() returned " << ret << " olh_obj.bucket=" << olh_obj.bucket << dendl;
- }
- ret = update_olh(obj_ctx, state, bucket_info, olh_obj);
+ int ret = update_olh(obj_ctx, state, bucket_info, olh_obj);
if (ret < 0) {
return ret;
}
cct->_conf->rgw_bucket_index_max_aio)();
}
-int RGWRados::bi_get_instance(rgw_obj& obj, rgw_bucket_dir_entry *dirent)
+int RGWRados::bi_get_instance(const RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_bucket_dir_entry *dirent)
{
rgw_rados_ref ref;
- int r = get_obj_ref(obj, &ref);
+ int r = get_obj_head_ref(bucket_info, obj, &ref);
if (r < 0) {
return r;
}
* and if the tags are old we need to do cleanup as well. */
librados::IoCtx sub_ctx;
sub_ctx.dup(index_ctx);
- r = check_disk_state(sub_ctx, bucket_info.bucket, dirent, dirent, updates[vnames[pos]]);
+ r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[vnames[pos]]);
if (r < 0 && r != -ENOENT) {
return r;
}
}
int RGWRados::check_disk_state(librados::IoCtx io_ctx,
- rgw_bucket& bucket,
+ const RGWBucketInfo& bucket_info,
rgw_bucket_dir_entry& list_state,
rgw_bucket_dir_entry& object,
bufferlist& suggested_updates)
{
+ const rgw_bucket& bucket = bucket_info.bucket;
uint8_t suggest_flag = (get_zone().log_data ? CEPH_RGW_DIR_SUGGEST_LOG_OP : 0);
std::string loc;
RGWObjState *astate = NULL;
RGWObjectCtx rctx(this);
- int r = get_obj_state(&rctx, obj, &astate, false);
+ int r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
if (r < 0)
return r;
list<librados::AioCompletion *>& handles, bool keep_index_consistent)
{
rgw_rados_ref ref;
- int ret = get_obj_ref(obj, &ref);
+ int ret = get_obj_head_ref(bucket_info, obj, &ref);
if (ret < 0) {
lderr(cct) << "ERROR: failed to get obj ref with ret=" << ret << dendl;
return ret;
return true;
}
-bool rgw_obj_to_raw(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params,
- const rgw_obj& obj, rgw_raw_obj *raw_obj);
+struct rgw_bucket_placement {
+ string placement_rule;
+ rgw_bucket bucket;
+
+ void dump(Formatter *f) const;
+};
class rgw_obj_select {
+ string placement_rule;
rgw_obj obj;
rgw_raw_obj raw_obj;
bool is_raw;
is_raw = true;
return *this;
}
+
+ void set_placement_rule(const string& rule) {
+ placement_rule = rule;
+ }
};
struct compression_block {
};
WRITE_CLASS_ENCODER(RGWObjManifestRule)
-
class RGWObjManifest {
protected:
bool explicit_objs; /* old manifest? */
rgw_obj obj;
uint64_t head_size;
+ string head_placement_rule;
uint64_t max_head_size;
string prefix;
- rgw_bucket tail_bucket; /* might be different than the original bucket,
- as object might have been copied across pools */
+ rgw_bucket_placement tail_placement; /* might be different than the original bucket,
+ as object might have been copied across pools */
map<uint64_t, RGWObjManifestRule> rules;
string tail_instance; /* tail object's instance */
head_size = rhs.head_size;
max_head_size = rhs.max_head_size;
prefix = rhs.prefix;
- tail_bucket = rhs.tail_bucket;
+ tail_placement = rhs.tail_placement;
rules = rhs.rules;
tail_instance = rhs.tail_instance;
}
void encode(bufferlist& bl) const {
- ENCODE_START(6, 6, bl);
+ ENCODE_START(7, 6, bl);
::encode(obj_size, bl);
::encode(objs, bl);
::encode(explicit_objs, bl);
::encode(max_head_size, bl);
::encode(prefix, bl);
::encode(rules, bl);
- bool encode_tail_bucket = !(tail_bucket == obj.bucket);
+ bool encode_tail_bucket = !(tail_placement.bucket == obj.bucket);
::encode(encode_tail_bucket, bl);
if (encode_tail_bucket) {
- ::encode(tail_bucket, bl);
+ ::encode(tail_placement.bucket, bl);
}
bool encode_tail_instance = (tail_instance != obj.key.instance);
::encode(encode_tail_instance, bl);
if (encode_tail_instance) {
::encode(tail_instance, bl);
}
+ ::encode(head_placement_rule, bl);
+ ::encode(tail_placement.placement_rule, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
- DECODE_START_LEGACY_COMPAT_LEN_32(6, 2, 2, bl);
+ DECODE_START_LEGACY_COMPAT_LEN_32(7, 2, 2, bl);
::decode(obj_size, bl);
::decode(objs, bl);
if (struct_v >= 3) {
if (struct_v >= 4) {
if (struct_v < 6) {
- ::decode(tail_bucket, bl);
+ ::decode(tail_placement.bucket, bl);
} else {
bool need_to_decode;
::decode(need_to_decode, bl);
if (need_to_decode) {
- ::decode(tail_bucket, bl);
+ ::decode(tail_placement.bucket, bl);
} else {
- tail_bucket = obj.bucket;
+ tail_placement.bucket = obj.bucket;
}
}
}
tail_instance = obj.key.instance;
}
+ if (struct_v >= 7) {
+ ::decode(head_placement_rule, bl);
+ ::decode(tail_placement.placement_rule, bl);
+ }
+
update_iterators();
DECODE_FINISH(bl);
}
return (obj_size > head_size);
}
- void set_head(const rgw_obj& _o, uint64_t _s) {
+ void set_head(const string& placement_rule, const rgw_obj& _o, uint64_t _s) {
+ head_placement_rule = placement_rule;
obj = _o;
head_size = _s;
return obj;
}
- void set_tail_bucket(const rgw_bucket& _b) {
- tail_bucket = _b;
+ void set_tail_placement(const string& placement_rule, const rgw_bucket& _b) {
+ tail_placement.placement_rule = placement_rule;
+ tail_placement.bucket = _b;
}
- rgw_bucket& get_tail_bucket() {
- return tail_bucket;
+ const rgw_bucket_placement& get_tail_placement() {
+ return tail_placement;
+ }
+
+ const string& get_head_placement_rule() {
+ return head_placement_rule;
}
void set_prefix(const string& _p) {
public:
generator() : manifest(NULL), last_ofs(0), cur_part_ofs(0), cur_part_id(0),
cur_stripe(0), cur_stripe_size(0) {}
- int create_begin(CephContext *cct, RGWObjManifest *manifest, rgw_bucket& bucket, rgw_obj& obj);
+ int create_begin(CephContext *cct, RGWObjManifest *manifest, const string& placement_rule, rgw_bucket& bucket, rgw_obj& obj);
int create_next(uint64_t ofs);
return true;
}
- bool get_index_pool(const rgw_obj& obj, rgw_pool *pool) {
- if (!obj.bucket.explicit_placement.index_pool.empty()) {
- *pool = obj.bucket.explicit_placement.index_pool;
- return true;
- }
- if (obj.placement_id.empty()) {
- return false;
- }
- auto iter = placement_pools.find(obj.placement_id);
- if (iter == placement_pools.end()) {
- return false;
- }
- pool->init(iter->second.index_pool);
- return true;
- }
-
- bool get_data_pool(const rgw_obj& obj, rgw_pool *pool) const {
+ /*
+ * return data pool of the head object
+ */
+ bool get_head_data_pool(const string& placement_id, const rgw_obj& obj, rgw_pool *pool) const {
const rgw_data_placement_target& explicit_placement = obj.bucket.explicit_placement;
if (!explicit_placement.data_pool.empty()) {
if (!obj.in_extra_data) {
}
return true;
}
- if (obj.placement_id.empty()) {
+ if (placement_id.empty()) {
return false;
}
- auto iter = placement_pools.find(obj.placement_id);
+ auto iter = placement_pools.find(placement_id);
if (iter == placement_pools.end()) {
return false;
}
// This field represents the number of bucket index object shards
uint32_t bucket_index_max_shards;
- int get_obj_ioctx(const rgw_obj& obj, librados::IoCtx *ioctx);
- int get_obj_ref(const rgw_obj& obj, rgw_rados_ref *ref);
+ int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx);
+ int get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_rados_ref *ref);
int get_system_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref, rgw_pool *pool = NULL);
uint64_t max_bucket_id;
- int get_olh_target_state(RGWObjectCtx& rctx, const rgw_obj& obj, RGWObjState *olh_state,
- RGWObjState **target_state);
+ int get_olh_target_state(RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+ RGWObjState *olh_state, RGWObjState **target_state);
int get_system_obj_state_impl(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker);
- int get_obj_state_impl(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent = false);
- int append_atomic_test(RGWObjectCtx *rctx, const rgw_obj& obj,
+ int get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
+ bool follow_olh, bool assume_noent = false);
+ int append_atomic_test(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
librados::ObjectOperation& op, RGWObjState **state);
int update_placement_map();
int get_required_alignment(const rgw_pool& pool, uint64_t *alignment);
int get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size);
- int get_max_chunk_size(const rgw_obj& obj, uint64_t *max_chunk_size);
+ int get_max_chunk_size(const string& placement_rule, const rgw_obj& obj, uint64_t *max_chunk_size);
uint32_t get_max_bucket_shards() {
return MAX_BUCKET_INDEX_SHARDS_PRIME;
int select_bucket_location_by_rule(const string& location_rule, rgw_bucket& bucket, RGWZonePlacementInfo *rule_info);
void create_bucket_id(string *bucket_id);
- bool get_obj_data_pool(const rgw_obj& obj, rgw_pool *pool);
- bool obj_to_raw(const rgw_obj& obj, rgw_raw_obj *raw_obj);
+ bool get_obj_data_pool(const string& placement_rule, const rgw_obj& obj, rgw_pool *pool);
+ bool obj_to_raw(const string& placement_rule, const rgw_obj& obj, rgw_raw_obj *raw_obj);
int create_bucket(RGWUserInfo& owner, rgw_bucket& bucket,
const string& zonegroup_id,
int complete_atomic_modification();
public:
- Object(RGWRados *_store, RGWBucketInfo& _bucket_info, RGWObjectCtx& _ctx, const rgw_obj& _obj) : store(_store), bucket_info(_bucket_info),
+ Object(RGWRados *_store, const RGWBucketInfo& _bucket_info, RGWObjectCtx& _ctx, const rgw_obj& _obj) : store(_store), bucket_info(_bucket_info),
ctx(_ctx), obj(_obj), bs(store),
state(NULL), versioning_disabled(false),
bs_initialized(false) {}
int shard_id;
public:
- Bucket(RGWRados *_store, RGWBucketInfo& _bucket_info) : store(_store), bucket_info(_bucket_info), bucket(bucket_info.bucket),
+ Bucket(RGWRados *_store, const RGWBucketInfo& _bucket_info) : store(_store), bucket_info(_bucket_info), bucket(bucket_info.bucket),
shard_id(RGW_NO_SHARD) {}
RGWRados *get_store() { return store; }
rgw_bucket& get_bucket() { return bucket; }
/** Delete an object.*/
int delete_obj(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& bucket_owner,
+ const RGWBucketInfo& bucket_owner,
const rgw_obj& src_obj,
int versioning_status,
uint16_t bilog_flags = 0,
* bl: the contents of the attr
* Returns: 0 on success, -ERR# otherwise.
*/
- int set_attr(void *ctx, rgw_obj& obj, const char *name, bufferlist& bl);
+ int set_attr(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl);
- int set_attrs(void *ctx, rgw_obj& obj,
+ int set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj,
map<string, bufferlist>& attrs,
map<string, bufferlist>* rmattrs);
int get_system_obj_state(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker);
- int get_obj_state(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent = false);
- int get_obj_state(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state) {
- return get_obj_state(rctx, obj, state, true);
+ int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
+ bool follow_olh, 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);
}
virtual int stat_system_obj(RGWObjectCtx& obj_ctx,
virtual void register_chained_cache(RGWChainedCache *cache) {}
virtual bool chain_cache_entry(list<rgw_cache_entry_info *>& cache_info_entries, RGWChainedCache::Entry *chained_entry) { return false; }
- int iterate_obj(RGWObjectCtx& ctx, rgw_obj& obj,
+ int iterate_obj(RGWObjectCtx& ctx,
+ const RGWBucketInfo& bucket_info, const rgw_obj& obj,
off_t ofs, off_t end,
uint64_t max_chunk_size,
- int (*iterate_obj_cb)(const rgw_obj& obj, const rgw_raw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
+ int (*iterate_obj_cb)(const RGWBucketInfo& bucket_info, const rgw_obj& obj, const rgw_raw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
void *arg);
int flush_read_list(struct get_obj_data *d);
int get_obj_iterate_cb(RGWObjectCtx *ctx, RGWObjState *astate,
- const rgw_obj& obj,
+ const RGWBucketInfo& bucket_info, const rgw_obj& obj,
const rgw_raw_obj& read_obj,
off_t obj_ofs, off_t read_ofs, off_t len,
bool is_head_obj, void *arg);
map<string, bufferlist> *attrs, bufferlist *first_chunk,
RGWObjVersionTracker *objv_tracker);
- int obj_operate(const rgw_obj& obj, librados::ObjectWriteOperation *op);
- int obj_operate(const rgw_obj& obj, librados::ObjectReadOperation *op);
+ int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectWriteOperation *op);
+ int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectReadOperation *op);
void bucket_index_guard_olh_op(RGWObjState& olh_state, librados::ObjectOperation& op);
- int olh_init_modification(RGWObjState& state, const rgw_obj& olh_obj, string *op_tag);
- int olh_init_modification_impl(RGWObjState& state, const rgw_obj& olh_obj, string *op_tag);
- int bucket_index_link_olh(RGWObjState& olh_state, const rgw_obj& obj_instance, bool delete_marker,
+ int olh_init_modification(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, string *op_tag);
+ int olh_init_modification_impl(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, string *op_tag);
+ int bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjState& olh_state,
+ const rgw_obj& obj_instance, bool delete_marker,
const string& op_tag, struct rgw_bucket_dir_entry_meta *meta,
uint64_t olh_epoch,
ceph::real_time unmod_since, bool high_precision_time);
- int bucket_index_unlink_instance(const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch);
- int bucket_index_read_olh_log(RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker,
+ int bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch);
+ int bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker,
map<uint64_t, vector<rgw_bucket_olh_log_entry> > *log, bool *is_truncated);
- int bucket_index_trim_olh_log(RGWObjState& obj_state, const rgw_obj& obj_instance, uint64_t ver);
- int bucket_index_clear_olh(RGWObjState& state, const rgw_obj& obj_instance);
- int apply_olh_log(RGWObjectCtx& ctx, RGWObjState& obj_state, RGWBucketInfo& bucket_info, const rgw_obj& obj,
+ int bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& obj_state, const rgw_obj& obj_instance, uint64_t ver);
+ int bucket_index_clear_olh(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance);
+ int apply_olh_log(RGWObjectCtx& ctx, RGWObjState& obj_state, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
bufferlist& obj_tag, map<uint64_t, vector<rgw_bucket_olh_log_entry> >& log,
uint64_t *plast_ver);
- int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, const rgw_obj& obj);
+ int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj);
int set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta,
uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time);
int unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
uint64_t olh_epoch);
void check_pending_olh_entries(map<string, bufferlist>& pending_entries, map<string, bufferlist> *rm_pending_entries);
- int remove_olh_pending_entries(RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs);
- int follow_olh(RGWObjectCtx& ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target);
- int get_olh(const rgw_obj& obj, RGWOLHInfo *olh);
+ int remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs);
+ int follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target);
+ int get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWOLHInfo *olh);
void gen_rand_obj_instance_name(rgw_obj *target);
int trim_bi_log_entries(RGWBucketInfo& bucket_info, int shard_id, string& marker, string& end_marker);
int get_bi_log_status(RGWBucketInfo& bucket_info, int shard_id, map<int, string>& max_marker);
- int bi_get_instance(rgw_obj& obj, rgw_bucket_dir_entry *dirent);
+ int bi_get_instance(const RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_bucket_dir_entry *dirent);
int bi_get(rgw_bucket& bucket, rgw_obj& obj, BIIndexType index_type, rgw_cls_bi_entry *entry);
void bi_put(librados::ObjectWriteOperation& op, BucketShard& bs, rgw_cls_bi_entry& entry);
int bi_put(BucketShard& bs, rgw_cls_bi_entry& entry);
int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
int process_gc();
int process_expire_objects();
- int defer_gc(void *ctx, rgw_obj& obj);
+ int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj);
int process_lc();
int list_lc_progress(const string& marker, uint32_t max_entries, map<string, int> *progress_map);
const string& src_oid, const string& src_locator,
librados::IoCtx& dst_ioctx,
const string& dst_oid, const string& dst_locator);
- int fix_head_obj_locator(rgw_bucket& bucket, bool copy_obj, bool remove_bad, rgw_obj_key& key);
- int fix_tail_obj_locator(rgw_bucket& bucket, rgw_obj_key& key, bool fix, bool *need_fix);
+ int fix_head_obj_locator(const RGWBucketInfo& bucket_info, bool copy_obj, bool remove_bad, rgw_obj_key& key);
+ int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix);
int cls_user_get_header(const string& user_id, cls_user_header *header);
int cls_user_get_header_async(const string& user_id, RGWGetUserHeader_CB *ctx);
* will encode that info as a suggested update.)
*/
int check_disk_state(librados::IoCtx io_ctx,
- rgw_bucket& bucket,
+ const RGWBucketInfo& bucket_info,
rgw_bucket_dir_entry& list_state,
rgw_bucket_dir_entry& object,
bufferlist& suggested_updates);