Wiping means writing zero sectors to disk. Hence it's better to do this
before we discard, so that the zeroes we use to overwrite are properly
discarded. If we'd do it the other way round we'd discard the data and
then reallocte it just to write zeroes.
if (!p->allocated_to_area)
continue;
- if (!from_scratch) {
- r = context_discard_partition(context, p);
- if (r < 0)
- return r;
- }
-
r = context_wipe_partition(context, p);
if (r < 0)
return r;
if (!from_scratch) {
+ r = context_discard_partition(context, p);
+ if (r < 0)
+ return r;
+
r = context_discard_gap_after(context, p);
if (r < 0)
return r;