From: Kefu Chai Date: Wed, 16 Jul 2025 08:45:55 +0000 (+0800) Subject: rgw: pass list_parts_each_t function by lvalue reference X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=917a2dde418d519dfd8105177725ccedab3e82fe;p=ceph.git rgw: pass list_parts_each_t function by lvalue reference list_parts_each_t is an alias of `fu2::unique_function`, which is a non copyable function. so in theory, we cannot copy it. and in the recent version of function2, unique_function is not coyable anymore. if we bump up the vendored function2.hpp, the build breaks. so, in this change, we change the virtual function of `Object::list_parts()` from passing the plain value of `list_parts_each_t` to rvalue reference `list_parts_each_t` so that we don't need to copy this non-copyable function. this allows us to keep in sync with upstream function2, and to be symantically correct regarding to the unique-ness of the functor. Signed-off-by: Kefu Chai --- diff --git a/src/rgw/driver/posix/rgw_sal_posix.cc b/src/rgw/driver/posix/rgw_sal_posix.cc index d72b38ee45bb8..e4bb6d0a07f71 100644 --- a/src/rgw/driver/posix/rgw_sal_posix.cc +++ b/src/rgw/driver/posix/rgw_sal_posix.cc @@ -2911,7 +2911,7 @@ int POSIXObject::copy_object(const ACLOwner& owner, int POSIXObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) { return -EOPNOTSUPP; diff --git a/src/rgw/driver/posix/rgw_sal_posix.h b/src/rgw/driver/posix/rgw_sal_posix.h index fdf2b9d510fe8..1d728d640cf1f 100644 --- a/src/rgw/driver/posix/rgw_sal_posix.h +++ b/src/rgw/driver/posix/rgw_sal_posix.h @@ -661,7 +661,7 @@ public: /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */ virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) override; bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y, diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index efdfdeccc7941..0fa996b51d36d 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -2677,7 +2677,7 @@ bool RadosObject::is_sync_completed(const DoutPrefixProvider* dpp, int RadosObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) { int ret{0}; diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h index d51d968aa6158..92bb1547493c2 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.h +++ b/src/rgw/driver/rados/rgw_sal_rados.h @@ -609,7 +609,7 @@ class RadosObject : public StoreObject { /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */ virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) override; virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) override; diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 3f9fc829a3e9b..3f24f1110d320 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1303,7 +1303,7 @@ class Object { /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */ virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) = 0; /** Get the cached attributes for this object */ diff --git a/src/rgw/rgw_sal_dbstore.cc b/src/rgw/rgw_sal_dbstore.cc index e1bbe2cdf891a..8e2b912651db0 100644 --- a/src/rgw/rgw_sal_dbstore.cc +++ b/src/rgw/rgw_sal_dbstore.cc @@ -492,7 +492,7 @@ namespace rgw::sal { int DBObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) { return -EOPNOTSUPP; diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h index 68a94742ad3a5..ae71796903a0e 100644 --- a/src/rgw/rgw_sal_dbstore.h +++ b/src/rgw/rgw_sal_dbstore.h @@ -563,7 +563,7 @@ protected: /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */ virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) override; bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y, diff --git a/src/rgw/rgw_sal_filter.cc b/src/rgw/rgw_sal_filter.cc index 62421bb983272..9097748bfe671 100644 --- a/src/rgw/rgw_sal_filter.cc +++ b/src/rgw/rgw_sal_filter.cc @@ -1064,12 +1064,12 @@ RGWAccessControlPolicy& FilterObject::get_acl() int FilterObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) { return next->list_parts(dpp, cct, max_parts, marker, next_marker, truncated, - sal::Object::list_parts_each_t(each_func), + std::move(each_func), y); } diff --git a/src/rgw/rgw_sal_filter.h b/src/rgw/rgw_sal_filter.h index 526f7ce2badee..e67b2526738b0 100644 --- a/src/rgw/rgw_sal_filter.h +++ b/src/rgw/rgw_sal_filter.h @@ -800,7 +800,7 @@ public: /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */ virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, int max_parts, int marker, int* next_marker, - bool* truncated, list_parts_each_t each_func, + bool* truncated, list_parts_each_t&& each_func, optional_yield y) override; virtual int load_obj_state(const DoutPrefixProvider *dpp, optional_yield y,