]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW - Zipper - remove last rgw_raw_obj from API 42796/head
authorDaniel Gryniewicz <dang@redhat.com>
Tue, 10 Aug 2021 13:40:54 +0000 (09:40 -0400)
committerDaniel Gryniewicz <dang@redhat.com>
Wed, 18 Aug 2021 14:44:15 +0000 (10:44 -0400)
Remove the remaining rgw_raw_obj from the API.  This consists of:

- move get/delete raw_obj from Store to RadosStore; it's only needed by
  RadosStore code
- Add a layout formatter to the API
- remove head_obj and get_manifest() from ReadOp
- Remove GCChain (no longer needed)

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
20 files changed:
src/rgw/rgw_etag_verifier.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_log.cc
src/rgw/rgw_obj_manifest.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_orphan.cc
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3_rados.cc [new file with mode: 0644]
src/rgw/rgw_rest_s3_rados.h [new file with mode: 0644]
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/rgw/rgw_torrent.h

index 3a22e7e6b16bc59ca0d57e08d118d4628089eada..52f7c7948421f857084b5fd93c3a18cd9ef888fc 100644 (file)
@@ -2,6 +2,7 @@
 // vim: ts=8 sw=2 smarttab ft=cpp
 
 #include "rgw_etag_verifier.h"
+#include "rgw_obj_manifest.h"
 
 #define dout_subsys ceph_subsys_rgw
 
index a495cdb6e498425a55c544059e6909d022ad9bc4..3f186a5c970db5dcb12761959b95d1ed6d83ea9d 100644 (file)
@@ -27,7 +27,7 @@
 #include "rgw_string.h"
 #include "rgw_multi.h"
 #include "rgw_sal.h"
-#include "rgw_sal.h"
+#include "rgw_rados.h"
 
 // this seems safe to use, at least for now--arguably, we should
 // prefer header-only fmt, in general
index 7c4f404a8819cdba92a81294a3a5bd75b33e71f1..d66ad3a504a0021a8c46002ac01fba92f4dcedb2 100644 (file)
@@ -20,7 +20,6 @@
 #include "cls/rgw/cls_rgw_types.h"
 #include "rgw_tag.h"
 #include "rgw_sal.h"
-#include "rgw_rados.h"
 
 #include <atomic>
 #include <tuple>
index b2c4e8093264c647131388db82c8ad7c49ae42c3..9c9e70b1cf626bf40a797513fbdc750f2f45f966 100644 (file)
@@ -13,6 +13,7 @@
 #include "rgw_client_io.h"
 #include "rgw_rest.h"
 #include "rgw_zone.h"
+#include "rgw_rados.h"
 
 #include "services/svc_zone.h"
 
index 45b9aaea0ef344c6d913a2c86349b837e15efebb..a5df7a4b25512cb6be041b4d5e738e426fee3b0a 100644 (file)
@@ -23,6 +23,9 @@ class RGWSI_Zone;
 struct RGWZoneGroup;
 struct RGWZoneParams;
 class RGWRados;
+namespace rgw { namespace sal {
+  class RadosStore;
+} };
 
 class rgw_obj_select {
   rgw_placement_rule placement_rule;
@@ -45,7 +48,7 @@ public:
   }
 
   rgw_raw_obj get_raw_obj(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params) const;
-  rgw_raw_obj get_raw_obj(rgw::sal::Store* store) const;
+  rgw_raw_obj get_raw_obj(rgw::sal::RadosStore* store) const;
 
   rgw_obj_select& operator=(const rgw_obj& rhs) {
     obj = rhs;
@@ -527,7 +530,7 @@ public:
     int create_next(uint64_t ofs);
 
     rgw_raw_obj get_cur_obj(RGWZoneGroup& zonegroup, RGWZoneParams& zone_params) { return cur_obj.get_raw_obj(zonegroup, zone_params); }
-    rgw_raw_obj get_cur_obj(rgw::sal::Store* store) const { return cur_obj.get_raw_obj(store); }
+    rgw_raw_obj get_cur_obj(rgw::sal::RadosStore* store) const { return cur_obj.get_raw_obj(store); }
 
     /* total max size of current stripe (including head obj) */
     uint64_t cur_stripe_max_size() const {
index 4cb9bed0197c19ff25801871787f78bc3cc8283c..620891cc935d4499b055bab15811870e6d8144e0 100644 (file)
@@ -7519,18 +7519,6 @@ void RGWGetObjLayout::execute(optional_yield y)
 {
   /* Make sure bucket is correct */
   s->object->set_bucket(s->bucket.get());
-
-  std::unique_ptr<rgw::sal::Object::ReadOp> stat_op(s->object->get_read_op(s->obj_ctx));
-
-
-  op_ret = stat_op->prepare(y, this);
-  if (op_ret < 0) {
-    return;
-  }
-
-  head_obj = stat_op->result.head_obj;
-
-  op_ret = stat_op->get_manifest(this, &manifest, y);
 }
 
 
index 20bddbed1dc55ac7e38daa7414e431ce1f08f6b4..3d4cc1e2b195b30da7fd97b85831bcba4f74ad9a 100644 (file)
@@ -42,8 +42,8 @@
 #include "rgw_cors.h"
 #include "rgw_quota.h"
 #include "rgw_putobj.h"
-#include "rgw_multi.h"
 #include "rgw_sal.h"
+#include "rgw_compression_types.h"
 
 #include "rgw_lc.h"
 #include "rgw_torrent.h"
@@ -63,6 +63,7 @@ using ceph::crypto::SHA1;
 struct req_state;
 class RGWOp;
 class RGWRados;
+class RGWMultiCompleteUpload;
 
 
 namespace rgw {
@@ -2319,10 +2320,6 @@ public:
 }; /* RGWRMAttrs */
 
 class RGWGetObjLayout : public RGWOp {
-protected:
-  RGWObjManifest *manifest{nullptr};
-  rgw_raw_obj head_obj;
-
 public:
   RGWGetObjLayout() {
   }
index 711164dc8e2119080e9d536b2cab22a1d317a053..661bbc9e35029ff52fa29a5de3e4d7462daf0140 100644 (file)
@@ -453,7 +453,7 @@ int RGWOrphanSearch::handle_stat_result(const DoutPrefixProvider *dpp, map<int,
 
     RGWObjManifest::obj_iterator miter;
     for (miter = manifest.obj_begin(dpp); miter != manifest.obj_end(dpp); ++miter) {
-      const rgw_raw_obj& loc = miter.get_location().get_raw_obj(store);
+      const rgw_raw_obj& loc = miter.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
       string s = loc.oid;
       obj_oids.insert(obj_fingerprint(s));
     }
@@ -1040,7 +1040,7 @@ int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp,
     RGWObjManifest::obj_iterator miter;
     for (miter = manifest.obj_begin(dpp); miter != manifest.obj_end(dpp); ++miter) {
       const rgw_raw_obj& loc =
-       miter.get_location().get_raw_obj(store);
+       miter.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
       string s = loc.oid;
       obj_oids.insert(s);
     }
@@ -1501,7 +1501,7 @@ int RGWRadosList::do_incomplete_multipart(const DoutPrefixProvider *dpp,
                 obj_it != manifest.obj_end(dpp);
                 ++obj_it) {
              const rgw_raw_obj& loc =
-               obj_it.get_location().get_raw_obj(store);
+               obj_it.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
              std::cout << loc.oid << std::endl;
            } // for (auto obj_it
          } // for (auto& p
index afe33b7026c346c347d4637b9cb831216d388f88..cce925df30cc28de5eca31d66638594cecaf2679 100644 (file)
@@ -383,7 +383,7 @@ int MultipartObjectProcessor::prepare_head()
   }
 
   rgw_raw_obj stripe_obj = manifest_gen.get_cur_obj(store);
-  head_obj->raw_obj_to_obj(stripe_obj);
+  dynamic_cast<rgw::sal::RadosObject*>(head_obj.get())->raw_obj_to_obj(stripe_obj);
   head_obj->set_hash_source(target_obj->get_name());
 
   r = writer.set_stripe_obj(stripe_obj);
index a608d608ad8753d0f47c17e1ac8b0bdfe3cffd0f..9b4f77a8ca9a8fdeb5a4a861bf47b5fe61a19cb3 100644 (file)
@@ -149,7 +149,7 @@ rgw_raw_obj rgw_obj_select::get_raw_obj(const RGWZoneGroup& zonegroup, const RGW
   return raw_obj;
 }
 
-rgw_raw_obj rgw_obj_select::get_raw_obj(rgw::sal::Store* store) const
+rgw_raw_obj rgw_obj_select::get_raw_obj(rgw::sal::RadosStore* store) const
 {
   if (!is_raw) {
     rgw_raw_obj r;
@@ -5308,7 +5308,8 @@ static void generate_fake_tag(const DoutPrefixProvider *dpp, rgw::sal::Store* st
   if (mi != manifest.obj_end(dpp)) {
     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_raw_obj(store).oid;
+    rgw::sal::RadosStore* rstore = dynamic_cast<rgw::sal::RadosStore*>(store);
+    tag = mi.get_location().get_raw_obj(rstore).oid;
     tag.append("_");
   }
 
index 9d3870b0e2d2712cfa4677cfcf9dcd646f16035b..be39b4ede0d5d13ee818b3ec82ab860d959f172f 100644 (file)
@@ -148,13 +148,6 @@ struct RGWUsageBatch {
   }
 };
 
-class RGWGetDataCB {
-public:
-  virtual int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) = 0;
-  RGWGetDataCB() {}
-  virtual ~RGWGetDataCB() {}
-};
-
 struct RGWCloneRangeInfo {
   rgw_obj src;
   off_t src_ofs;
index 9f6bd8f02f08b4e760333bc5d355c9f505706d0f..84adbf01dc1c08c72a1f206fb63c1eb54218665c 100644 (file)
@@ -4024,26 +4024,7 @@ void RGWGetObjLayout_ObjStore_S3::send_response()
   }
 
   f.open_object_section("result");
-  ::encode_json("head", head_obj, &f);
-  ::encode_json("manifest", *manifest, &f);
-  f.open_array_section("data_location");
-  for (auto miter = manifest->obj_begin(this); miter != manifest->obj_end(this); ++miter) {
-    f.open_object_section("obj");
-    rgw_raw_obj raw_loc = miter.get_location().get_raw_obj(store);
-    uint64_t ofs = miter.get_ofs();
-    uint64_t left = manifest->get_obj_size() - ofs;
-    ::encode_json("ofs", miter.get_ofs(), &f);
-    ::encode_json("loc", raw_loc, &f);
-    ::encode_json("loc_ofs", miter.location_ofs(), &f);
-    uint64_t loc_size = miter.get_stripe_size();
-    if (loc_size > left) {
-      loc_size = left;
-    }
-    ::encode_json("loc_size", loc_size, &f);
-    f.close_section();
-    rgw_flush_formatter(s, &f);
-  }
-  f.close_section();
+  s->object->get_obj_layout(this, s->yield, &f, s->obj_ctx);
   f.close_section();
   rgw_flush_formatter(s, &f);
 }
diff --git a/src/rgw/rgw_rest_s3_rados.cc b/src/rgw/rgw_rest_s3_rados.cc
new file mode 100644 (file)
index 0000000..47e0393
--- /dev/null
@@ -0,0 +1,46 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+#include "rgw_rest_s3_rados.h"
+#include "rgw_sal_rados.h"
+#include "rgw_rest.h"
+#include "rgw_obj_manifest.h"
+
+void RGWGetObjLayout_ObjStore_S3::send_response()
+{
+  if (op_ret)
+    set_req_state_err(s, op_ret);
+  dump_errno(s);
+  end_header(s, this, "application/json");
+
+  JSONFormatter f;
+
+  if (op_ret < 0) {
+    return;
+  }
+
+  f.open_object_section("result");
+  ::encode_json("head", head_obj, &f);
+  ::encode_json("manifest", *manifest, &f);
+  f.open_array_section("data_location");
+  for (auto miter = manifest->obj_begin(this); miter != manifest->obj_end(this); ++miter) {
+    f.open_object_section("obj");
+    rgw_raw_obj raw_loc = miter.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
+    uint64_t ofs = miter.get_ofs();
+    uint64_t left = manifest->get_obj_size() - ofs;
+    ::encode_json("ofs", miter.get_ofs(), &f);
+    ::encode_json("loc", raw_loc, &f);
+    ::encode_json("loc_ofs", miter.location_ofs(), &f);
+    uint64_t loc_size = miter.get_stripe_size();
+    if (loc_size > left) {
+      loc_size = left;
+    }
+    ::encode_json("loc_size", loc_size, &f);
+    f.close_section();
+    rgw_flush_formatter(s, &f);
+  }
+  f.close_section();
+  f.close_section();
+  rgw_flush_formatter(s, &f);
+}
+
diff --git a/src/rgw/rgw_rest_s3_rados.h b/src/rgw/rgw_rest_s3_rados.h
new file mode 100644 (file)
index 0000000..2a3e4d4
--- /dev/null
@@ -0,0 +1,15 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+#pragma once
+
+#include "rgw_op_rados.h"
+
+class RGWGetObjLayout_ObjStore_S3 : public RGWGetObjLayout {
+public:
+  RGWGetObjLayout_ObjStore_S3() {}
+  ~RGWGetObjLayout_ObjStore_S3() {}
+
+  void send_response() override;
+};
+
index 0c12348b44e20533f278a5605c3d0de1692919d1..2c2f26df0147ca1c8140a9859993706242ddb579 100644 (file)
@@ -43,6 +43,13 @@ namespace rgw {
   namespace IAM { struct Policy; }
 }
 
+class RGWGetDataCB {
+public:
+  virtual int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) = 0;
+  RGWGetDataCB() {}
+  virtual ~RGWGetDataCB() {}
+};
+
 struct RGWUsageIter {
   std::string read_iter;
   uint32_t index;
@@ -202,13 +209,8 @@ class Store {
     virtual std::unique_ptr<Completions> get_completions(void) = 0;
     virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, struct req_state* s, 
         rgw::notify::EventType event_type, const std::string* object_name=nullptr) = 0;
-    virtual std::unique_ptr<GCChain> get_gc_chain(rgw::sal::Object* obj) = 0;
     virtual RGWLC* get_rgwlc(void) = 0;
     virtual RGWCoroutinesManagerRegistry* get_cr_registry() = 0;
-    virtual int delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj) = 0;
-    virtual int delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, Completions* aio) = 0;
-    virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) = 0;
-    virtual int get_raw_chunk_size(const DoutPrefixProvider* dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) = 0;
 
     virtual int log_usage(const DoutPrefixProvider *dpp, std::map<rgw_user_bucket, RGWUsageBatch>& usage_info) = 0;
     virtual int log_op(const DoutPrefixProvider *dpp, std::string& oid, bufferlist& bl) = 0;
@@ -590,18 +592,11 @@ class Object {
         rgw_obj* target_obj{nullptr}; // XXX dang remove?
       } params;
 
-      struct Result {
-        rgw_raw_obj head_obj;
-
-        Result() : head_obj() {}
-      } result;
-
       virtual ~ReadOp() = default;
 
       virtual int prepare(optional_yield y, const DoutPrefixProvider* dpp) = 0;
       virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider* dpp) = 0;
       virtual int iterate(const DoutPrefixProvider* dpp, int64_t ofs, int64_t end, RGWGetDataCB* cb, optional_yield y) = 0;
-      virtual int get_manifest(const DoutPrefixProvider* dpp, RGWObjManifest **pmanifest, optional_yield y) = 0;
       virtual int get_attr(const DoutPrefixProvider* dpp, const char* name, bufferlist& dest, optional_yield y) = 0;
     };
 
@@ -744,7 +739,6 @@ class Object {
     virtual int copy_obj_data(RGWObjectCtx& rctx, Bucket* dest_bucket, Object* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider* dpp, optional_yield y) = 0;
     virtual bool is_expired() = 0;
     virtual void gen_rand_obj_instance_name() = 0;
-    virtual void raw_obj_to_obj(const rgw_raw_obj& raw_obj) = 0;
     virtual MPSerializer* get_serializer(const DoutPrefixProvider *dpp, const std::string& lock_name) = 0;
     virtual int transition(RGWObjectCtx& rctx,
                           Bucket* bucket,
@@ -759,6 +753,7 @@ class Object {
                                   uint64_t* alignment = nullptr) = 0;
     virtual void get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t* max_size) = 0;
     virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) = 0;
+    virtual int get_obj_layout(const DoutPrefixProvider *dpp, optional_yield y, Formatter* f, RGWObjectCtx* obj_ctx) = 0;
 
     Attrs& get_attrs(void) { return attrs; }
     const Attrs& get_attrs(void) const { return attrs; }
@@ -987,19 +982,6 @@ protected:
                               const ceph::real_time& mtime, const std::string& etag, const std::string& version) = 0;
 };
 
-class GCChain {
-protected:
-  Object* obj;
-
-  public:
-    GCChain(Object* _obj) : obj(_obj) {}
-    virtual ~GCChain() = default;
-
-    virtual void update(const DoutPrefixProvider *dpp, RGWObjManifest* manifest) = 0;
-    virtual int send(const std::string& tag) = 0;
-    virtual void delete_inline(const DoutPrefixProvider *dpp, const std::string& tag) = 0;
-};
-
 class Writer : public ObjectProcessor {
 protected:
   const DoutPrefixProvider* dpp;
index 4eda3c5cf228befa60ab3595ebb7865174d579eb..99dc875316e00b8bd59b9cc5a6fb7d9fff450996 100644 (file)
@@ -737,31 +737,6 @@ namespace rgw::sal {
     return 0;
   }
 
-  std::unique_ptr<GCChain> DBStore::get_gc_chain(rgw::sal::Object* obj)
-  {
-    return 0;
-  }
-
-  int DBStore::delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj)
-  {
-    return 0;
-  }
-
-  int DBStore::delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, Completions* aio)
-  {
-    return 0;
-  }
-
-  void DBStore::get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj)
-  {
-    return;
-  }
-
-  int DBStore::get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size)
-  {
-    return 0;
-  }
-
   int DBStore::log_usage(const DoutPrefixProvider *dpp, map<rgw_user_bucket, RGWUsageBatch>& usage_info)
   {
     return 0;
index e5d584f1f92f04774b5aa7a785a5b1f9b734ab25..01eef17246d60b5b53ff8f4ae79ec06cbacc0abb 100644 (file)
@@ -302,13 +302,8 @@ namespace rgw { namespace sal {
       virtual std::unique_ptr<Completions> get_completions(void) override;
       virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, struct req_state* s, 
           rgw::notify::EventType event_type, const std::string* object_name=nullptr) override;
-      virtual std::unique_ptr<GCChain> get_gc_chain(rgw::sal::Object* obj) override;
       virtual RGWLC* get_rgwlc(void) override { return NULL; }
       virtual RGWCoroutinesManagerRegistry* get_cr_registry() override { return NULL; }
-      virtual int delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj) override;
-      virtual int delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, Completions* aio) override;
-      virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) override;
-      virtual int get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) override;
 
       virtual int log_usage(const DoutPrefixProvider *dpp, map<rgw_user_bucket, RGWUsageBatch>& usage_info) override;
       virtual int log_op(const DoutPrefixProvider *dpp, std::string& oid, bufferlist& bl) override;
index a943d06842bf644236f75cf7741ab7712519be13..0b628855203dfbcd395c43ce50a777b805680f68 100644 (file)
@@ -1184,11 +1184,6 @@ std::unique_ptr<Notification> RadosStore::get_notification(rgw::sal::Object* obj
   return std::unique_ptr<Notification>(new RadosNotification(s, this, obj, s, event_type, object_name));
 }
 
-std::unique_ptr<GCChain> RadosStore::get_gc_chain(rgw::sal::Object* obj)
-{
-  return std::unique_ptr<GCChain>(new RadosGCChain(this, obj));
-}
-
 int RadosStore::delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj)
 {
   return rados->delete_raw_obj(dpp, obj);
@@ -1755,6 +1750,55 @@ bool RadosObject::placement_rules_match(rgw_placement_rule& r1, rgw_placement_ru
   return p1 == p2;
 }
 
+int RadosObject::get_obj_layout(const DoutPrefixProvider *dpp, optional_yield y, Formatter* f, RGWObjectCtx* obj_ctx)
+{
+  int ret;
+  RGWObjManifest *manifest{nullptr};
+  rgw_raw_obj head_obj;
+
+  RGWRados::Object op_target(store->getRados(), get_bucket()->get_info(),
+                            *obj_ctx, get_obj());
+  RGWRados::Object::Read parent_op(&op_target);
+  uint64_t obj_size;
+
+  parent_op.params.obj_size = &obj_size;
+  parent_op.params.attrs = &get_attrs();
+
+  ret = parent_op.prepare(y, dpp);
+  if (ret < 0) {
+    return ret;
+  }
+
+  head_obj = parent_op.state.head_obj;
+
+  ret = op_target.get_manifest(dpp, &manifest, y);
+  if (ret < 0) {
+    return ret;
+  }
+
+  ::encode_json("head", head_obj, f);
+  ::encode_json("manifest", *manifest, f);
+  f->open_array_section("data_location");
+  for (auto miter = manifest->obj_begin(dpp); miter != manifest->obj_end(dpp); ++miter) {
+    f->open_object_section("obj");
+    rgw_raw_obj raw_loc = miter.get_location().get_raw_obj(store);
+    uint64_t ofs = miter.get_ofs();
+    uint64_t left = manifest->get_obj_size() - ofs;
+    ::encode_json("ofs", miter.get_ofs(), f);
+    ::encode_json("loc", raw_loc, f);
+    ::encode_json("loc_ofs", miter.location_ofs(), f);
+    uint64_t loc_size = miter.get_stripe_size();
+    if (loc_size > left) {
+      loc_size = left;
+    }
+    ::encode_json("loc_size", loc_size, f);
+    f->close_section();
+  }
+  f->close_section();
+
+  return 0;
+}
+
 std::unique_ptr<Object::ReadOp> RadosObject::get_read_op(RGWObjectCtx* ctx)
 {
   return std::unique_ptr<Object::ReadOp>(new RadosObject::RadosReadOp(this, ctx));
@@ -1792,7 +1836,6 @@ int RadosObject::RadosReadOp::prepare(optional_yield y, const DoutPrefixProvider
 
   source->set_key(parent_op.state.obj.key);
   source->set_obj_size(obj_size);
-  result.head_obj = parent_op.state.head_obj;
 
   return ret;
 }
@@ -1802,12 +1845,6 @@ int RadosObject::RadosReadOp::read(int64_t ofs, int64_t end, bufferlist& bl, opt
   return parent_op.read(ofs, end, bl, y, dpp);
 }
 
-int RadosObject::RadosReadOp::get_manifest(const DoutPrefixProvider* dpp, RGWObjManifest **pmanifest,
-                                             optional_yield y)
-{
-  return op_target.get_manifest(dpp, pmanifest, y);
-}
-
 int RadosObject::RadosReadOp::get_attr(const DoutPrefixProvider* dpp, const char* name, bufferlist& dest, optional_yield y)
 {
   return parent_op.get_attr(dpp, name, dest, y);
@@ -2066,7 +2103,7 @@ int RadosMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct,
   std::unique_ptr<rgw::sal::Object> meta_obj = get_meta_obj();
   meta_obj->set_in_extra_data(true);
   meta_obj->set_hash_source(mp_obj.get_key());
-  std::unique_ptr<rgw::sal::GCChain> chain = store->get_gc_chain(meta_obj.get());
+  cls_rgw_obj_chain chain;
   list<rgw_obj_index_key> remove_objs;
   bool truncated;
   int marker = 0;
@@ -2093,12 +2130,13 @@ int RadosMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct,
         if (ret < 0 && ret != -ENOENT)
           return ret;
       } else {
-       chain->update(dpp, &obj_part->info.manifest);
+       auto target = meta_obj->get_obj();
+       store->getRados()->update_gc_chain(dpp, target, obj_part->info.manifest, &chain);
         RGWObjManifest::obj_iterator oiter = obj_part->info.manifest.obj_begin(dpp);
         if (oiter != obj_part->info.manifest.obj_end(dpp)) {
          std::unique_ptr<rgw::sal::Object> head = bucket->get_object(rgw_obj_key());
           rgw_raw_obj raw_head = oiter.get_location().get_raw_obj(store);
-         head->raw_obj_to_obj(raw_head);
+         dynamic_cast<rgw::sal::RadosObject*>(head.get())->raw_obj_to_obj(raw_head);
 
           rgw_obj_index_key key;
           head->get_key().get_index_key(&key);
@@ -2110,14 +2148,14 @@ int RadosMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct,
   } while (truncated);
 
   /* use upload id as tag and do it synchronously */
-  ret = chain->send(mp_obj.get_upload_id());
+  ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id());
   if (ret < 0) {
     ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl;
     if (ret == -ENOENT) {
       return -ERR_NO_SUCH_UPLOAD;
     }
     //Delete objects inline if send chain to gc fails
-    chain->delete_inline(dpp, mp_obj.get_upload_id());
+    store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id());
   }
 
   std::unique_ptr<rgw::sal::Object::DeleteOp> del_op = meta_obj->get_delete_op(obj_ctx);
@@ -2652,22 +2690,6 @@ int RadosNotification::publish_commit(const DoutPrefixProvider* dpp, uint64_t si
   return rgw::notify::publish_commit(obj, size, mtime, etag, version, event_type, res, dpp);
 }
 
-void RadosGCChain::update(const DoutPrefixProvider *dpp, RGWObjManifest* manifest)
-{
-  rgw_obj target = obj->get_obj();
-  store->getRados()->update_gc_chain(dpp, target, *manifest, &chain);
-}
-
-int RadosGCChain::send(const std::string& tag)
-{
-  return store->getRados()->send_chain_to_gc(chain, tag);
-}
-
-void RadosGCChain::delete_inline(const DoutPrefixProvider *dpp, const std::string& tag)
-{
-  store->getRados()->delete_objs_inline(dpp, chain, tag);
-}
-
 int RadosAtomicWriter::prepare(optional_yield y)
 {
   return processor.prepare(y);
index b2c8a46251dacf821506d351a9d6387eb5d98658..3a9db6e045bc2dd48eb4ec72b1e9b89338b0a009 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+
 // vim: ts=8 sw=2 smarttab ft=cpp
 
 /*
@@ -95,7 +95,6 @@ class RadosObject : public Object {
       virtual int prepare(optional_yield y, const DoutPrefixProvider* dpp) override;
       virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider* dpp) override;
       virtual int iterate(const DoutPrefixProvider* dpp, int64_t ofs, int64_t end, RGWGetDataCB* cb, optional_yield y) override;
-      virtual int get_manifest(const DoutPrefixProvider* dpp, RGWObjManifest **pmanifest, optional_yield y) override;
       virtual int get_attr(const DoutPrefixProvider* dpp, const char* name, bufferlist& dest, optional_yield y) override;
     };
 
@@ -189,7 +188,6 @@ class RadosObject : public Object {
     virtual int copy_obj_data(RGWObjectCtx& rctx, Bucket* dest_bucket, Object* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider* dpp, optional_yield y) override;
     virtual bool is_expired() override;
     virtual void gen_rand_obj_instance_name() override;
-    virtual void raw_obj_to_obj(const rgw_raw_obj& raw_obj) override;
     void get_raw_obj(rgw_raw_obj* raw_obj);
     virtual std::unique_ptr<Object> clone() override {
       return std::unique_ptr<Object>(new RadosObject(*this));
@@ -208,6 +206,7 @@ class RadosObject : public Object {
                                   uint64_t* alignment = nullptr) override;
     virtual void get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t* max_size) override;
     virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;
+    virtual int get_obj_layout(const DoutPrefixProvider *dpp, optional_yield y, Formatter* f, RGWObjectCtx* obj_ctx) override;
 
     /* Swift versioning */
     virtual int swift_versioning_restore(RGWObjectCtx* obj_ctx,
@@ -235,6 +234,9 @@ class RadosObject : public Object {
     virtual int omap_set_val_by_key(const DoutPrefixProvider *dpp, const std::string& key, bufferlist& val,
                                    bool must_exist, optional_yield y) override;
 
+    /* Internal to RadosStore */
+    void raw_obj_to_obj(const rgw_raw_obj& raw_obj);
+
   private:
     int read_attrs(const DoutPrefixProvider* dpp, RGWRados::Object::Read &read_op, optional_yield y, rgw_obj* target_obj = nullptr);
 };
@@ -424,13 +426,8 @@ class RadosStore : public Store {
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
     virtual std::unique_ptr<Completions> get_completions(void) override;
     virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, struct req_state* s, rgw::notify::EventType event_type, const std::string* object_name=nullptr) override;
-    virtual std::unique_ptr<GCChain> get_gc_chain(rgw::sal::Object* obj) override;
     virtual RGWLC* get_rgwlc(void) override { return rados->get_lc(); }
     virtual RGWCoroutinesManagerRegistry* get_cr_registry() override { return rados->get_cr_registry(); }
-    virtual int delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj) override;
-    virtual int delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, Completions* aio) override;
-    virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) override;
-    virtual int get_raw_chunk_size(const DoutPrefixProvider* dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) override;
 
     virtual int log_usage(const DoutPrefixProvider *dpp, std::map<rgw_user_bucket, RGWUsageBatch>& usage_info) override;
     virtual int log_op(const DoutPrefixProvider *dpp, std::string& oid, bufferlist& bl) override;
@@ -509,6 +506,10 @@ class RadosStore : public Store {
     /* Unique to RadosStore */
     int get_obj_head_ioctx(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
                           librados::IoCtx* ioctx);
+    int delete_raw_obj(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj);
+    int delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, Completions* aio);
+    void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj);
+    int get_raw_chunk_size(const DoutPrefixProvider* dpp, const rgw_raw_obj& obj, uint64_t* chunk_size);
 
     void setRados(RGWRados * st) { rados = st; }
     RGWRados* getRados(void) { return rados; }
@@ -638,20 +639,6 @@ class RadosNotification : public Notification {
                               const ceph::real_time& mtime, const std::string& etag, const std::string& version) override;
 };
 
-class RadosGCChain : public GCChain {
-protected:
-  RadosStore* store;
-  cls_rgw_obj_chain chain;
-
-  public:
-    RadosGCChain(RadosStore* _store, Object* _obj) : GCChain(_obj), store(_store) {}
-    ~RadosGCChain() = default;
-
-    virtual void update(const DoutPrefixProvider *dpp, RGWObjManifest* manifest) override;
-    virtual int send(const std::string& tag) override;
-    virtual void delete_inline(const DoutPrefixProvider *dpp, const std::string& tag) override;
-};
-
 class RadosAtomicWriter : public Writer {
 protected:
   rgw::sal::RadosStore* store;
index 89868c4f9da8aa3f791225d674920e8f87c15166..cc84a1778ceb61554c9842159f017f4a18006b9d 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "common/ceph_time.h"
 
-#include "rgw_rados.h"
 #include "rgw_common.h"
 
 using ceph::crypto::SHA1;