]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use rgw_raw_obj in manifest code
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 13 Oct 2016 03:22:01 +0000 (20:22 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 9 Mar 2017 17:18:51 +0000 (09:18 -0800)
This drags in multiple related changes that are needed in order to
support that.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
12 files changed:
src/cls/rgw/cls_rgw_types.h
src/rgw/rgw_bucket.cc
src/rgw/rgw_common.h
src/rgw/rgw_compression.cc
src/rgw/rgw_compression.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_dencoder.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_orphan.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 2ebd7c98ddaad23ffceacc473601912ab4b368bf..248a642b5a046a180b77c766af95782f5175dbe0 100644 (file)
@@ -872,7 +872,7 @@ struct cls_rgw_obj_chain {
 
   cls_rgw_obj_chain() {}
 
-  void push_obj(const string& pool, cls_rgw_obj_key& key, string& loc) {
+  void push_obj(const string& pool, const cls_rgw_obj_key& key, const string& loc) {
     cls_rgw_obj obj;
     obj.pool = pool;
     obj.key = key;
index 88478207ec9061617cc90c11a3d9f0445444f44a..d07512e375940a9d4740a48e8ff99af18a15b1dd 100644 (file)
@@ -660,13 +660,12 @@ int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
       }
 
       if (astate->has_manifest) {
-        rgw_obj head_obj;
         RGWObjManifest& manifest = astate->manifest;
         RGWObjManifest::obj_iterator miter = manifest.obj_begin();
+        rgw_obj head_obj = manifest.get_obj();
+        rgw_raw_obj raw_head_obj;
+        RGWRados::obj_to_raw(head_obj, &raw_head_obj);
 
-        if (miter.get_location().ns.empty()) {
-          head_obj = miter.get_location();
-        }
 
         for (; miter != manifest.obj_end() && max_aio--; ++miter) {
           if (!max_aio) {
@@ -678,13 +677,13 @@ int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
             max_aio = concurrent_max;
           }
 
-          rgw_obj last_obj = miter.get_location();
-          if (last_obj == head_obj) {
+          rgw_raw_obj last_obj = miter.get_location();
+          if (last_obj == raw_head_obj) {
             // have the head obj deleted at the end
             continue;
           }
 
-          ret = store->delete_obj_aio(last_obj, bucket, info, astate, handles, keep_index_consistent);
+          ret = store->delete_raw_obj_aio(last_obj, handles);
           if (ret < 0) {
             lderr(store->ctx()) << "ERROR: delete obj aio failed with " << ret << dendl;
             return ret;
index 53b01dc61979fbb97583e9e1fa5284984752c019..a7dc3b32988ad8736f5da9c618be201e4ccc8444 100644 (file)
@@ -850,7 +850,7 @@ struct rgw_raw_obj {
     oid = _oid;
   }
 
-  bool empty() {
+  bool empty() const {
     return oid.empty();
   }
 
@@ -893,6 +893,10 @@ struct rgw_raw_obj {
     return (r < 0);
   }
 
+  bool operator==(const rgw_raw_obj& o) const {
+    return (pool == o.pool && oid == o.oid && loc == o.loc);
+  }
+
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj);
 };
@@ -1702,7 +1706,7 @@ public:
     }
   }
 
-  bool empty() {
+  bool empty() const {
     return object.empty();
   }
 
@@ -1710,7 +1714,7 @@ public:
     return instance == "null";
   }
 
-  bool have_instance() {
+  bool have_instance() const {
     return !instance.empty();
   }
 
@@ -1798,7 +1802,7 @@ public:
     }
   }
 
-  string& get_hash_object() {
+  const string& get_hash_object() const {
     return index_hash_source.empty() ? orig_obj : index_hash_source;
   }
   /**
@@ -1898,6 +1902,14 @@ public:
     return in_extra_data;
   }
 
+  const rgw_pool& get_data_pool() const {
+    if (!in_extra_data) {
+      return bucket.placement.data_pool;
+    } else {
+      return bucket.placement.data_extra_pool;
+    }
+  }
+
   void encode(bufferlist& bl) const {
     ENCODE_START(5, 3, bl);
     ::encode(bucket.name, bl);
index 29bbed015fa50431bfa192e4d8da40822c3f1b6f..704bb6b56b7e53d38dda95c62ae595a8390b580c 100644 (file)
@@ -8,7 +8,7 @@
 
 //------------RGWPutObj_Compress---------------
 
-int RGWPutObj_Compress::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again)
+int RGWPutObj_Compress::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again)
 {
   bufferlist in_bl;
   if (*again) {
index a649afdfe111f421fd0e1b4e165100c272c99734..214e596fd6a45898781d406a64e97c25fca4bb89 100644 (file)
@@ -43,7 +43,7 @@ public:
                      RGWPutObjDataProcessor* next)
     : RGWPutObj_Filter(next), cct(cct_), compressor(compressor) {}
   virtual ~RGWPutObj_Compress(){}
-  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again) override;
+  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) override;
 
   bool is_compressed() { return compressed; }
   vector<compression_block>& get_compression_blocks() { return blocks; }
index 1e9c29654252e286999ef9be989b3cef121dec86..b3014068a0a9b1578c013ac153ed5a92edd529a3 100644 (file)
@@ -1672,7 +1672,7 @@ int RGWDataSyncStatusManager::init()
 
   error_logger = new RGWSyncErrorLogger(store, RGW_SYNC_ERROR_LOG_SHARD_PREFIX, ERROR_LOGGER_SHARDS);
 
-  int r = source_log.init(source_zone, conn, error_logger);
+  int r = source_log.init(source_zone, conn, error_logger, sync_module);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to init remote log, r=" << r << dendl;
     finalize();
@@ -2670,8 +2670,8 @@ int RGWRunBucketSyncCoroutine::operate()
       set_status("acquiring sync lock");
       auto store = sync_env->store;
       lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, store,
-                                          store->get_zone_params().log_pool,
-                                          status_oid, "sync_lock",
+                                          rgw_raw_obj(store->get_zone_params().log_pool, status_oid),
+                                          "sync_lock",
                                           cct->_conf->rgw_sync_lease_period,
                                           this);
       lease_stack = spawn(lease_cr.get(), false);
index 766960476828b1ff0ed4fd27b332d584c1b52060..d12340719dbf845d37b1433a953b739d79f92556 100644 (file)
@@ -112,11 +112,11 @@ void RGWObjManifest::obj_iterator::seek(uint64_t o)
 void RGWObjManifest::obj_iterator::update_location()
 {
   if (manifest->explicit_objs) {
-    location = explicit_iter->second.loc;
+    RGWRados::obj_to_raw(explicit_iter->second.loc, &location);
     return;
   }
 
-  const rgw_obj& head = manifest->get_head();
+  const rgw_raw_obj& head = manifest->get_head();
 
   if (ofs < manifest->get_head_size()) {
     location = head;
@@ -159,7 +159,7 @@ void RGWObjManifest::generate_test_instances(std::list<RGWObjManifest*>& o)
   o.push_back(new RGWObjManifest);
 }
 
-void RGWObjManifest::get_implicit_location(uint64_t cur_part_id, uint64_t cur_stripe, uint64_t ofs, string *override_prefix, rgw_obj *location)
+void RGWObjManifest::get_implicit_location(uint64_t cur_part_id, uint64_t cur_stripe, uint64_t ofs, string *override_prefix, rgw_raw_obj *location)
 {
   string oid;
   if (!override_prefix || override_prefix->empty()) {
@@ -194,17 +194,21 @@ void RGWObjManifest::get_implicit_location(uint64_t cur_part_id, uint64_t cur_st
 
   rgw_bucket *bucket;
 
+  rgw_obj loc;
+
   if (!tail_bucket.name.empty()) {
     bucket = &tail_bucket;
   } else {
-    bucket = &head_obj.bucket;
+    bucket = &obj.bucket;
   }
 
-  location->init_ns(*bucket, oid, ns);
+  loc.init_ns(*bucket, oid, ns);
   
   // Always overwrite instance with tail_instance
   // to get the right shadow object location
-  location->set_instance(tail_instance);
+  loc.set_instance(tail_instance);
+
+  RGWRados::obj_to_raw(loc, location);
 }
 
 
index f14076673d62f7a742e124211e0fa8e6a17c19ed..3bc586cdf6567039a4f8b16058d8dca5da33914d 100644 (file)
@@ -2576,7 +2576,7 @@ int RGWPutObj::verify_permission()
     store->set_prefetch_data(s->obj_ctx, obj);
 
     /* check source object permissions */
-    if (read_policy(store, s, copy_source_bucket_info, cs_attrs, &cs_policy, cs_bucket, cs_object) < 0) {
+    if (read_obj_policy(store, s, copy_source_bucket_info, cs_attrs, &cs_policy, cs_bucket, cs_object) < 0) {
       return -EACCES;
     }
 
@@ -2664,9 +2664,9 @@ int RGWPutObjProcessor_Multipart::prepare(RGWRados *store, string *oid_rand)
     return r;
   }
 
-  head_obj = manifest_gen.get_cur_obj();
+  cur_obj = manifest_gen.get_cur_obj();
+  rgw_raw_obj_to_obj(bucket, cur_obj, &head_obj);
   head_obj.index_hash_source = obj_str;
-  cur_obj = head_obj;
 
   return 0;
 }
@@ -5078,9 +5078,12 @@ void RGWAbortMultipart::execute()
         store->update_gc_chain(meta_obj, obj_part.manifest, &chain);
         RGWObjManifest::obj_iterator oiter = obj_part.manifest.obj_begin();
         if (oiter != obj_part.manifest.obj_end()) {
-          obj = oiter.get_location();
+          rgw_obj head;
+          rgw_raw_obj raw_head = oiter.get_location();
+          rgw_raw_obj_to_obj(s->bucket, raw_head, &head);
+
           rgw_obj_key key;
-          obj.get_index_key(&key);
+          head.get_index_key(&key);
           remove_objs.push_back(key);
         }
       }
index 2e53c8fc6f642e038a48dd9cdffaec5933ac8b47..30be7c48c647091f8c5c77a527385f173aab0853 100644 (file)
@@ -776,10 +776,10 @@ public:
   RGWPutObj_Filter(RGWPutObjDataProcessor* next) :
   next(next){}
   virtual ~RGWPutObj_Filter() {}
-  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again) override {
+  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) override {
     return next->handle_data(bl, ofs, phandle, pobj, again);
   }
-  virtual int throttle_data(void *handle, const rgw_obj& obj, uint64_t size, bool need_to_wait) override {
+  virtual int throttle_data(void *handle, const rgw_raw_obj& obj, uint64_t size, bool need_to_wait) override {
     return next->throttle_data(handle, obj, size, need_to_wait);
   }
 }; /* RGWPutObj_Filter */
@@ -1604,7 +1604,7 @@ static inline int put_data_and_throttle(RGWPutObjDataProcessor *processor,
   bool again = false;
   do {
     void *handle;
-    rgw_obj obj;
+    rgw_raw_obj obj;
 
     uint64_t size = data.length();
 
index c8c95cf9c2e4b48d06a70a785815fc1cae0a540a..aef6252919183136cf5450bc96454e736c9694ef 100644 (file)
@@ -437,8 +437,8 @@ int RGWOrphanSearch::handle_stat_result(map<int, list<string> >& oids, RGWRados:
 
     RGWObjManifest::obj_iterator miter;
     for (miter = manifest.obj_begin(); miter != manifest.obj_end(); ++miter) {
-      const rgw_obj& loc = miter.get_location();
-      string s = bucket.bucket_id + "_" + loc.get_object();
+      const rgw_raw_obj& loc = miter.get_location();
+      string s = loc.oid;
       obj_oids.insert(obj_fingerprint(s));
     }
   }
index 1bcd4f00ed5317209798619036b6ad315c9b3af4..8e152f259b3cbf1a710f3581395d774c000d4be2 100644 (file)
@@ -1939,13 +1939,12 @@ void RGWObjManifest::obj_iterator::operator++()
   update_location();
 }
 
-int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m, rgw_bucket& _b, rgw_obj& _h)
+int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m, rgw_bucket& _b, rgw_obj& _obj)
 {
   manifest = _m;
 
-  bucket = _b;
   manifest->set_tail_bucket(_b);
-  manifest->set_head(_h, 0);
+  manifest->set_head(_obj, 0);
   last_ofs = 0;
 
   if (manifest->get_prefix().empty()) {
@@ -1978,7 +1977,7 @@ int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m
   manifest->get_implicit_location(cur_part_id, cur_stripe, 0, NULL, &cur_obj);
 
   // Normal object which not generated through copy operation 
-  manifest->set_tail_instance(_h.get_instance());
+  manifest->set_tail_instance(_obj.get_instance());
 
   manifest->update_iterators();
 
@@ -2134,10 +2133,16 @@ void RGWObjManifest::convert_to_explicit()
 
   while (iter != obj_end()) {
     RGWObjManifestPart& part = objs[iter.get_stripe_ofs()];
-    part.loc = iter.get_location();
+    const rgw_raw_obj& raw_loc = iter.get_location();
     part.loc_ofs = 0;
 
     uint64_t ofs = iter.get_stripe_ofs();
+
+    if (ofs == 0) {
+      part.loc = obj;
+    } else {
+      rgw_raw_obj_to_obj(tail_bucket, raw_loc, &part.loc);
+    }
     ++iter;
     uint64_t next_ofs = iter.get_stripe_ofs();
 
@@ -2218,9 +2223,13 @@ RGWPutObjProcessor_Aio::~RGWPutObjProcessor_Aio()
   if (is_complete)
     return;
 
-  set<rgw_obj>::iterator iter;
-  bool is_multipart_obj = false;
-  rgw_obj multipart_obj;
+  set<rgw_raw_obj>::iterator iter;
+  bool need_to_remove_head = false;
+  rgw_raw_obj raw_head;
+
+  if (!head_obj.empty()) {
+    RGWRados::obj_to_raw(head_obj, &raw_head);
+  }
 
   /** 
    * We should delete the object in the "multipart" namespace to avoid race condition. 
@@ -2228,32 +2237,36 @@ RGWPutObjProcessor_Aio::~RGWPutObjProcessor_Aio()
    * upload, when it is deleted, a second upload would start with the same suffix("2/"), therefore, objects
    * written by the second upload may be deleted by the first upload.
    * details is describled on #11749
+   *
+   * The above comment still stands, but instead of searching for a specific object in the multipart
+   * namespace, we just make sure that we remove the object that is marked as the head object after
+   * we remove all the other raw objects. Note that we use different call to remove the head object,
+   * as this one needs to go via the bucket index prepare/complete 2-phase commit scheme.
    */ 
   for (iter = written_objs.begin(); iter != written_objs.end(); ++iter) {
-    const rgw_obj &obj = *iter;
-    if (RGW_OBJ_NS_MULTIPART == obj.ns) {
-      ldout(store->ctx(), 5) << "NOTE: we should not process the multipart object (" << obj << ") here" << dendl;
-      multipart_obj = *iter;
-      is_multipart_obj = true;
+    const rgw_raw_obj& obj = *iter;
+    if (!head_obj.empty() && obj == raw_head) {
+      ldout(store->ctx(), 5) << "NOTE: we should not process the head object (" << obj << ") here" << dendl;
+      need_to_remove_head = true;
       continue;
     }
 
-    int r = store->delete_obj(obj_ctx, bucket_info, obj, 0, 0);
+    int r = store->delete_raw_obj(obj);
     if (r < 0 && r != -ENOENT) {
       ldout(store->ctx(), 5) << "WARNING: failed to remove obj (" << obj << "), leaked" << dendl;
     }
   }
 
-  if (true == is_multipart_obj) {
-    ldout(store->ctx(), 5) << "NOTE: we are going to process the multipart obj (" << multipart_obj << dendl;
-    int r = store->delete_obj(obj_ctx, bucket_info, multipart_obj, 0, 0);
+  if (need_to_remove_head) {
+    ldout(store->ctx(), 5) << "NOTE: we are going to process the head obj (" << raw_head << ")" << dendl;
+    int r = store->delete_obj(obj_ctx, bucket_info, head_obj, 0, 0);
     if (r < 0 && r != -ENOENT) {
-      ldout(store->ctx(), 0) << "WARNING: failed to remove obj (" << multipart_obj << "), leaked" << dendl;
+      ldout(store->ctx(), 0) << "WARNING: failed to remove obj (" << raw_head << "), leaked" << dendl;
     }
   }
 }
 
-int RGWPutObjProcessor_Aio::handle_obj_data(rgw_obj& obj, bufferlist& bl, off_t ofs, off_t abs_ofs, void **phandle, bool exclusive)
+int RGWPutObjProcessor_Aio::handle_obj_data(rgw_raw_obj& obj, bufferlist& bl, off_t ofs, off_t abs_ofs, void **phandle, bool exclusive)
 {
   if ((uint64_t)abs_ofs + bl.length() > obj_len)
     obj_len = abs_ofs + bl.length();
@@ -2311,7 +2324,7 @@ int RGWPutObjProcessor_Aio::drain_pending()
   return ret;
 }
 
-int RGWPutObjProcessor_Aio::throttle_data(void *handle, const rgw_obj& obj, uint64_t size, bool need_to_wait)
+int RGWPutObjProcessor_Aio::throttle_data(void *handle, const rgw_raw_obj& obj, uint64_t size, bool need_to_wait)
 {
   bool _wait = need_to_wait;
 
@@ -2352,7 +2365,7 @@ int RGWPutObjProcessor_Aio::throttle_data(void *handle, const rgw_obj& obj, uint
   return 0;
 }
 
-int RGWPutObjProcessor_Atomic::write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool exclusive)
+int RGWPutObjProcessor_Atomic::write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool exclusive)
 {
   if (ofs >= next_part_ofs) {
     int r = prepare_next_part(ofs);
@@ -2375,7 +2388,7 @@ int RGWPutObjProcessor_Aio::prepare(RGWRados *store, string *oid_rand)
   return 0;
 }
 
-int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again)
+int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again)
 {
   *phandle = NULL;
   uint64_t max_write_size = MIN(max_chunk_size, (uint64_t)next_part_ofs - data_ofs);
@@ -2442,7 +2455,7 @@ int RGWPutObjProcessor_Atomic::prepare(RGWRados *store, string *oid_rand)
 
   manifest.set_trivial_rule(max_chunk_size, store->ctx()->_conf->rgw_obj_stripe_size);
 
-  r = manifest_gen.create_begin(store->ctx(), &manifest, bucket, head_obj);
+  r = manifest_gen.create_begin(store->ctx(), &manifest, head_obj.bucket, head_obj);
   if (r < 0) {
     return r;
   }
@@ -2486,7 +2499,7 @@ int RGWPutObjProcessor_Atomic::complete_writing_data()
   }
   while (pending_data_bl.length()) {
     void *handle;
-    rgw_obj obj;
+    rgw_raw_obj obj;
     uint64_t max_write_size = MIN(max_chunk_size, (uint64_t)next_part_ofs - data_ofs);
     if (max_write_size > pending_data_bl.length()) {
       max_write_size = pending_data_bl.length();
@@ -3075,10 +3088,10 @@ RGWDataSyncStatusManager* RGWRados::get_data_sync_manager(const std::string& sou
   return thread->second->get_manager();
 }
 
-int RGWRados::get_required_alignment(rgw_bucket& bucket, uint64_t *alignment)
+int RGWRados::get_required_alignment(const rgw_pool& pool, uint64_t *alignment)
 {
   IoCtx ioctx;
-  int r = open_pool_ctx(bucket.placement.data_pool, ioctx);
+  int r = open_pool_ctx(pool, ioctx);
   if (r < 0) {
     ldout(cct, 0) << "ERROR: open_pool_ctx() returned " << r << dendl;
     return r;
@@ -3111,10 +3124,15 @@ int RGWRados::get_required_alignment(rgw_bucket& bucket, uint64_t *alignment)
   return 0;
 }
 
-int RGWRados::get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size)
+int RGWRados::get_required_alignment(const rgw_bucket& bucket, uint64_t *alignment)
+{
+  return get_required_alignment(bucket.placement.data_pool, alignment);
+}
+
+int RGWRados::get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size)
 {
   uint64_t alignment;
-  int r = get_required_alignment(bucket, &alignment);
+  int r = get_required_alignment(pool, &alignment);
   if (r < 0) {
     return r;
   }
@@ -3138,6 +3156,11 @@ int RGWRados::get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size)
   return 0;
 }
 
+int RGWRados::get_max_chunk_size(const rgw_bucket& bucket, uint64_t *max_chunk_size)
+{
+  return get_max_chunk_size(bucket.placement.data_pool, max_chunk_size);
+}
+
 void RGWRados::finalize()
 {
   if (run_sync_thread) {
@@ -3369,7 +3392,7 @@ int RGWRados::replace_region_with_zonegroup()
 
   RGWZoneGroup default_zonegroup;
   string pool_name = default_zonegroup.get_pool_name(cct);
-  rgw_bucket pool(pool_name.c_str());
+  rgw_pool pool(pool_name);
   string oid  = "converted";
   bufferlist bl;
   RGWObjectCtx obj_ctx(this);
@@ -5648,7 +5671,6 @@ int RGWRados::create_pools(vector<string>& names, vector<int>& retcodes)
   return 0;
 }
 
-
 int RGWRados::get_obj_ioctx(const rgw_obj& obj, librados::IoCtx *ioctx)
 {
   const rgw_bucket& bucket = obj.bucket;
@@ -5716,14 +5738,9 @@ int RGWRados::get_raw_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref, rgw_po
 
 void RGWRados::obj_to_raw(const rgw_obj& obj, rgw_raw_obj *raw_obj)
 {
-  get_obj_bucket_and_oid_loc(obj, raw_obj->oid, raw_obj->loc);
-
-  if (!obj.is_in_extra_data()) {
-    raw_obj->pool = obj.bucket.placement.data_pool;
-  } else {
-    raw_obj->pool = obj.bucket.placement.get_data_extra_pool();
-  }
+  rgw_obj_to_raw(obj, raw_obj);
 }
+
 int RGWRados::get_system_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref, rgw_pool *pool)
 {
   return get_raw_obj_ref(obj, ref, pool);
@@ -5908,10 +5925,13 @@ int RGWRados::fix_tail_obj_locator(rgw_bucket& bucket, rgw_obj_key& key, bool fi
     RGWObjManifest::obj_iterator miter;
     RGWObjManifest& manifest = astate->manifest;
     for (miter = manifest.obj_begin(); miter != manifest.obj_end(); ++miter) {
-      rgw_obj loc = miter.get_location();
+      rgw_raw_obj raw_loc = miter.get_location();
+      rgw_obj loc;
       string oid;
       string locator;
 
+      rgw_raw_obj_to_obj(manifest.get_tail_bucket(), raw_loc, &loc);
+
       if (loc.ns.empty()) {
        /* continue, we're only interested in tail objects */
        continue;
@@ -5956,7 +5976,7 @@ int RGWRados::fix_tail_obj_locator(rgw_bucket& bucket, rgw_obj_key& key, bool fi
   return 0;
 }
 
-int RGWRados::BucketShard::init(rgw_bucket& _bucket, rgw_obj& obj)
+int RGWRados::BucketShard::init(const rgw_bucket& _bucket, const rgw_obj& obj)
 {
   bucket = _bucket;
 
@@ -5970,7 +5990,7 @@ int RGWRados::BucketShard::init(rgw_bucket& _bucket, rgw_obj& obj)
   return 0;
 }
 
-int RGWRados::BucketShard::init(rgw_bucket& _bucket, int sid)
+int RGWRados::BucketShard::init(const rgw_bucket& _bucket, int sid)
 {
   bucket = _bucket;
   shard_id = sid;
@@ -6595,24 +6615,13 @@ int RGWRados::put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
  * attrs: all the given attrs are written to bucket storage for the given object
  * Returns: 0 on success, -ERR# otherwise.
  */
-int RGWRados::put_obj_data(void *ctx, rgw_obj& obj,
-                          const char *data, off_t ofs, size_t len, bool exclusive)
-{
-  void *handle;
-  bufferlist bl;
-  bl.append(data, len);
-  int r = aio_put_obj_data(ctx, obj, bl, ofs, exclusive, &handle);
-  if (r < 0)
-    return r;
-  return aio_wait(handle);
-}
 
-int RGWRados::aio_put_obj_data(void *ctx, rgw_obj& obj, bufferlist& bl,
+int RGWRados::aio_put_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
                               off_t ofs, bool exclusive,
                                void **handle)
 {
   rgw_rados_ref ref;
-  int r = get_obj_ref(obj, &ref);
+  int r = get_raw_obj_ref(obj, &ref);
   if (r < 0) {
     return r;
   }
@@ -6704,7 +6713,7 @@ public:
 
     do {
       void *handle = NULL;
-      rgw_obj obj;
+      rgw_raw_obj obj;
       uint64_t size = bl.length();
       int ret = filter->handle_data(bl, ofs, &handle, &obj, &again);
       if (ret < 0)
@@ -7423,7 +7432,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
     return ret;
   }
 
-  vector<rgw_obj> ref_objs;
+  vector<rgw_raw_obj> ref_objs;
 
   if (remote_dest) {
     /* dest is in a different zonegroup, copy it there */
@@ -7475,7 +7484,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
   }
 
   rgw_rados_ref ref;
-  ret = get_obj_ref(miter.get_location(), &ref);
+  ret = get_raw_obj_ref(miter.get_location(), &ref);
   if (ret < 0) {
     return ret;
   }
@@ -7518,11 +7527,10 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
     for (; miter != astate->manifest.obj_end(); ++miter) {
       ObjectWriteOperation op;
       cls_refcount_get(op, tag, true);
-      const rgw_obj& loc = miter.get_location();
-      get_obj_bucket_and_oid_loc(loc, oid, key);
-      ref.ioctx.locator_set_key(key);
+      const rgw_raw_obj& loc = miter.get_location();
+      ref.ioctx.locator_set_key(loc.loc);
 
-      ret = ref.ioctx.operate(oid, &op);
+      ret = ref.ioctx.operate(loc.oid, &op);
       if (ret < 0) {
         goto done_ret;
       }
@@ -7567,7 +7575,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
 
 done_ret:
   if (!copy_itself) {
-    vector<rgw_obj>::iterator riter;
+    vector<rgw_raw_obj>::iterator riter;
 
     string oid, key;
 
@@ -7576,10 +7584,9 @@ done_ret:
       ObjectWriteOperation op;
       cls_refcount_put(op, tag, true);
 
-      get_obj_bucket_and_oid_loc(*riter, oid, key);
-      ref.ioctx.locator_set_key(key);
+      ref.ioctx.locator_set_key(riter->loc);
 
-      int r = ref.ioctx.operate(oid, &op);
+      int r = ref.ioctx.operate(riter->oid, &op);
       if (r < 0) {
         ldout(cct, 0) << "ERROR: cleanup after error failed to drop reference on obj=" << *riter << dendl;
       }
@@ -7634,7 +7641,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
 
     do {
       void *handle;
-      rgw_obj obj;
+      rgw_raw_obj obj;
 
       ret = processor.handle_data(bl, ofs, &handle, &obj, &again);
       if (ret < 0) {
@@ -7866,14 +7873,14 @@ int RGWRados::Object::complete_atomic_modification()
 void RGWRados::update_gc_chain(rgw_obj& head_obj, RGWObjManifest& manifest, cls_rgw_obj_chain *chain)
 {
   RGWObjManifest::obj_iterator iter;
+  rgw_raw_obj raw_head;
+  obj_to_raw(head_obj, &raw_head);
   for (iter = manifest.obj_begin(); iter != manifest.obj_end(); ++iter) {
-    const rgw_obj& mobj = iter.get_location();
-    if (mobj == head_obj)
+    const rgw_raw_obj& mobj = iter.get_location();
+    if (mobj == raw_head)
       continue;
-    string oid, loc;
-    get_obj_bucket_and_oid_loc(mobj, oid, loc);
-    cls_rgw_obj_key key(oid);
-    chain->push_obj(mobj.bucket.placement.data_pool.to_str(), key, loc);
+    cls_rgw_obj_key key(mobj.oid);
+    chain->push_obj(mobj.pool.to_str(), key, mobj.loc);
   }
 }
 
@@ -8320,6 +8327,25 @@ int RGWRados::delete_obj(RGWObjectCtx& obj_ctx,
   return del_op.delete_obj();
 }
 
+int RGWRados::delete_raw_obj(const rgw_raw_obj& obj)
+{
+  rgw_rados_ref ref;
+  rgw_pool pool;
+  int r = get_raw_obj_ref(obj, &ref, &pool);
+  if (r < 0) {
+    return r;
+  }
+
+  ObjectWriteOperation op;
+
+  op.remove();
+  r = ref.ioctx.operate(ref.oid, &op);
+  if (r < 0)
+    return r;
+
+  return 0;
+}
+
 int RGWRados::delete_system_obj(rgw_raw_obj& obj, RGWObjVersionTracker *objv_tracker)
 {
   if (obj.get_object().empty()) {
@@ -8348,7 +8374,7 @@ int RGWRados::delete_system_obj(rgw_raw_obj& obj, RGWObjVersionTracker *objv_tra
   return 0;
 }
 
-int RGWRados::delete_obj_index(rgw_obj& obj)
+int RGWRados::delete_obj_index(const rgw_obj& obj)
 {
   std::string oid, key;
   get_obj_bucket_and_oid_loc(obj, oid, key);
@@ -8379,7 +8405,7 @@ static void generate_fake_tag(CephContext *cct, map<string, bufferlist>& attrset
   if (mi != manifest.obj_end()) {
     if (manifest.has_tail()) // first object usually points at the head, let's skip to a more unique part
       ++mi;
-    tag = mi.get_location().get_object();
+    tag = mi.get_location().oid;
     tag.append("_");
   }
 
@@ -8415,7 +8441,7 @@ static bool has_olh_tag(map<string, bufferlist>& attrs)
   return (iter != attrs.end());
 }
 
-int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, rgw_obj& obj, RGWObjState *olh_state,
+int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const rgw_obj& obj, RGWObjState *olh_state,
                                    RGWObjState **target_state)
 {
   assert(olh_state->is_olh);
@@ -8478,7 +8504,7 @@ int RGWRados::get_system_obj_state(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawO
   return ret;
 }
 
-int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
+int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
 {
   bool need_follow_olh = follow_olh && !obj.have_instance();
 
@@ -8628,7 +8654,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState *
   return 0;
 }
 
-int RGWRados::get_obj_state(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
+int RGWRados::get_obj_state(RGWObjectCtx *rctx, const rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent)
 {
   int ret;
 
@@ -8776,7 +8802,7 @@ int RGWRados::system_obj_get_attr(rgw_raw_obj& obj, const char *name, bufferlist
   return 0;
 }
 
-int RGWRados::append_atomic_test(RGWObjectCtx *rctx, rgw_obj& obj,
+int RGWRados::append_atomic_test(RGWObjectCtx *rctx, const rgw_obj& obj,
                             ObjectOperation& op, RGWObjState **pstate)
 {
   if (!rctx)
@@ -9132,6 +9158,7 @@ int RGWRados::Object::Read::prepare()
   }
 
   state.obj = astate->obj;
+  RGWRados::obj_to_raw(state.obj, &state.head_obj);
 
   r = store->get_obj_ioctx(state.obj, &state.io_ctx);
   if (r < 0) {
@@ -9409,7 +9436,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
   CephContext *cct = store->ctx();
 
   std::string oid, key;
-  rgw_obj read_obj = state.obj;
+  rgw_raw_obj read_obj;
   uint64_t read_ofs = ofs;
   uint64_t len, read_len;
   bool reading_from_head = true;
@@ -9420,9 +9447,6 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
   bufferlist read_bl;
   uint64_t max_chunk_size;
 
-
-  get_obj_bucket_and_oid_loc(state.obj, oid, key);
-
   RGWObjState *astate;
   int r = source->get_state(&astate, true);
   if (r < 0)
@@ -9441,16 +9465,14 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
     read_obj = iter.get_location();
     len = min(len, iter.get_stripe_size() - (ofs - stripe_ofs));
     read_ofs = iter.location_ofs() + (ofs - stripe_ofs);
-    reading_from_head = (read_obj == state.obj);
-
-    if (!reading_from_head) {
-      get_obj_bucket_and_oid_loc(read_obj, oid, key);
-    }
+    reading_from_head = (read_obj == state.head_obj);
+  } else {
+    read_obj = state.head_obj;
   }
 
-  r = store->get_max_chunk_size(read_obj.bucket, &max_chunk_size);
+  r = store->get_max_chunk_size(read_obj.pool, &max_chunk_size);
   if (r < 0) {
-    ldout(cct, 0) << "ERROR: failed to get max_chunk_size() for bucket " << read_obj.bucket << dendl;
+    ldout(cct, 0) << "ERROR: failed to get max_chunk_size() for pool " << read_obj.pool << dendl;
     return r;
   }
 
@@ -9458,13 +9480,13 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
     len = max_chunk_size;
 
 
-  state.io_ctx.locator_set_key(key);
+  state.io_ctx.locator_set_key(read_obj.loc);
 
   read_len = len;
 
   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(), read_obj, op, &astate);
+    r = store->append_atomic_test(&source->get_ctx(), state.obj, op, &astate);
     if (r < 0)
       return r;
 
@@ -9491,7 +9513,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
   ldout(cct, 20) << "rados->read obj-ofs=" << ofs << " read_ofs=" << read_ofs << " read_len=" << read_len << dendl;
   op.read(read_ofs, read_len, pbl, NULL);
 
-  r = state.io_ctx.operate(oid, &op, NULL);
+  r = state.io_ctx.operate(read_obj.oid, &op, NULL);
   ldout(cct, 20) << "rados->read r=" << r << " bl.length=" << bl.length() << dendl;
 
   if (r < 0) {
@@ -9771,11 +9793,11 @@ struct get_obj_data : public RefCountedObject {
   }
 };
 
-static int _get_obj_iterate_cb(rgw_obj& 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 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, obj_ofs, read_ofs, len, is_head_obj, arg);
+  return d->rados->get_obj_iterate_cb(d->ctx, astate, obj, read_obj, obj_ofs, read_ofs, len, is_head_obj, arg);
 }
 
 static void _get_obj_aio_completion_cb(completion_t cb, void *arg)
@@ -9860,7 +9882,8 @@ int RGWRados::flush_read_list(struct get_obj_data *d)
 }
 
 int RGWRados::get_obj_iterate_cb(RGWObjectCtx *ctx, RGWObjState *astate,
-                        rgw_obj& obj,
+                         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)
@@ -9902,8 +9925,6 @@ int RGWRados::get_obj_iterate_cb(RGWObjectCtx *ctx, RGWObjState *astate,
     }
   }
 
-  get_obj_bucket_and_oid_loc(obj, oid, key);
-
   d->throttle.get(len);
   if (d->is_cancelled()) {
     return d->get_err_code();
@@ -9914,16 +9935,16 @@ int RGWRados::get_obj_iterate_cb(RGWObjectCtx *ctx, RGWObjState *astate,
    */
   d->add_io(obj_ofs, len, &pbl, &c);
 
-  ldout(cct, 20) << "rados->get_obj_iterate_cb oid=" << oid << " obj-ofs=" << obj_ofs << " read_ofs=" << read_ofs << " len=" << len << dendl;
+  ldout(cct, 20) << "rados->get_obj_iterate_cb oid=" << read_obj.oid << " obj-ofs=" << obj_ofs << " read_ofs=" << read_ofs << " len=" << len << dendl;
   op.read(read_ofs, len, pbl, NULL);
 
   librados::IoCtx io_ctx(d->io_ctx);
-  io_ctx.locator_set_key(key);
+  io_ctx.locator_set_key(read_obj.loc);
 
-  r = io_ctx.aio_operate(oid, c, &op, NULL);
+  r = io_ctx.aio_operate(read_obj.oid, c, &op, NULL);
   if (r < 0) {
-       ldout(cct, 0) << "rados->aio_operate r=" << r << dendl;
-       goto done_err;
+    ldout(cct, 0) << "rados->aio_operate r=" << r << dendl;
+    goto done_err;
   }
 
   // Flush data to client if there is any
@@ -9984,15 +10005,18 @@ done:
 int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, rgw_obj& obj,
                           off_t ofs, off_t end,
                          uint64_t max_chunk_size,
-                         int (*iterate_obj_cb)(rgw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
+                         int (*iterate_obj_cb)(const rgw_obj& obj, const rgw_raw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
                          void *arg)
 {
-  rgw_obj read_obj = obj;
+  rgw_raw_obj head_obj;
+  rgw_raw_obj read_obj;
   uint64_t read_ofs = ofs;
   uint64_t len;
   bool reading_from_head = true;
   RGWObjState *astate = NULL;
 
+  obj_to_raw(obj, &head_obj);
+
   int r = get_obj_state(&obj_ctx, obj, &astate, false);
   if (r < 0) {
     return r;
@@ -10022,8 +10046,8 @@ int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, rgw_obj& obj,
           read_len = max_chunk_size;
         }
 
-        reading_from_head = (read_obj == obj);
-        r = iterate_obj_cb(read_obj, ofs, read_ofs, read_len, reading_from_head, astate, arg);
+        reading_from_head = (read_obj == head_obj);
+        r = iterate_obj_cb(obj, read_obj, ofs, read_ofs, read_len, reading_from_head, astate, arg);
        if (r < 0) {
          return r;
         }
@@ -10034,9 +10058,10 @@ int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, rgw_obj& obj,
     }
   } else {
     while (ofs <= end) {
+      read_obj = head_obj;
       uint64_t read_len = min(len, max_chunk_size);
 
-      r = iterate_obj_cb(obj, ofs, ofs, read_len, reading_from_head, astate, arg);
+      r = iterate_obj_cb(obj, read_obj, ofs, ofs, read_len, reading_from_head, astate, arg);
       if (r < 0) {
        return r;
       }
@@ -10049,7 +10074,7 @@ int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, rgw_obj& obj,
   return 0;
 }
 
-int RGWRados::obj_operate(rgw_obj& obj, ObjectWriteOperation *op)
+int RGWRados::obj_operate(const rgw_obj& obj, ObjectWriteOperation *op)
 {
   rgw_rados_ref ref;
   int r = get_obj_ref(obj, &ref);
@@ -10060,7 +10085,7 @@ int RGWRados::obj_operate(rgw_obj& obj, ObjectWriteOperation *op)
   return ref.ioctx.operate(ref.oid, op);
 }
 
-int RGWRados::obj_operate(rgw_obj& obj, ObjectReadOperation *op)
+int RGWRados::obj_operate(const rgw_obj& obj, ObjectReadOperation *op)
 {
   rgw_rados_ref ref;
   int r = get_obj_ref(obj, &ref);
@@ -10073,7 +10098,7 @@ int RGWRados::obj_operate(rgw_obj& obj, ObjectReadOperation *op)
   return ref.ioctx.operate(ref.oid, op, &outbl);
 }
 
-int RGWRados::olh_init_modification_impl(RGWObjState& state, rgw_obj& olh_obj, string *op_tag)
+int RGWRados::olh_init_modification_impl(RGWObjState& state, const rgw_obj& olh_obj, string *op_tag)
 {
   ObjectWriteOperation op;
 
@@ -10172,7 +10197,7 @@ int RGWRados::olh_init_modification_impl(RGWObjState& state, rgw_obj& olh_obj, s
   return 0;
 }
 
-int RGWRados::olh_init_modification(RGWObjState& state, rgw_obj& obj, string *op_tag)
+int RGWRados::olh_init_modification(RGWObjState& state, const rgw_obj& obj, string *op_tag)
 {
   int ret;
 
@@ -10184,7 +10209,7 @@ int RGWRados::olh_init_modification(RGWObjState& state, rgw_obj& obj, string *op
   return ret;
 }
 
-int RGWRados::bucket_index_link_olh(RGWObjState& olh_state, rgw_obj& obj_instance, bool delete_marker,
+int RGWRados::bucket_index_link_olh(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,
@@ -10220,7 +10245,7 @@ void RGWRados::bucket_index_guard_olh_op(RGWObjState& olh_state, ObjectOperation
   op.cmpxattr(RGW_ATTR_OLH_ID_TAG, CEPH_OSD_CMPXATTR_OP_EQ, olh_state.olh_tag);
 }
 
-int RGWRados::bucket_index_unlink_instance(rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch)
+int RGWRados::bucket_index_unlink_instance(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);
@@ -10244,7 +10269,7 @@ int RGWRados::bucket_index_unlink_instance(rgw_obj& obj_instance, const string&
   return 0;
 }
 
-int RGWRados::bucket_index_read_olh_log(RGWObjState& state, rgw_obj& obj_instance, uint64_t ver_marker,
+int RGWRados::bucket_index_read_olh_log(RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker,
                                         map<uint64_t, vector<rgw_bucket_olh_log_entry> > *log,
                                         bool *is_truncated)
 {
@@ -10274,7 +10299,7 @@ int RGWRados::bucket_index_read_olh_log(RGWObjState& state, rgw_obj& obj_instanc
   return 0;
 }
 
-int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, rgw_obj& obj_instance, uint64_t ver)
+int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver)
 {
   rgw_rados_ref ref;
   int r = get_obj_ref(obj_instance, &ref);
@@ -10304,7 +10329,7 @@ int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, rgw_obj& obj_instanc
   return 0;
 }
 
-int RGWRados::bucket_index_clear_olh(RGWObjState& state, rgw_obj& obj_instance)
+int RGWRados::bucket_index_clear_olh(RGWObjState& state, const rgw_obj& obj_instance)
 {
   rgw_rados_ref ref;
   int r = get_obj_ref(obj_instance, &ref);
@@ -10332,7 +10357,7 @@ int RGWRados::bucket_index_clear_olh(RGWObjState& state, rgw_obj& obj_instance)
   return 0;
 }
 
-int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, RGWBucketInfo& bucket_info, rgw_obj& obj,
+int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, RGWBucketInfo& bucket_info, const rgw_obj& obj,
                             bufferlist& olh_tag, map<uint64_t, vector<rgw_bucket_olh_log_entry> >& log,
                             uint64_t *plast_ver)
 {
@@ -10463,7 +10488,7 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, RGWBucket
 /*
  * read olh log and apply it
  */
-int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, rgw_obj& obj)
+int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, const rgw_obj& obj)
 {
   map<uint64_t, vector<rgw_bucket_olh_log_entry> > log;
   bool is_truncated;
@@ -10483,7 +10508,7 @@ int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInf
   return 0;
 }
 
-int RGWRados::set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta,
+int RGWRados::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, real_time unmod_since, bool high_precision_time)
 {
   string op_tag;
@@ -10543,7 +10568,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, rgw_obj
   return 0;
 }
 
-int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, rgw_obj& target_obj,
+int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
                                   uint64_t olh_epoch)
 {
   string op_tag;
@@ -10628,7 +10653,7 @@ static void filter_attrset(map<string, bufferlist>& unfiltered_attrset, const st
   }
 }
 
-int RGWRados::get_olh(rgw_obj& obj, RGWOLHInfo *olh)
+int RGWRados::get_olh(const rgw_obj& obj, RGWOLHInfo *olh)
 {
   map<string, bufferlist> unfiltered_attrset;
 
@@ -10692,7 +10717,7 @@ void RGWRados::check_pending_olh_entries(map<string, bufferlist>& pending_entrie
   }
 }
 
-int RGWRados::remove_olh_pending_entries(RGWObjState& state, rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs)
+int RGWRados::remove_olh_pending_entries(RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs)
 {
   ObjectWriteOperation op;
 
@@ -10722,7 +10747,7 @@ int RGWRados::remove_olh_pending_entries(RGWObjState& state, rgw_obj& olh_obj, m
   return 0;
 }
 
-int RGWRados::follow_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target)
+int RGWRados::follow_olh(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);
@@ -12188,7 +12213,9 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
     RGWObjManifest::obj_iterator miter;
     RGWObjManifest& manifest = astate->manifest;
     for (miter = manifest.obj_begin(); miter != manifest.obj_end(); ++miter) {
-      rgw_obj loc = miter.get_location();
+      const rgw_raw_obj& raw_loc = miter.get_location();
+      rgw_obj loc;
+      rgw_raw_obj_to_obj(manifest.get_obj().bucket, raw_loc, &loc);
 
       if (loc.ns == RGW_OBJ_NS_MULTIPART) {
        dout(10) << "check_disk_state(): removing manifest part from index: " << loc << dendl;
@@ -12933,7 +12960,32 @@ librados::Rados* RGWRados::get_rados_handle()
   }
 }
 
-int RGWRados::delete_obj_aio(rgw_obj& obj, rgw_bucket& bucket,
+int RGWRados::delete_raw_obj_aio(const rgw_raw_obj& obj, list<librados::AioCompletion *>& handles)
+{
+  rgw_rados_ref ref;
+  int ret = get_raw_obj_ref(obj, &ref);
+  if (ret < 0) {
+    lderr(cct) << "ERROR: failed to get obj ref with ret=" << ret << dendl;
+    return ret;
+  }
+
+  ObjectWriteOperation op;
+  list<string> prefixes;
+  cls_rgw_remove_obj(op, prefixes);
+
+  AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL);
+  ret = ref.ioctx.aio_operate(ref.oid, c, &op);
+  if (ret < 0) {
+    lderr(cct) << "ERROR: AioOperate failed with ret=" << ret << dendl;
+    return ret;
+  }
+
+  handles.push_back(c);
+
+  return 0;
+}
+
+int RGWRados::delete_obj_aio(const rgw_obj& obj, rgw_bucket& bucket,
                              RGWBucketInfo& bucket_info, RGWObjState *astate,
                              list<librados::AioCompletion *>& handles, bool keep_index_consistent)
 {
index 45388c2c95151fd6c526949ba8e2082ed095e307..cd13a8882c6172f179ac00ce838715e6dea3bd5b 100644 (file)
@@ -76,6 +76,38 @@ static inline void get_obj_bucket_and_oid_loc(const rgw_obj& obj, string& oid, s
 
 int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy);
 
+static inline void rgw_obj_to_raw(const rgw_obj& obj, rgw_raw_obj *raw_obj)
+{
+  get_obj_bucket_and_oid_loc(obj, raw_obj->oid, raw_obj->loc);
+
+  if (!obj.is_in_extra_data()) {
+    raw_obj->pool = obj.bucket.placement.data_pool;
+  } else {
+    raw_obj->pool = obj.bucket.placement.get_data_extra_pool();
+  }
+}
+
+static inline bool rgw_raw_obj_to_obj(const rgw_bucket& bucket, const rgw_raw_obj& raw_obj, rgw_obj *obj)
+{
+  string name;
+  string instance;
+  string ns;
+
+  ssize_t pos = raw_obj.oid.find('_');
+  if (pos < 0) {
+    return false;
+  }
+
+  if (!rgw_obj::parse_raw_oid(raw_obj.oid.substr(pos + 1), &name, &instance, &ns)) {
+    return false;
+  }
+
+  obj->init_ns(bucket, name, ns);
+  obj->set_instance(instance);
+
+  return true;
+}
+
 struct compression_block {
   uint64_t old_ofs;
   uint64_t new_ofs;
@@ -228,7 +260,7 @@ struct RGWCloneRangeInfo {
 };
 
 struct RGWObjManifestPart {
-  rgw_obj loc;       /* the object where the data is located */
+  rgw_obj loc;   /* the object where the data is located */
   uint64_t loc_ofs;  /* the offset at that object where the data is located */
   uint64_t size;     /* the part size */
 
@@ -313,13 +345,14 @@ protected:
 
   uint64_t obj_size;
 
-  rgw_obj head_obj;
+  rgw_obj obj;
+  rgw_raw_obj head_obj;
   uint64_t head_size;
 
   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 buckets */
+                             as object might have been copied across pools */
   map<uint64_t, RGWObjManifestRule> rules;
 
   string tail_instance; /* tail object's instance */
@@ -343,6 +376,7 @@ public:
     explicit_objs = rhs.explicit_objs;
     objs = rhs.objs;
     obj_size = rhs.obj_size;
+    obj = rhs.obj;
     head_obj = rhs.head_obj;
     head_size = rhs.head_size;
     max_head_size = rhs.max_head_size;
@@ -371,7 +405,7 @@ public:
     objs.swap(_objs);
   }
 
-  void get_implicit_location(uint64_t cur_part_id, uint64_t cur_stripe, uint64_t ofs, string *override_prefix, rgw_obj *location);
+  void get_implicit_location(uint64_t cur_part_id, uint64_t cur_stripe, uint64_t ofs, string *override_prefix, rgw_raw_obj *location);
 
   void set_trivial_rule(uint64_t tail_ofs, uint64_t stripe_max_size) {
     RGWObjManifestRule rule(0, tail_ofs, 0, stripe_max_size);
@@ -387,27 +421,28 @@ public:
   }
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(5, 3, bl);
+    ENCODE_START(6, 3, bl);
     ::encode(obj_size, bl);
     ::encode(objs, bl);
     ::encode(explicit_objs, bl);
-    ::encode(head_obj, bl);
+    ::encode(obj, bl);
     ::encode(head_size, bl);
     ::encode(max_head_size, bl);
     ::encode(prefix, bl);
     ::encode(rules, bl);
     ::encode(tail_bucket, bl);
     ::encode(tail_instance, bl);
+    ::encode(head_obj, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::iterator& bl) {
-    DECODE_START_LEGACY_COMPAT_LEN_32(5, 2, 2, bl);
+    DECODE_START_LEGACY_COMPAT_LEN_32(6, 2, 2, bl);
     ::decode(obj_size, bl);
     ::decode(objs, bl);
     if (struct_v >= 3) {
       ::decode(explicit_objs, bl);
-      ::decode(head_obj, bl);
+      ::decode(obj, bl);
       ::decode(head_size, bl);
       ::decode(max_head_size, bl);
       ::decode(prefix, bl);
@@ -416,7 +451,7 @@ public:
       explicit_objs = true;
       if (!objs.empty()) {
         map<uint64_t, RGWObjManifestPart>::iterator iter = objs.begin();
-        head_obj = iter->second.loc;
+        obj = iter->second.loc;
         head_size = iter->second.size;
         max_head_size = head_size;
       }
@@ -429,9 +464,8 @@ public:
        * when the explicit objs manifest was around, and it got copied.
        */
       rgw_obj& obj_0 = objs[0].loc;
-
       if (!obj_0.get_object().empty() && obj_0.ns.empty()) {
-        objs[0].loc = head_obj;
+        objs[0].loc = obj;
         objs[0].size = head_size;
       }
     }
@@ -443,7 +477,13 @@ public:
     if (struct_v >= 5) {
       ::decode(tail_instance, bl);
     } else { // old object created before 'tail_instance' field added to manifest
-      tail_instance = head_obj.get_instance();
+      tail_instance = obj.get_instance();
+    }
+
+    if (struct_v >= 6) {
+      ::decode(head_obj, bl);
+    } else {
+      rgw_obj_to_raw(obj, &head_obj);
     }
 
     update_iterators();
@@ -471,8 +511,8 @@ public:
     if (explicit_objs) {
       if (objs.size() == 1) {
         map<uint64_t, RGWObjManifestPart>::iterator iter = objs.begin();
-        rgw_obj& obj = iter->second.loc;
-        return !(head_obj == obj);
+        rgw_obj& o = iter->second.loc;
+        return !(obj == o);
       }
       return (objs.size() >= 2);
     }
@@ -480,16 +520,21 @@ public:
   }
 
   void set_head(const rgw_obj& _o, uint64_t _s) {
-    head_obj = _o;
+    obj = _o;
+    rgw_obj_to_raw(obj, &head_obj);
     head_size = _s;
 
     if (explicit_objs && head_size > 0) {
-      objs[0].loc = head_obj;
+      objs[0].loc = obj;
       objs[0].size = head_size;
     }
   }
 
-  const rgw_obj& get_head() {
+  const rgw_obj& get_obj() {
+    return obj;
+  }
+
+  const rgw_raw_obj& get_head() {
     return head_obj;
   }
 
@@ -554,7 +599,7 @@ public:
     int cur_stripe;
     string cur_override_prefix;
 
-    rgw_obj location;
+    rgw_raw_obj location;
 
     map<uint64_t, RGWObjManifestRule>::iterator rule_iter;
     map<uint64_t, RGWObjManifestRule>::iterator next_rule_iter;
@@ -604,7 +649,7 @@ public:
     bool operator!=(const obj_iterator& rhs) {
       return (ofs != rhs.ofs);
     }
-    const rgw_obj& get_location() {
+    const rgw_raw_obj& get_location() {
       return location;
     }
 
@@ -663,8 +708,8 @@ public:
     
     string oid_prefix;
 
-    rgw_obj cur_obj;
-    rgw_bucket bucket;
+    rgw_raw_obj cur_obj;
+    rgw_pool pool;
 
 
     RGWObjManifestRule rule;
@@ -672,11 +717,11 @@ public:
   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& head);
+    int create_begin(CephContext *cct, RGWObjManifest *manifest, rgw_bucket& bucket, rgw_obj& obj);
 
     int create_next(uint64_t ofs);
 
-    const rgw_obj& get_cur_obj() { return cur_obj; }
+    const rgw_raw_obj& get_cur_obj() { return cur_obj; }
 
     /* total max size of current stripe (including head obj) */
     uint64_t cur_stripe_max_size() {
@@ -1895,7 +1940,7 @@ class RGWObjectCtxImpl {
 public:
   RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
 
-  S *get_state(T& obj) {
+  S *get_state(const T& obj) {
     S *result;
     typename std::map<T, S>::iterator iter;
     lock.get_read();
@@ -2058,11 +2103,11 @@ class RGWRados
   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, rgw_obj& obj, RGWObjState *olh_state,
+  int get_olh_target_state(RGWObjectCtx& rctx, 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, rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent = false);
-  int append_atomic_test(RGWObjectCtx *rctx, rgw_obj& obj,
+  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,
                          librados::ObjectOperation& op, RGWObjState **state);
 
   int update_placement_map();
@@ -2264,8 +2309,11 @@ public:
   const RGWSyncModuleInstanceRef& get_sync_module() {
     return sync_module;
   }
-  int get_required_alignment(rgw_bucket& bucket, uint64_t *alignment);
-  int get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size);
+
+  int get_required_alignment(const rgw_pool& pool, uint64_t *alignment);
+  int get_required_alignment(const rgw_bucket& bucket, uint64_t *alignment);
+  int get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size);
+  int get_max_chunk_size(const rgw_bucket& bucket, uint64_t *max_chunk_size);
 
   uint32_t get_max_bucket_shards() {
     return MAX_BUCKET_INDEX_SHARDS_PRIME;
@@ -2433,8 +2481,8 @@ public:
     string bucket_obj;
 
     explicit BucketShard(RGWRados *_store) : store(_store), shard_id(-1) {}
-    int init(rgw_bucket& _bucket, rgw_obj& obj);
-    int init(rgw_bucket& _bucket, int sid);
+    int init(const rgw_bucket& _bucket, const rgw_obj& obj);
+    int init(const rgw_bucket& _bucket, int sid);
   };
 
   class Object {
@@ -2497,6 +2545,7 @@ public:
       struct GetObjState {
         librados::IoCtx io_ctx;
         rgw_obj obj;
+        rgw_raw_obj head_obj;
       } state;
       
       struct ConditionParams {
@@ -2660,7 +2709,7 @@ public:
       bool prepared{false};
     public:
 
-      UpdateIndex(RGWRados::Bucket *_target, rgw_obj& _obj) : target(_target), obj(_obj),
+      UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), obj(_obj),
                                                               bs(target->get_store()) {
                                                                 blind = (target->get_bucket_info().index_type == RGWBIType_Indexless);
                                                               }
@@ -2733,10 +2782,8 @@ public:
 
   virtual int put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
               off_t ofs, bool exclusive);
-  int put_obj_data(void *ctx, rgw_obj& obj, const char *data,
-              off_t ofs, size_t len, bool exclusive);
-  int aio_put_obj_data(void *ctx, rgw_obj& obj, bufferlist& bl,
-                               off_t ofs, bool exclusive, void **handle);
+  int aio_put_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
+                        off_t ofs, bool exclusive, void **handle);
 
   int put_system_obj(void *ctx, rgw_raw_obj& obj, const char *data, size_t len, bool exclusive,
               ceph::real_time *mtime, map<std::string, bufferlist>& attrs, RGWObjVersionTracker *objv_tracker,
@@ -2928,11 +2975,14 @@ public:
                          uint16_t bilog_flags = 0,
                          const ceph::real_time& expiration_time = ceph::real_time());
 
+  /** Delete a raw object.*/
+  int delete_raw_obj(const rgw_raw_obj& obj);
+
   /* Delete a system object */
   virtual int delete_system_obj(rgw_raw_obj& src_obj, RGWObjVersionTracker *objv_tracker = NULL);
 
   /** Remove an object from the bucket index */
-  int delete_obj_index(rgw_obj& obj);
+  int delete_obj_index(const rgw_obj& obj);
 
   /**
    * Get the attributes for an object.
@@ -2966,8 +3016,8 @@ public:
                         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, rgw_obj& obj, RGWObjState **state, bool follow_olh, bool assume_noent = false);
-  int get_obj_state(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state) {
+  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);
   }
 
@@ -2991,13 +3041,14 @@ public:
   int iterate_obj(RGWObjectCtx& ctx, rgw_obj& obj,
                   off_t ofs, off_t end,
                   uint64_t max_chunk_size,
-                  int (*iterate_obj_cb)(rgw_obj&, off_t, off_t, off_t, bool, RGWObjState *, void *),
+                  int (*iterate_obj_cb)(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,
-                         rgw_obj& obj,
+                         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);
 
@@ -3011,34 +3062,34 @@ public:
                        map<string, bufferlist> *attrs, bufferlist *first_chunk,
                        RGWObjVersionTracker *objv_tracker);
 
-  int obj_operate(rgw_obj& obj, librados::ObjectWriteOperation *op);
-  int obj_operate(rgw_obj& obj, librados::ObjectReadOperation *op);
+  int obj_operate(const rgw_obj& obj, librados::ObjectWriteOperation *op);
+  int obj_operate(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, rgw_obj& olh_obj, string *op_tag);
-  int olh_init_modification_impl(RGWObjState& state, rgw_obj& olh_obj, string *op_tag);
-  int bucket_index_link_olh(RGWObjState& olh_state, rgw_obj& obj_instance, bool delete_marker,
+  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,
                             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(rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch);
-  int bucket_index_read_olh_log(RGWObjState& state, rgw_obj& obj_instance, uint64_t ver_marker,
+  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,
                                 map<uint64_t, vector<rgw_bucket_olh_log_entry> > *log, bool *is_truncated);
-  int bucket_index_trim_olh_log(RGWObjState& obj_state, rgw_obj& obj_instance, uint64_t ver);
-  int bucket_index_clear_olh(RGWObjState& state, rgw_obj& obj_instance);
-  int apply_olh_log(RGWObjectCtx& ctx, RGWObjState& obj_state, RGWBucketInfo& bucket_info, rgw_obj& obj,
+  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,
                     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, rgw_obj& obj);
-  int set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta,
+  int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, 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, rgw_obj& target_obj,
+  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, rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs);
-  int follow_olh(RGWObjectCtx& ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target);
-  int get_olh(rgw_obj& obj, RGWOLHInfo *olh);
+  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);
 
   void gen_rand_obj_instance_name(rgw_obj *target);
 
@@ -3293,7 +3344,8 @@ public:
 
   librados::Rados* get_rados_handle();
 
-  int delete_obj_aio(rgw_obj& obj, rgw_bucket& bucket, RGWBucketInfo& info, RGWObjState *astate,
+  int delete_raw_obj_aio(const rgw_raw_obj& obj, list<librados::AioCompletion *>& handles);
+  int delete_obj_aio(const rgw_obj& obj, rgw_bucket& bucket, RGWBucketInfo& info, RGWObjState *astate,
                      list<librados::AioCompletion *>& handles, bool keep_index_consistent);
  private:
   /**
@@ -3441,8 +3493,8 @@ class RGWPutObjDataProcessor
 public:
   RGWPutObjDataProcessor(){}
   virtual ~RGWPutObjDataProcessor(){}
-  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again) = 0;
-  virtual int throttle_data(void *handle, const rgw_obj& obj, uint64_t size, bool need_to_wait) = 0;
+  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) = 0;
+  virtual int throttle_data(void *handle, const rgw_raw_obj& obj, uint64_t size, bool need_to_wait) = 0;
 }; /* RGWPutObjDataProcessor */
 
 
@@ -3484,7 +3536,7 @@ public:
 
 struct put_obj_aio_info {
   void *handle;
-  rgw_obj obj;
+  rgw_raw_obj obj;
   uint64_t size;
 };
 
@@ -3500,23 +3552,24 @@ class RGWPutObjProcessor_Aio : public RGWPutObjProcessor
   int wait_pending_front();
   bool pending_has_completed();
 
-  rgw_obj last_written_obj;
+  rgw_raw_obj last_written_obj;
 
 protected:
   uint64_t obj_len{0};
 
-  set<rgw_obj> written_objs;
+  set<rgw_raw_obj> written_objs;
+  rgw_obj head_obj;
 
-  void add_written_obj(const rgw_obj& obj) {
+  void add_written_obj(const rgw_raw_obj& obj) {
     written_objs.insert(obj);
   }
 
   int drain_pending();
-  int handle_obj_data(rgw_obj& obj, bufferlist& bl, off_t ofs, off_t abs_ofs, void **phandle, bool exclusive);
+  int handle_obj_data(rgw_raw_obj& obj, bufferlist& bl, off_t ofs, off_t abs_ofs, void **phandle, bool exclusive);
 
 public:
   int prepare(RGWRados *store, string *oid_rand);
-  int throttle_data(void *handle, const rgw_obj& obj, uint64_t size, bool need_to_wait);
+  int throttle_data(void *handle, const rgw_raw_obj& obj, uint64_t size, bool need_to_wait);
 
   RGWPutObjProcessor_Aio(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info) : RGWPutObjProcessor(obj_ctx, bucket_info) {}
   virtual ~RGWPutObjProcessor_Aio();
@@ -3544,12 +3597,11 @@ protected:
 
   string unique_tag;
 
-  rgw_obj head_obj;
-  rgw_obj cur_obj;
+  rgw_raw_obj cur_obj;
   RGWObjManifest manifest;
   RGWObjManifest::generator manifest_gen;
 
-  int write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool exclusive);
+  int write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool exclusive);
   int do_complete(size_t accounted_size, const string& etag,
                   ceph::real_time *mtime, ceph::real_time set_mtime,
                   map<string, bufferlist>& attrs, ceph::real_time delete_at,
@@ -3579,7 +3631,7 @@ public:
                                 unique_tag(_t) {}
   int prepare(RGWRados *store, string *oid_rand);
   virtual bool immutable_head() { return false; }
-  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again);
+  virtual int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again);
 
   void set_olh_epoch(uint64_t epoch) {
     olh_epoch = epoch;