]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: just make the code more concise
authorYan Jun <yan.jun8@zte.com.cn>
Fri, 17 Jun 2016 07:05:29 +0000 (15:05 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Fri, 17 Jun 2016 07:05:29 +0000 (15:05 +0800)
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
src/rgw/rgw_bucket.cc

index f8399b79f3770279eb4adf9c468f86a1de081244..f2250be99881acba74bf5ae93777d98704663f5b 100644 (file)
@@ -479,23 +479,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);