diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 260e9903..3f16662a 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1542,14 +1542,13 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) return; lseek_to_cluster(rl->lcn); + if (opt.metadata_image && wipe) + gap_to_cluster(rl->lcn - image->current_lcn); if (opt.metadata_image ? wipe : !wipe) { - if (opt.metadata_image) - gap_to_cluster(rl->lcn - image->current_lcn); /* FIXME: this could give pretty suboptimal performance */ for (i = 0; i < len; i++) copy_cluster(opt.rescue, rl->lcn + i, rl->lcn + i); - if (opt.metadata_image) - image->current_lcn = rl->lcn + len; + image->current_lcn = rl->lcn + len; } } @@ -1917,16 +1916,14 @@ out: compare_bitmaps(&lcn_bitmap, TRUE); walk->image->current_lcn = 0; } - if (opt.metadata_image ? wipe : !wipe) { /* also get the backup bootsector */ - nr_clusters = vol->nr_clusters; - lseek_to_cluster(nr_clusters); - if (opt.metadata_image && wipe) - gap_to_cluster(nr_clusters - - walk->image->current_lcn); + nr_clusters = vol->nr_clusters; + lseek_to_cluster(nr_clusters); + if (opt.metadata_image && wipe) + gap_to_cluster(nr_clusters - walk->image->current_lcn); + if (opt.metadata_image ? wipe : !wipe) copy_cluster(opt.rescue, nr_clusters, nr_clusters); - walk->image->current_lcn = nr_clusters; - } + walk->image->current_lcn = nr_clusters; /* Not counted, for compatibility with older versions */ if (!opt.metadata_image) walk->image->inuse++;