summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@users.noreply.github.com>2016-06-28 17:16:00 +0200
committerGitHub <noreply@github.com>2016-06-28 17:16:00 +0200
commit42567901c97a88e4b13dbcb3060ef448d7ae6e74 (patch)
tree4d88779abd69f29343a8d242823f44ea23ce8e5e
parentMerge pull request #9780 from theanalyst/rgw/create-bucket-cleanup (diff)
parentrgw: add comments for "is_truncated" (diff)
downloadceph-42567901c97a88e4b13dbcb3060ef448d7ae6e74.tar.xz
ceph-42567901c97a88e4b13dbcb3060ef448d7ae6e74.zip
Merge pull request #9796 from Yan-waller/yj-wip-rgwremoveuser
rgw: miscellaneous cleanups Reviewed-by: Casey Bodley <cbodley@redhat.com>
-rw-r--r--src/rgw/rgw_bucket.cc28
-rw-r--r--src/rgw/rgw_rados.cc7
2 files changed, 15 insertions, 20 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc
index 1e4f71df0a2..261b4aade2a 100644
--- a/src/rgw/rgw_bucket.cc
+++ b/src/rgw/rgw_bucket.cc
@@ -274,11 +274,7 @@ int rgw_unlink_bucket(RGWRados *store, const rgw_user& user_id, const string& te
}
ep.linked = false;
- ret = store->put_bucket_entrypoint_info(tenant_name, bucket_name, ep, false, ot, real_time(), &attrs);
- if (ret < 0)
- return ret;
-
- return ret;
+ return store->put_bucket_entrypoint_info(tenant_name, bucket_name, ep, false, ot, real_time(), &attrs);
}
int rgw_bucket_store_info(RGWRados *store, const string& bucket_name, bufferlist& bl, bool exclusive,
@@ -447,9 +443,7 @@ int rgw_remove_object(RGWRados *store, RGWBucketInfo& bucket_info, rgw_bucket& b
rgw_obj obj(bucket, key);
- int ret = store->delete_obj(rctx, bucket_info, obj, bucket_info.versioning_status());
-
- return ret;
+ return store->delete_obj(rctx, bucket_info, obj, bucket_info.versioning_status());
}
int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
@@ -479,23 +473,23 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
if (delete_children) {
int max = 1000;
- ret = list_op.list_objects(max, &objs, &common_prefixes, NULL);
- if (ret < 0)
- return ret;
- while (!objs.empty()) {
+ do {
+ objs.clear();
+
+ ret = list_op.list_objects(max, &objs, &common_prefixes, NULL);
+ if (ret < 0)
+ return ret;
+
std::vector<RGWObjEnt>::iterator it = objs.begin();
for (; it != objs.end(); ++it) {
ret = rgw_remove_object(store, info, bucket, (*it).key);
if (ret < 0)
return ret;
}
- objs.clear();
- ret = list_op.list_objects(max, &objs, &common_prefixes, NULL);
- if (ret < 0)
- return ret;
- }
+ } while (!objs.empty());
+
}
ret = rgw_bucket_sync_user_stats(store, bucket.tenant, bucket.name);
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 078fe9cd84c..66f23e1f531 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -4784,8 +4784,9 @@ int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset,
/**
* get listing of the objects in a bucket.
- * bucket: bucket to list contents of
+ *
* max: maximum number of results to return
+ * bucket: bucket to list contents of
* prefix: only return results that match this prefix
* delim: do not include results that match this string.
* Any skipped results will have the matching portion of their name
@@ -4793,8 +4794,8 @@ int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset,
* marker: if filled in, begin the listing with this object.
* end_marker: if filled in, end the listing with this object.
* result: the objects are put in here.
- * common_prefixes: if delim is filled in, any matching prefixes are placed
- * here.
+ * common_prefixes: if delim is filled in, any matching prefixes are placed here.
+ * is_truncated: if number of objects in the bucket is bigger than max, then truncated.
*/
int RGWRados::Bucket::List::list_objects(int max, vector<RGWObjEnt> *result,
map<string, bool> *common_prefixes,