+ }
+ }
+
+ return 0;
+}
+
+static void parse_tier_config_param(const string& s, map<string, string, ltstr_nocase>& out)
+{
+ int level = 0;
+ string cur_conf;
+ list<string> confs;
+ for (auto c : s) {
+ if (c == ',') {
+ if (level == 0) {
+ confs.push_back(cur_conf);
+ cur_conf.clear();
+ continue;
+ }
+ }
+ if (c == '{') {
+ ++level;
+ } else if (c == '}') {
+ --level;
+ }
+ cur_conf += c;
+ }
+ if (!cur_conf.empty()) {
+ confs.push_back(cur_conf);
+ }
+
+ for (auto c : confs) {
+ ssize_t pos = c.find("=");
+ if (pos < 0) {
+ out[c] = "";
+ } else {
+ out[c.substr(0, pos)] = c.substr(pos + 1);
+ }
+ }
+}
+
+static int check_pool_support_omap(const rgw_pool& pool)
+{
+ librados::IoCtx io_ctx;
+ int ret = store->getRados()->get_rados_handle()->ioctx_create(pool.to_str().c_str(), io_ctx);
+ if (ret < 0) {
+ // the pool may not exist at this moment, we have no way to check if it supports omap.
+ return 0;
+ }
+
+ ret = io_ctx.omap_clear("__omap_test_not_exist_oid__");
+ if (ret == -EOPNOTSUPP) {
+ io_ctx.close();
+ return ret;
+ }
+ io_ctx.close();
+ return 0;
+}
+
+int check_reshard_bucket_params(rgw::sal::RGWRadosStore *store,
+ const string& bucket_name,
+ const string& tenant,
+ const string& bucket_id,
+ bool num_shards_specified,
+ int num_shards,
+ int yes_i_really_mean_it,
+ rgw_bucket& bucket,
+ RGWBucketInfo& bucket_info,
+ map<string, bufferlist>& attrs)
+{
+ if (bucket_name.empty()) {
+ cerr << "ERROR: bucket not specified" << std::endl;
+ return -EINVAL;
+ }
+
+ if (!num_shards_specified) {
+ cerr << "ERROR: --num-shards not specified" << std::endl;
+ return -EINVAL;
+ }
+
+ if (num_shards > (int)store->getRados()->get_max_bucket_shards()) {
+ cerr << "ERROR: num_shards too high, max value: " << store->getRados()->get_max_bucket_shards() << std::endl;
+ return -EINVAL;
+ }
+
+ if (num_shards < 0) {
+ cerr << "ERROR: num_shards must be non-negative integer" << std::endl;
+ return -EINVAL;
+ }
+
+ int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
+ if (ret < 0) {
+ cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
+ return ret;
+ }
+
+ if (bucket_info.reshard_status != cls_rgw_reshard_status::NOT_RESHARDING) {
+ // if in_progress or done then we have an old BucketInfo
+ cerr << "ERROR: the bucket is currently undergoing resharding and "
+ "cannot be added to the reshard list at this time" << std::endl;
+ return -EBUSY;
+ }
+
+ int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1);
+
+ if (num_shards <= num_source_shards && !yes_i_really_mean_it) {
+ cerr << "num shards is less or equal to current shards count" << std::endl
+ << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl;
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int scan_totp(CephContext *cct, ceph::real_time& now, rados::cls::otp::otp_info_t& totp, vector<string>& pins,
+ time_t *pofs)
+{
+#define MAX_TOTP_SKEW_HOURS (24 * 7)
+ ceph_assert(pins.size() == 2);
+
+ time_t start_time = ceph::real_clock::to_time_t(now);
+ time_t time_ofs = 0, time_ofs_abs = 0;
+ time_t step_size = totp.step_size;
+ if (step_size == 0) {
+ step_size = OATH_TOTP_DEFAULT_TIME_STEP_SIZE;
+ }
+ uint32_t count = 0;
+ int sign = 1;
+
+ uint32_t max_skew = MAX_TOTP_SKEW_HOURS * 3600;
+
+ while (time_ofs_abs < max_skew) {
+ int rc = oath_totp_validate2(totp.seed_bin.c_str(), totp.seed_bin.length(),
+ start_time,
+ step_size,
+ time_ofs,
+ 1,
+ nullptr,
+ pins[0].c_str());
+ if (rc != OATH_INVALID_OTP) {
+ rc = oath_totp_validate2(totp.seed_bin.c_str(), totp.seed_bin.length(),
+ start_time,
+ step_size,
+ time_ofs - step_size, /* smaller time_ofs moves time forward */
+ 1,
+ nullptr,
+ pins[1].c_str());
+ if (rc != OATH_INVALID_OTP) {
+ *pofs = time_ofs - step_size + step_size * totp.window / 2;
+ ldout(cct, 20) << "found at time=" << start_time - time_ofs << " time_ofs=" << time_ofs << dendl;
+ return 0;
+ }
+ }
+ sign = -sign;
+ time_ofs_abs = (++count) * step_size;
+ time_ofs = sign * time_ofs_abs;
+ }
+
+ return -ENOENT;
+}
+
+static int trim_sync_error_log(int shard_id, const ceph::real_time& start_time,
+ const ceph::real_time& end_time,
+ const string& start_marker, const string& end_marker,
+ int delay_ms)
+{
+ auto oid = RGWSyncErrorLogger::get_shard_oid(RGW_SYNC_ERROR_LOG_SHARD_PREFIX,
+ shard_id);
+ // call cls_log_trim() until it returns -ENODATA
+ for (;;) {
+ int ret = store->svc()->cls->timelog.trim(oid, start_time, end_time,
+ start_marker, end_marker, nullptr,
+ null_yield);
+ if (ret == -ENODATA) {
+ return 0;
+ }
+ if (ret < 0) {
+ return ret;
+ }
+ if (delay_ms) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(delay_ms));
+ }
+ }
+ // unreachable
+}
+
+const string& get_tier_type(rgw::sal::RGWRadosStore *store) {
+ return store->svc()->zone->get_zone().tier_type;
+}
+
+static bool symmetrical_flow_opt(const string& opt)
+{
+ return (opt == "symmetrical" || opt == "symmetric");
+}
+
+static bool directional_flow_opt(const string& opt)
+{
+ return (opt == "directional" || opt == "direction");
+}
+
+template <class T>
+static bool require_opt(std::optional<T> opt, bool extra_check = true)
+{
+ if (!opt || !extra_check) {
+ return false;
+ }
+ return true;
+}
+
+template <class T>
+static bool require_non_empty_opt(std::optional<T> opt, bool extra_check = true)
+{
+ if (!opt || opt->empty() || !extra_check) {
+ return false;
+ }
+ return true;
+}
+
+template <class T>
+static void show_result(T& obj,
+ Formatter *formatter,
+ ostream& os)
+{
+ encode_json("obj", obj, formatter);
+
+ formatter->flush(cout);
+}
+
+void init_optional_bucket(std::optional<rgw_bucket>& opt_bucket,
+ std::optional<string>& opt_tenant,
+ std::optional<string>& opt_bucket_name,
+ std::optional<string>& opt_bucket_id)
+{
+ if (opt_tenant || opt_bucket_name || opt_bucket_id) {
+ opt_bucket.emplace();
+ if (opt_tenant) {
+ opt_bucket->tenant = *opt_tenant;
+ }
+ if (opt_bucket_name) {
+ opt_bucket->name = *opt_bucket_name;
+ }
+ if (opt_bucket_id) {
+ opt_bucket->bucket_id = *opt_bucket_id;
+ }
+ }
+}
+
+class SyncPolicyContext
+{
+ RGWZoneGroup zonegroup;
+
+ std::optional<rgw_bucket> bucket;
+ RGWBucketInfo bucket_info;
+ map<string, bufferlist> bucket_attrs;
+
+ rgw_sync_policy_info *policy{nullptr};
+
+ std::optional<rgw_user> owner;
+
+public:
+ SyncPolicyContext(const string& zonegroup_id,
+ const string& zonegroup_name,
+ std::optional<rgw_bucket> _bucket) : zonegroup(zonegroup_id, zonegroup_name),
+ bucket(_bucket) {}
+
+ int init() {
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ if (ret < 0) {
+ cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
+ return ret;
+ }
+
+ if (!bucket) {
+ policy = &zonegroup.sync_policy;
+ return 0;
+ }
+
+ ret = init_bucket(*bucket, bucket_info, *bucket, &bucket_attrs);
+ if (ret < 0) {
+ cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
+ return ret;
+ }
+
+ owner = bucket_info.owner;
+
+ if (!bucket_info.sync_policy) {
+ rgw_sync_policy_info new_policy;
+ bucket_info.set_sync_policy(std::move(new_policy));
+ }
+
+ policy = &(*bucket_info.sync_policy);
+
+ return 0;
+ }
+
+ int write_policy() {
+ if (!bucket) {
+ int ret = zonegroup.update();
+ if (ret < 0) {
+ cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
+ return 0;
+ }
+
+ int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs);
+ if (ret < 0) {
+ cerr << "failed to store bucket info: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
+
+ return 0;
+ }
+
+ rgw_sync_policy_info& get_policy() {
+ return *policy;
+ }
+
+ std::optional<rgw_user>& get_owner() {
+ return owner;
+ }
+};
+
+void resolve_zone_id_opt(std::optional<string>& zone_name, std::optional<rgw_zone_id>& zone_id)
+{
+ if (!zone_name || zone_id) {
+ return;
+ }
+ zone_id.emplace();
+ if (!store->svc()->zone->find_zone_id_by_name(*zone_name, &(*zone_id))) {
+ cerr << "WARNING: cannot find source zone id for name=" << *zone_name << std::endl;
+ zone_id = rgw_zone_id(*zone_name);
+ }
+}
+void resolve_zone_ids_opt(std::optional<vector<string> >& names, std::optional<vector<rgw_zone_id> >& ids)
+{
+ if (!names || ids) {
+ return;
+ }
+ ids.emplace();
+ for (auto& name : *names) {
+ rgw_zone_id zid;
+ if (!store->svc()->zone->find_zone_id_by_name(name, &zid)) {
+ cerr << "WARNING: cannot find source zone id for name=" << name << std::endl;
+ zid = rgw_zone_id(name);
+ }
+ ids->push_back(zid);
+ }
+}
+
+static vector<rgw_zone_id> zone_ids_from_str(const string& val)
+{
+ vector<rgw_zone_id> result;
+ vector<string> v;
+ get_str_vec(val, v);
+ for (auto& z : v) {
+ result.push_back(rgw_zone_id(z));
+ }
+ return result;
+}
+
+class JSONFormatter_PrettyZone : public JSONFormatter {
+ class Handler : public JSONEncodeFilter::Handler<rgw_zone_id> {
+ void encode_json(const char *name, const void *pval, ceph::Formatter *f) const override {
+ auto zone_id = *(static_cast<const rgw_zone_id *>(pval));
+ string zone_name;
+ RGWZone *zone;
+ if (store->svc()->zone->find_zone(zone_id, &zone)) {
+ zone_name = zone->name;
+ } else {
+ cerr << "WARNING: cannot find zone name for id=" << zone_id << std::endl;
+ zone_name = zone_id.id;
+ }
+
+ ::encode_json(name, zone_name, f);
+ }
+ } zone_id_type_handler;
+
+ JSONEncodeFilter encode_filter;
+public:
+ JSONFormatter_PrettyZone(bool pretty_format) : JSONFormatter(pretty_format) {
+ encode_filter.register_type(&zone_id_type_handler);
+ }
+
+ void *get_external_feature_handler(const std::string& feature) override {
+ if (feature != "JSONEncodeFilter") {
+ return nullptr;
+ }
+ return &encode_filter;
+ }
+};
+
+int main(int argc, const char **argv)
+{
+ vector<const char*> args;
+ argv_to_vec(argc, (const char **)argv, args);
+ if (args.empty()) {
+ cerr << argv[0] << ": -h or --help for usage" << std::endl;
+ exit(1);
+ }
+ if (ceph_argparse_need_usage(args)) {
+ usage();
+ exit(0);
+ }
+
+ auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
+ CODE_ENVIRONMENT_UTILITY, 0);
+
+ // for region -> zonegroup conversion (must happen before common_init_finish())
+ if (!g_conf()->rgw_region.empty() && g_conf()->rgw_zonegroup.empty()) {
+ g_conf().set_val_or_die("rgw_zonegroup", g_conf()->rgw_region.c_str());
+ }
+
+ common_init_finish(g_ceph_context);
+
+ rgw_user user_id;
+ string tenant;
+ rgw_user new_user_id;
+ std::string access_key, secret_key, user_email, display_name;
+ std::string bucket_name, pool_name, object;
+ rgw_pool pool;
+ std::string date, subuser, access, format;
+ std::string start_date, end_date;
+ std::string key_type_str;
+ std::string period_id, period_epoch, remote, url;
+ std::string master_zone;
+ std::string realm_name, realm_id, realm_new_name;
+ std::string zone_name, zone_id, zone_new_name;
+ std::string zonegroup_name, zonegroup_id, zonegroup_new_name;
+ std::string api_name;
+ std::string role_name, path, assume_role_doc, policy_name, perm_policy_doc, path_prefix;
+ std::string redirect_zone;
+ bool redirect_zone_set = false;
+ list<string> endpoints;
+ int tmp_int;
+ int sync_from_all_specified = false;
+ bool sync_from_all = false;
+ list<string> sync_from;
+ list<string> sync_from_rm;
+ int is_master_int;
+ int set_default = 0;
+ bool is_master = false;
+ bool is_master_set = false;
+ int read_only_int;
+ bool read_only = false;
+ int is_read_only_set = false;
+ int commit = false;
+ int staging = false;
+ int key_type = KEY_TYPE_UNDEFINED;
+ rgw_bucket bucket;
+ uint32_t perm_mask = 0;
+ RGWUserInfo info;
+ OPT opt_cmd = OPT::NO_CMD;
+ int gen_access_key = 0;
+ int gen_secret_key = 0;
+ bool set_perm = false;
+ bool set_temp_url_key = false;
+ map<int, string> temp_url_keys;
+ string bucket_id;
+ string new_bucket_name;
+ Formatter *formatter = NULL;
+ Formatter *zone_formatter = nullptr;
+ int purge_data = false;
+ int pretty_format = false;
+ int show_log_entries = true;
+ int show_log_sum = true;
+ int skip_zero_entries = false; // log show
+ int purge_keys = false;
+ int yes_i_really_mean_it = false;
+ int delete_child_objects = false;
+ int fix = false;
+ int remove_bad = false;
+ int check_head_obj_locator = false;
+ int max_buckets = -1;
+ bool max_buckets_specified = false;
+ map<string, bool> categories;
+ string caps;
+ int check_objects = false;
+ RGWUserAdminOpState user_op;
+ RGWBucketAdminOpState bucket_op;
+ string infile;
+ string metadata_key;
+ RGWObjVersionTracker objv_tracker;
+ string marker;
+ string start_marker;
+ string end_marker;
+ int max_entries = -1;
+ bool max_entries_specified = false;
+ int admin = false;
+ bool admin_specified = false;
+ int system = false;
+ bool system_specified = false;
+ int shard_id = -1;
+ bool specified_shard_id = false;
+ string client_id;
+ string op_id;
+ string op_mask_str;
+ string quota_scope;
+ string object_version;
+ string placement_id;
+ std::optional<string> opt_storage_class;
+ list<string> tags;
+ list<string> tags_add;
+ list<string> tags_rm;
+
+ int64_t max_objects = -1;
+ int64_t max_size = -1;
+ bool have_max_objects = false;
+ bool have_max_size = false;
+ int include_all = false;
+ int allow_unordered = false;
+
+ int sync_stats = false;
+ int reset_stats = false;
+ int bypass_gc = false;
+ int warnings_only = false;
+ int inconsistent_index = false;
+
+ int verbose = false;
+
+ int extra_info = false;
+
+ uint64_t min_rewrite_size = 4 * 1024 * 1024;
+ uint64_t max_rewrite_size = ULLONG_MAX;
+ uint64_t min_rewrite_stripe_size = 0;
+
+ BIIndexType bi_index_type = BIIndexType::Plain;
+
+ string job_id;
+ int num_shards = 0;
+ bool num_shards_specified = false;
+ std::optional<int> bucket_index_max_shards;
+ int max_concurrent_ios = 32;
+ uint64_t orphan_stale_secs = (24 * 3600);
+ int detail = false;
+
+ std::string val;
+ std::ostringstream errs;
+ string err;
+
+ string source_zone_name;
+ rgw_zone_id source_zone; /* zone id */
+
+ string tier_type;
+ bool tier_type_specified = false;
+
+ map<string, string, ltstr_nocase> tier_config_add;
+ map<string, string, ltstr_nocase> tier_config_rm;
+
+ boost::optional<string> index_pool;
+ boost::optional<string> data_pool;
+ boost::optional<string> data_extra_pool;
+ RGWBucketIndexType placement_index_type = RGWBIType_Normal;
+ bool index_type_specified = false;
+
+ boost::optional<std::string> compression_type;
+
+ string totp_serial;
+ string totp_seed;
+ string totp_seed_type = "hex";
+ vector<string> totp_pin;
+ int totp_seconds = 0;
+ int totp_window = 0;
+ int trim_delay_ms = 0;
+
+ string topic_name;
+ string sub_name;
+ string sub_oid_prefix;
+ string sub_dest_bucket;
+ string sub_push_endpoint;
+ string event_id;
+
+ std::optional<string> opt_group_id;
+ std::optional<string> opt_status;
+ std::optional<string> opt_flow_type;
+ std::optional<vector<string> > opt_zone_names;
+ std::optional<vector<rgw_zone_id> > opt_zone_ids;
+ std::optional<string> opt_flow_id;
+ std::optional<string> opt_source_zone_name;
+ std::optional<rgw_zone_id> opt_source_zone_id;
+ std::optional<string> opt_dest_zone_name;
+ std::optional<rgw_zone_id> opt_dest_zone_id;
+ std::optional<vector<string> > opt_source_zone_names;
+ std::optional<vector<rgw_zone_id> > opt_source_zone_ids;
+ std::optional<vector<string> > opt_dest_zone_names;
+ std::optional<vector<rgw_zone_id> > opt_dest_zone_ids;
+ std::optional<string> opt_pipe_id;
+ std::optional<rgw_bucket> opt_bucket;
+ std::optional<string> opt_tenant;
+ std::optional<string> opt_bucket_name;
+ std::optional<string> opt_bucket_id;
+ std::optional<rgw_bucket> opt_source_bucket;
+ std::optional<string> opt_source_tenant;
+ std::optional<string> opt_source_bucket_name;
+ std::optional<string> opt_source_bucket_id;
+ std::optional<rgw_bucket> opt_dest_bucket;
+ std::optional<string> opt_dest_tenant;
+ std::optional<string> opt_dest_bucket_name;
+ std::optional<string> opt_dest_bucket_id;
+ std::optional<string> opt_effective_zone_name;
+ std::optional<rgw_zone_id> opt_effective_zone_id;
+
+ std::optional<string> opt_prefix;
+ std::optional<string> opt_prefix_rm;
+
+ std::optional<int> opt_priority;
+ std::optional<string> opt_mode;
+ std::optional<rgw_user> opt_dest_owner;
+
+ rgw::notify::EventTypeList event_types;
+
+ SimpleCmd cmd(all_cmds, cmd_aliases);
+
+ for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
+ if (ceph_argparse_double_dash(args, i)) {
+ break;
+ } else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
+ user_id.from_str(val);
+ if (user_id.empty()) {
+ cerr << "no value for uid" << std::endl;
+ exit(1);
+ }
+ } else if (ceph_argparse_witharg(args, i, &val, "-i", "--new-uid", (char*)NULL)) {
+ new_user_id.from_str(val);
+ } else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
+ tenant = val;
+ opt_tenant = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--access-key", (char*)NULL)) {
+ access_key = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--subuser", (char*)NULL)) {
+ subuser = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--secret", "--secret-key", (char*)NULL)) {
+ secret_key = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "-e", "--email", (char*)NULL)) {
+ user_email = val;
+ user_op.user_email_specified=true;
+ } else if (ceph_argparse_witharg(args, i, &val, "-n", "--display-name", (char*)NULL)) {
+ display_name = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "-b", "--bucket", (char*)NULL)) {
+ bucket_name = val;
+ opt_bucket_name = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "-p", "--pool", (char*)NULL)) {
+ pool_name = val;
+ pool = rgw_pool(pool_name);
+ } else if (ceph_argparse_witharg(args, i, &val, "-o", "--object", (char*)NULL)) {
+ object = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--object-version", (char*)NULL)) {
+ object_version = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--client-id", (char*)NULL)) {
+ client_id = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--op-id", (char*)NULL)) {
+ op_id = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--op-mask", (char*)NULL)) {
+ op_mask_str = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--key-type", (char*)NULL)) {
+ key_type_str = val;
+ if (key_type_str.compare("swift") == 0) {
+ key_type = KEY_TYPE_SWIFT;
+ } else if (key_type_str.compare("s3") == 0) {
+ key_type = KEY_TYPE_S3;
+ } else {
+ cerr << "bad key type: " << key_type_str << std::endl;
+ exit(1);
+ }
+ } else if (ceph_argparse_witharg(args, i, &val, "--job-id", (char*)NULL)) {
+ job_id = val;
+ } else if (ceph_argparse_binary_flag(args, i, &gen_access_key, NULL, "--gen-access-key", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &gen_secret_key, NULL, "--gen-secret", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &show_log_entries, NULL, "--show-log-entries", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &show_log_sum, NULL, "--show-log-sum", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &skip_zero_entries, NULL, "--skip-zero-entries", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &admin, NULL, "--admin", (char*)NULL)) {
+ admin_specified = true;
+ } else if (ceph_argparse_binary_flag(args, i, &system, NULL, "--system", (char*)NULL)) {
+ system_specified = true;
+ } else if (ceph_argparse_binary_flag(args, i, &verbose, NULL, "--verbose", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &staging, NULL, "--staging", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_binary_flag(args, i, &commit, NULL, "--commit", (char*)NULL)) {
+ // do nothing
+ } else if (ceph_argparse_witharg(args, i, &val, "--min-rewrite-size", (char*)NULL)) {
+ min_rewrite_size = (uint64_t)atoll(val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "--max-rewrite-size", (char*)NULL)) {
+ max_rewrite_size = (uint64_t)atoll(val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "--min-rewrite-stripe-size", (char*)NULL)) {
+ min_rewrite_stripe_size = (uint64_t)atoll(val.c_str());
+ } else if (ceph_argparse_witharg(args, i, &val, "--max-buckets", (char*)NULL)) {
+ max_buckets = (int)strict_strtol(val.c_str(), 10, &err);
+ if (!err.empty()) {
+ cerr << "ERROR: failed to parse max buckets: " << err << std::endl;
+ return EINVAL;
+ }
+ max_buckets_specified = true;