mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
Merge pull request #19897 from cbodley/wip-rgw-put-system-obj
rgw: rgw_put_system_obj takes bufferlist Reviewed-by: Matt Benjamin <mbenjami@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
commit
36f1dc0f04
@ -233,10 +233,10 @@ public:
|
||||
RGWObjVersionTracker *objv_tracker);
|
||||
int put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, real_time *mtime,
|
||||
map<std::string, bufferlist>& attrs, int flags,
|
||||
bufferlist& data,
|
||||
const bufferlist& data,
|
||||
RGWObjVersionTracker *objv_tracker,
|
||||
real_time set_mtime) override;
|
||||
int put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl, off_t ofs, bool exclusive,
|
||||
int put_system_obj_data(void *ctx, rgw_raw_obj& obj, const bufferlist& bl, off_t ofs, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker = nullptr) override;
|
||||
|
||||
int get_system_obj(RGWObjectCtx& obj_ctx, RGWRados::SystemObject::Read::GetObjState& read_state,
|
||||
@ -393,7 +393,7 @@ int RGWCache<T>::system_obj_set_attrs(void *ctx, rgw_raw_obj& obj,
|
||||
template <class T>
|
||||
int RGWCache<T>::put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, real_time *mtime,
|
||||
map<std::string, bufferlist>& attrs, int flags,
|
||||
bufferlist& data,
|
||||
const bufferlist& data,
|
||||
RGWObjVersionTracker *objv_tracker,
|
||||
real_time set_mtime)
|
||||
{
|
||||
@ -431,7 +431,7 @@ int RGWCache<T>::put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, real_time
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int RGWCache<T>::put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& data, off_t ofs, bool exclusive,
|
||||
int RGWCache<T>::put_system_obj_data(void *ctx, rgw_raw_obj& obj, const bufferlist& data, off_t ofs, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker)
|
||||
{
|
||||
rgw_pool pool;
|
||||
|
@ -383,7 +383,7 @@ int write_history(RGWRados *store, const RGWMetadataLogHistory& state,
|
||||
|
||||
auto& pool = store->get_zone_params().log_pool;
|
||||
const auto& oid = RGWMetadataLogHistory::oid;
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
|
||||
return rgw_put_system_obj(store, pool, oid, bl,
|
||||
exclusive, objv_tracker, real_time{});
|
||||
}
|
||||
|
||||
@ -1006,8 +1006,7 @@ int RGWMetadataManager::store_in_heap(RGWMetadataHandler *handler, const string&
|
||||
otracker.write_version = objv_tracker->write_version;
|
||||
string oid = heap_oid(handler, key, objv_tracker->write_version);
|
||||
int ret = rgw_put_system_obj(store, heap_pool, oid,
|
||||
bl.c_str(), bl.length(), false,
|
||||
&otracker, mtime, pattrs);
|
||||
bl, false, &otracker, mtime, pattrs);
|
||||
if (ret < 0) {
|
||||
ldout(store->ctx(), 0) << "ERROR: rgw_put_system_obj() oid=" << oid << " returned ret=" << ret << dendl;
|
||||
return ret;
|
||||
@ -1059,8 +1058,7 @@ int RGWMetadataManager::put_entry(RGWMetadataHandler *handler, const string& key
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = rgw_put_system_obj(store, pool, oid,
|
||||
bl.c_str(), bl.length(), exclusive,
|
||||
ret = rgw_put_system_obj(store, pool, oid, bl, exclusive,
|
||||
objv_tracker, mtime, pattrs);
|
||||
|
||||
if (ret < 0) {
|
||||
|
@ -608,7 +608,7 @@ int RGWSystemMetaObj::set_as_default(bool exclusive)
|
||||
|
||||
encode(default_info, bl);
|
||||
|
||||
int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
|
||||
int ret = rgw_put_system_obj(store, pool, oid, bl,
|
||||
exclusive, NULL, real_time(), NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -697,7 +697,7 @@ int RGWSystemMetaObj::store_name(bool exclusive)
|
||||
bufferlist bl;
|
||||
using ceph::encode;
|
||||
encode(nameToId, bl);
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
|
||||
return rgw_put_system_obj(store, pool, oid, bl, exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
int RGWSystemMetaObj::rename(const string& new_name)
|
||||
@ -814,7 +814,7 @@ int RGWSystemMetaObj::store_info(bool exclusive)
|
||||
bufferlist bl;
|
||||
using ceph::encode;
|
||||
encode(*this, bl);
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
|
||||
return rgw_put_system_obj(store, pool, oid, bl, exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
int RGWSystemMetaObj::write(bool exclusive)
|
||||
@ -898,7 +898,8 @@ int RGWRealm::create_control(bool exclusive)
|
||||
{
|
||||
auto pool = rgw_pool{get_pool(cct)};
|
||||
auto oid = get_control_oid();
|
||||
return rgw_put_system_obj(store, pool, oid, nullptr, 0, exclusive,
|
||||
bufferlist bl;
|
||||
return rgw_put_system_obj(store, pool, oid, bl, exclusive,
|
||||
nullptr, real_time(), nullptr);
|
||||
}
|
||||
|
||||
@ -1050,7 +1051,7 @@ int RGWPeriodConfig::write(RGWRados *store, const std::string& realm_id)
|
||||
bufferlist bl;
|
||||
using ceph::encode;
|
||||
encode(*this, bl);
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
|
||||
return rgw_put_system_obj(store, pool, oid, bl,
|
||||
false, nullptr, real_time(), nullptr);
|
||||
}
|
||||
|
||||
@ -1234,7 +1235,7 @@ int RGWPeriod::set_latest_epoch(epoch_t epoch, bool exclusive,
|
||||
using ceph::encode;
|
||||
encode(info, bl);
|
||||
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
|
||||
return rgw_put_system_obj(store, pool, oid, bl,
|
||||
exclusive, objv, real_time(), nullptr);
|
||||
}
|
||||
|
||||
@ -1371,7 +1372,7 @@ int RGWPeriod::store_info(bool exclusive)
|
||||
using ceph::encode;
|
||||
encode(*this, bl);
|
||||
|
||||
return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
|
||||
return rgw_put_system_obj(store, pool, oid, bl,
|
||||
exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
@ -4155,7 +4156,7 @@ int RGWRados::replace_region_with_zonegroup()
|
||||
}
|
||||
|
||||
/* mark as converted */
|
||||
ret = rgw_put_system_obj(this, pool, oid, bl.c_str(), bl.length(),
|
||||
ret = rgw_put_system_obj(this, pool, oid, bl,
|
||||
true, NULL, real_time(), NULL);
|
||||
if (ret < 0 ) {
|
||||
ldout(cct, 0) << __func__ << " failed to mark cluster as converted: ret "<< ret << " " << cpp_strerror(-ret)
|
||||
@ -7123,7 +7124,7 @@ int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size,
|
||||
/** Write/overwrite a system object. */
|
||||
int RGWRados::put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, real_time *mtime,
|
||||
map<std::string, bufferlist>& attrs, int flags,
|
||||
bufferlist& data,
|
||||
const bufferlist& data,
|
||||
RGWObjVersionTracker *objv_tracker,
|
||||
real_time set_mtime /* 0 for don't set */)
|
||||
{
|
||||
@ -7184,7 +7185,7 @@ int RGWRados::put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, real_time *mt
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RGWRados::put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
|
||||
int RGWRados::put_system_obj_data(void *ctx, rgw_raw_obj& obj, const bufferlist& bl,
|
||||
off_t ofs, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker)
|
||||
{
|
||||
|
@ -3040,26 +3040,24 @@ public:
|
||||
/** Write/overwrite an object to the bucket storage. */
|
||||
virtual int put_system_obj_impl(rgw_raw_obj& obj, uint64_t size, ceph::real_time *mtime,
|
||||
map<std::string, bufferlist>& attrs, int flags,
|
||||
bufferlist& data,
|
||||
const bufferlist& data,
|
||||
RGWObjVersionTracker *objv_tracker,
|
||||
ceph::real_time set_mtime /* 0 for don't set */);
|
||||
|
||||
virtual int put_system_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
|
||||
off_t ofs, bool exclusive,
|
||||
virtual int put_system_obj_data(void *ctx, rgw_raw_obj& obj,
|
||||
const bufferlist& bl, off_t ofs, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker = nullptr);
|
||||
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,
|
||||
int put_system_obj(void *ctx, rgw_raw_obj& obj, const bufferlist& data, bool exclusive,
|
||||
ceph::real_time *mtime, map<std::string, bufferlist>& attrs, RGWObjVersionTracker *objv_tracker,
|
||||
ceph::real_time set_mtime) {
|
||||
bufferlist bl;
|
||||
bl.append(data, len);
|
||||
int flags = PUT_OBJ_CREATE;
|
||||
if (exclusive)
|
||||
flags |= PUT_OBJ_EXCL;
|
||||
|
||||
return put_system_obj_impl(obj, len, mtime, attrs, flags, bl, objv_tracker, set_mtime);
|
||||
return put_system_obj_impl(obj, data.length(), mtime, attrs, flags, data, objv_tracker, set_mtime);
|
||||
}
|
||||
int aio_wait(void *handle);
|
||||
bool aio_completed(void *handle);
|
||||
|
@ -31,7 +31,7 @@ int RGWRole::store_info(bool exclusive)
|
||||
bufferlist bl;
|
||||
encode(*this, bl);
|
||||
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
|
||||
bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
|
||||
bl, exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
int RGWRole::store_name(bool exclusive)
|
||||
@ -45,15 +45,16 @@ int RGWRole::store_name(bool exclusive)
|
||||
using ceph::encode;
|
||||
encode(nameToId, bl);
|
||||
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
|
||||
bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
|
||||
bl, exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
int RGWRole::store_path(bool exclusive)
|
||||
{
|
||||
string oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
|
||||
|
||||
bufferlist bl;
|
||||
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
|
||||
NULL, 0, exclusive, NULL, real_time(), NULL);
|
||||
bl, exclusive, NULL, real_time(), NULL);
|
||||
}
|
||||
|
||||
int RGWRole::create(bool exclusive)
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
static std::map<std::string, std::string>* ext_mime_map;
|
||||
|
||||
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const char *data, size_t size, bool exclusive,
|
||||
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const bufferlist& data, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs)
|
||||
{
|
||||
map<string,bufferlist> no_attrs;
|
||||
@ -27,12 +27,12 @@ int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& o
|
||||
|
||||
rgw_raw_obj obj(pool, oid);
|
||||
|
||||
int ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
|
||||
int ret = rgwstore->put_system_obj(NULL, obj, data, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
|
||||
|
||||
if (ret == -ENOENT) {
|
||||
ret = rgwstore->create_pool(pool);
|
||||
if (ret >= 0)
|
||||
ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
|
||||
ret = rgwstore->put_system_obj(NULL, obj, data, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -16,7 +16,7 @@ struct RGWObjVersionTracker;
|
||||
|
||||
struct obj_version;
|
||||
|
||||
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const char *data, size_t size, bool exclusive,
|
||||
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const bufferlist& data, bool exclusive,
|
||||
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs = NULL);
|
||||
int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl,
|
||||
RGWObjVersionTracker *objv_tracker, real_time *pmtime, map<string, bufferlist> *pattrs = NULL,
|
||||
|
@ -209,7 +209,7 @@ int rgw_store_user_info(RGWRados *store,
|
||||
if (!old_info ||
|
||||
old_info->user_email.compare(info.user_email) != 0) { /* only if new index changed */
|
||||
ret = rgw_put_system_obj(store, store->get_zone_params().user_email_pool, info.user_email,
|
||||
link_bl.c_str(), link_bl.length(), exclusive, NULL, real_time());
|
||||
link_bl, exclusive, NULL, real_time());
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@ -223,8 +223,7 @@ int rgw_store_user_info(RGWRados *store,
|
||||
continue;
|
||||
|
||||
ret = rgw_put_system_obj(store, store->get_zone_params().user_keys_pool, k.id,
|
||||
link_bl.c_str(), link_bl.length(), exclusive,
|
||||
NULL, real_time());
|
||||
link_bl, exclusive, NULL, real_time());
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@ -237,8 +236,7 @@ int rgw_store_user_info(RGWRados *store,
|
||||
continue;
|
||||
|
||||
ret = rgw_put_system_obj(store, store->get_zone_params().user_swift_pool, k.id,
|
||||
link_bl.c_str(), link_bl.length(), exclusive,
|
||||
NULL, real_time());
|
||||
link_bl, exclusive, NULL, real_time());
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user