#include "rgw_gc.h"
#include "include/scope_guard.h"
+#include "rgw_tools.h"
#include "include/rados/librados.hpp"
#include "cls/rgw/cls_rgw_client.h"
#include "cls/refcount/cls_refcount_client.h"
return raw_obj;
}
-int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool, IoCtx& ioctx, bool create)
-{
- int r = rados->ioctx_create(pool.name.c_str(), ioctx);
- if (r == -ENOENT && create) {
- r = rados->pool_create(pool.name.c_str());
- if (r == -ERANGE) {
- dout(0)
- << __func__
- << " ERROR: librados::Rados::pool_create returned " << cpp_strerror(-r)
- << " (this can be due to a pool or placement group misconfiguration, e.g."
- << " pg_num < pgp_num or mon_max_pg_per_osd exceeded)"
- << dendl;
- }
- if (r < 0 && r != -EEXIST) {
- return r;
- }
-
- r = rados->ioctx_create(pool.name.c_str(), ioctx);
- if (r < 0) {
- return r;
- }
-
- r = ioctx.application_enable(pg_pool_t::APPLICATION_NAME_RGW, false);
- if (r < 0 && r != -EOPNOTSUPP) {
- return r;
- }
- } else if (r < 0) {
- return r;
- }
- if (!pool.ns.empty()) {
- ioctx.set_namespace(pool.ns);
- }
- return 0;
-}
-
void RGWObjVersionTracker::prepare_op_for_read(ObjectReadOperation *op)
{
obj_version *check_objv = version_for_check();
}
}
-int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool, librados::IoCtx& ioctx, bool create = false);
-
int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy);
static inline bool rgw_raw_obj_to_obj(const rgw_bucket& bucket, const rgw_raw_obj& raw_obj, rgw_obj *obj)
#include "common/errno.h"
#include "rgw_realm_watcher.h"
-#include "rgw_rados.h"
+#include "rgw_tools.h"
#include "rgw_zone.h"
#define dout_subsys ceph_subsys_rgw
#include "rgw_aio_throttle.h"
#include "rgw_compression.h"
#include "rgw_zone.h"
+#include "osd/osd_types.h"
#include "services/svc_sys_obj.h"
#include "services/svc_zone_utils.h"
static std::map<std::string, std::string>* ext_mime_map;
+int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
+ librados::IoCtx& ioctx, bool create)
+{
+ int r = rados->ioctx_create(pool.name.c_str(), ioctx);
+ if (r == -ENOENT && create) {
+ r = rados->pool_create(pool.name.c_str());
+ if (r == -ERANGE) {
+ dout(0)
+ << __func__
+ << " ERROR: librados::Rados::pool_create returned " << cpp_strerror(-r)
+ << " (this can be due to a pool or placement group misconfiguration, e.g."
+ << " pg_num < pgp_num or mon_max_pg_per_osd exceeded)"
+ << dendl;
+ }
+ if (r < 0 && r != -EEXIST) {
+ return r;
+ }
+
+ r = rados->ioctx_create(pool.name.c_str(), ioctx);
+ if (r < 0) {
+ return r;
+ }
+
+ r = ioctx.application_enable(pg_pool_t::APPLICATION_NAME_RGW, false);
+ if (r < 0 && r != -EOPNOTSUPP) {
+ return r;
+ }
+ } else if (r < 0) {
+ return r;
+ }
+ if (!pool.ns.empty()) {
+ ioctx.set_namespace(pool.ns);
+ }
+ return 0;
+}
+
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs)
{
struct obj_version;
+int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
+ librados::IoCtx& ioctx, bool create = false);
+
int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs = NULL);
int rgw_get_system_obj(RGWRados *rgwstore, RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl,
#define dout_subsys ceph_subsys_rgw
-static int init_ioctx(CephContext *cct, librados::Rados *rados, const rgw_pool& pool, librados::IoCtx& ioctx, bool create)
-{
- int r = rados->ioctx_create(pool.name.c_str(), ioctx);
- if (r == -ENOENT && create) {
- r = rados->pool_create(pool.name.c_str());
- if (r == -ERANGE) {
- ldout(cct, 0)
- << __func__
- << " ERROR: librados::Rados::pool_create returned " << cpp_strerror(-r)
- << " (this can be due to a pool or placement group misconfiguration, e.g."
- << " pg_num < pgp_num or mon_max_pg_per_osd exceeded)"
- << dendl;
- }
- if (r < 0 && r != -EEXIST) {
- return r;
- }
-
- r = rados->ioctx_create(pool.name.c_str(), ioctx);
- if (r < 0) {
- return r;
- }
-
- r = ioctx.application_enable(pg_pool_t::APPLICATION_NAME_RGW, false);
- if (r < 0 && r != -EOPNOTSUPP) {
- return r;
- }
- } else if (r < 0) {
- return r;
- }
- if (!pool.ns.empty()) {
- ioctx.set_namespace(pool.ns);
- }
- return 0;
-}
-
int RGWSI_RADOS::do_start()
{
int ret = rados.init_with_context(cct);
int RGWSI_RADOS::open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx)
{
constexpr bool create = true; // create the pool if it doesn't exist
- return init_ioctx(cct, get_rados_handle(), pool, io_ctx, create);
+ return rgw_init_ioctx(get_rados_handle(), pool, io_ctx, create);
}
int RGWSI_RADOS::pool_iterate(librados::IoCtx& io_ctx,