]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/govern.c
Yet another swap-out.
[libucw.git] / lib / sorter / govern.c
index 745f6b05b1cc95cce0371350959c02b2a4c00baf..524b0c905d739734ebe0aab372d67ebf1d336fd6 100644 (file)
@@ -199,6 +199,7 @@ sorter_multiway(struct sort_context *ctx, struct sort_bucket *b)
       cont = sorter_presort(ctx, b, p, (!part_cnt && join) ? join : p);
       part_cnt++;
       total_size += sbuck_size(p);
+      sbuck_swap_out(p);
     }
   while (cont);
   sorter_stop_timer(ctx, &ctx->total_pre_time);
@@ -212,7 +213,7 @@ sorter_multiway(struct sort_context *ctx, struct sort_bucket *b)
        {
          ASSERT(join->runs == 2);
          join->runs--;
-         sbuck_drop(b);
+         sbuck_drop(p);
        }
       else
        clist_insert_after(&p->n, list_pos);
@@ -255,6 +256,7 @@ sorter_multiway(struct sort_context *ctx, struct sort_bucket *b)
        }
       else
        {
+         sbuck_swap_out(out);
          clist_add_tail(&parts, &out->n);
          SORT_TRACE("Multi-way merge pass (%d ways, %s, %dMB/s)", n, F_BSIZE(out), sorter_speed(ctx, sbuck_size(out)));
        }