]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: remove_dir use collection_list_partial
authorSamuel Just <sam.just@inktank.com>
Fri, 10 May 2013 00:17:35 +0000 (17:17 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 10 May 2013 05:23:42 +0000 (22:23 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index 14f88d5e7fc22f5d36209d34d4ff1e783a1549a1..e7e52e431d56f1fea1176e69c89efac4d1f76c78 100644 (file)
@@ -2801,30 +2801,41 @@ bool remove_dir(
   ObjectStore::Sequencer *osr,
   coll_t coll, DeletingStateRef dstate) {
   vector<hobject_t> olist;
-  store->collection_list(coll, olist);
   int64_t num = 0;
   ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  for (vector<hobject_t>::iterator i = olist.begin();
-       i != olist.end();
-       ++i, ++num) {
-    OSDriver::OSTransaction _t(osdriver->get_transaction(t));
-    int r = mapper->remove_oid(*i, &_t);
-    if (r != 0 && r != -ENOENT) {
-      assert(0);
-    }
-    t->remove(coll, *i);
-    if (num >= g_conf->osd_target_transaction_size) {
-      store->apply_transaction(osr, *t);
-      delete t;
-      if (!dstate->check_canceled()) {
-       // canceled!
-       return false;
+  hobject_t next;
+  while (!next.is_max()) {
+    store->collection_list_partial(
+      coll,
+      next,
+      store->get_ideal_list_min(),
+      store->get_ideal_list_max(),
+      0,
+      &olist,
+      &next);
+    for (vector<hobject_t>::iterator i = olist.begin();
+        i != olist.end();
+        ++i, ++num) {
+      OSDriver::OSTransaction _t(osdriver->get_transaction(t));
+      int r = mapper->remove_oid(*i, &_t);
+      if (r != 0 && r != -ENOENT) {
+       assert(0);
+      }
+      t->remove(coll, *i);
+      if (num >= g_conf->osd_target_transaction_size) {
+       store->apply_transaction(osr, *t);
+       delete t;
+       if (!dstate->check_canceled()) {
+         // canceled!
+         return false;
+       }
+       t = new ObjectStore::Transaction;
+       num = 0;
       }
-      t = new ObjectStore::Transaction;
-      num = 0;
     }
+    olist.clear();
   }
-  store->apply_transaction(*t);
+  store->apply_transaction(osr, *t);
   delete t;
   return true;
 }