From bbc74189d0f009c394afc11f0f17313461f9c76c Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Wed, 5 Jul 2023 17:05:06 -0400 Subject: [PATCH] rgw: a few minor code clean-ups Includes code documentation, formatting fixes, and removing an unimplemented function from an interface. Signed-off-by: J. Eric Ivancich --- src/rgw/driver/rados/rgw_rados.cc | 5 ++--- src/rgw/driver/rados/rgw_rados.h | 32 +++++++++++++++---------------- src/rgw/rgw_common.h | 4 ++-- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 8048f1bcab4..2743ff8a8dc 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -6695,18 +6695,17 @@ int RGWRados::Bucket::UpdateIndex::prepare(const DoutPrefixProvider *dpp, RGWMod int r = guard_reshard(dpp, obj, nullptr, [&](BucketShard *bs) -> int { return store->cls_obj_prepare_op(dpp, *bs, op, optag, obj, bilog_flags, y, zones_trace); }, y); - if (r < 0) { return r; } - prepared = true; + prepared = true; return 0; } int RGWRados::Bucket::UpdateIndex::complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch, uint64_t size, uint64_t accounted_size, - ceph::real_time& ut, const string& etag, + const ceph::real_time& ut, const string& etag, const string& content_type, const string& storage_class, bufferlist *acl_bl, RGWObjCategory category, diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index 47b6bc61710..4779ad59209 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -422,7 +422,6 @@ class RGWRados RGWObjManifest** pmanifest, optional_yield y); int update_placement_map(); - int store_bucket_info(RGWBucketInfo& info, std::map *pattrs, RGWObjVersionTracker *objv_tracker, bool exclusive); void remove_rgw_head_obj(librados::ObjectWriteOperation& op); void cls_obj_check_prefix_exist(librados::ObjectOperation& op, const std::string& prefix, bool fail_if_exist); @@ -781,7 +780,7 @@ public: int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp); int iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y); int get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y); - }; + }; // struct RGWRados::Object::Read struct Write { RGWRados::Object *target; @@ -827,7 +826,7 @@ public: const req_state* get_req_state() { return nullptr; /* XXX dang Only used by LTTng, and it handles null anyway */ } - }; + }; // struct RGWRados::Object::Write struct Delete { RGWRados::Object *target; @@ -861,7 +860,7 @@ public: explicit Delete(RGWRados::Object *_target) : target(_target) {} int delete_obj(optional_yield y, const DoutPrefixProvider *dpp); - }; + }; // struct RGWRados::Object::Delete struct Stat { RGWRados::Object *source; @@ -882,16 +881,15 @@ public: State() : completion(NULL), ret(0) {} } state; - explicit Stat(RGWRados::Object *_source) : source(_source) {} int stat_async(const DoutPrefixProvider *dpp); int wait(const DoutPrefixProvider *dpp); - int stat(); + private: int finish(const DoutPrefixProvider *dpp); - }; - }; + }; // struct RGWRados::Object::Stat + }; // class RGWRados::Object class Bucket { RGWRados *store; @@ -939,12 +937,14 @@ public: } int guard_reshard(const DoutPrefixProvider *dpp, const rgw_obj& obj_instance, BucketShard **pbs, std::function call, optional_yield y); + public: - UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), obj(_obj), - bs(target->get_store()) { - blind = (target->get_bucket_info().layout.current_index.layout.type == rgw::BucketIndexType::Indexless); - } + UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), + obj(_obj), + bs(target->get_store()) { + blind = target->get_bucket_info().layout.current_index.layout.type == rgw::BucketIndexType::Indexless; + } int get_bucket_shard(BucketShard **pbs, const DoutPrefixProvider *dpp, optional_yield y) { if (!bs_initialized) { @@ -967,7 +967,7 @@ public: int prepare(const DoutPrefixProvider *dpp, RGWModifyOp, const std::string *write_tag, optional_yield y); int complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch, uint64_t size, - uint64_t accounted_size, ceph::real_time& ut, + uint64_t accounted_size, const ceph::real_time& ut, const std::string& etag, const std::string& content_type, const std::string& storage_class, bufferlist *acl_bl, RGWObjCategory category, @@ -987,7 +987,7 @@ public: const std::string *get_optag() { return &optag; } bool is_prepared() { return prepared; } - }; // class UpdateIndex + }; // class RGWRados::Bucket::UpdateIndex class List { protected: @@ -1051,8 +1051,8 @@ public: rgw_obj_key& get_next_marker() { return next_marker; } - }; // class List - }; // class Bucket + }; // class RGWRados::Bucket::List + }; // class RGWRados::Bucket int on_last_entry_in_listing(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 67333be9988..c1fe2ee2abe 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -75,8 +75,8 @@ using ceph::crypto::MD5; #define RGW_SYS_PARAM_PREFIX "rgwx-" #define RGW_ATTR_ACL RGW_ATTR_PREFIX "acl" -#define RGW_ATTR_RATELIMIT RGW_ATTR_PREFIX "ratelimit" -#define RGW_ATTR_LC RGW_ATTR_PREFIX "lc" +#define RGW_ATTR_RATELIMIT RGW_ATTR_PREFIX "ratelimit" +#define RGW_ATTR_LC RGW_ATTR_PREFIX "lc" #define RGW_ATTR_CORS RGW_ATTR_PREFIX "cors" #define RGW_ATTR_ETAG RGW_ATTR_PREFIX "etag" #define RGW_ATTR_BUCKETS RGW_ATTR_PREFIX "buckets" -- 2.39.5