Removed bitmap object - don't need to build a bitmap.
[virt-df.git] / diskzip / diskzip.ml
index 75fffc6..8acabc4 100644 (file)
@@ -22,7 +22,6 @@ open Printf
 
 open Int63.Operators
 open Diskzip_gettext.Gettext
-module Bitmap = Diskzip_bitmap
 
 type output = File of string | Dir of string
 type extcompress = BZip2 | GZip | External of string
@@ -153,31 +152,6 @@ and go_compress extcompress images =
   (* Create ownership tables. *)
   let ownership = Diskimage.create_ownership machine in
 
-  (* Create ownership bitmap for each disk. *)
-  List.iter (
-    fun { Diskimage.d_name = name; d_dev = disk } ->
-      let blocksize = disk#blocksize in
-      let size = disk#size in          (* Size in bytes. *)
-      let nr_blocks = size /^ blocksize in (* Number of disk sectors. *)
-
-      if !Diskimage.debug then
-       eprintf "Creating bitmap for %s (%s sectors) ...\n%!"
-         disk#name (Int63.to_string nr_blocks);
-
-      (* Create an empty bitmap, one bit per sector. *)
-      let bitmap = Bitmap.create nr_blocks in
-
-      (* Get the lookup function for this disk. *)
-      let lookup = Diskimage.get_owners_lookup machine ownership disk in
-
-      (* Lookup each sector. *)
-      Bitmap.iter_set (
-       fun blk _ ->
-         let owners = lookup blk in
-         false
-      ) bitmap
-  ) machine.Diskimage.m_disks;
-
   (* Redirect output through external pipe if asked. *)
   (match extcompress with
    | None -> ()
@@ -199,7 +173,25 @@ and go_compress extcompress images =
         dup2 wfd stdout;
         close wfd
        )
-  )
+  );
+
+  (* Iterate over the disks. *)
+  List.iter (
+    fun { Diskimage.d_name = name; d_dev = disk } ->
+      let blocksize = disk#blocksize in
+      let size = disk#size in          (* Size in bytes. *)
+      let nr_blocks = size /^ blocksize in (* Number of disk sectors. *)
+
+      (* Get the lookup function for this disk. *)
+      let lookup = Diskimage.get_owners_lookup machine ownership disk in
+
+      (* Lookup each sector. *)
+      for blk = 0 to nr_blocks-1 do
+       ignore (lookup blk)
+      done
+  ) machine.Diskimage.m_disks;
+
+