package qcow-types

  1. Overview
  2. Docs
Minimal set of dependencies for qcow-stream, shared with qcow

Install

Dune Dependency

Authors

Maintainers

Sources

qcow-0.12.1.tbz
sha256=c799f3c2eda00b345d37ccd759bcd7b8be8744216b77a38883ff4cd99727ae37
sha512=2160598f460240f9580991e7f7d69e3ef83a2e6ec62268b711840d359cd303d4e14a5d65d89ceb82a6f77b434d06a01af9daa7780808a885f3307909c11dcfd8

doc/qcow-types/Qcow_cluster_map/index.html

Module Qcow_cluster_mapSource

Sourcetype t

A cluster map which describes cluster usage in the file. The cluster map tracks which clusters are free, and which are used, and where the references are.

Sourcetype move_state =
  1. | Copying
    (*

    a background copy is in progress. If this cluster is modified then the copy should be aborted.

    *)
  2. | Copied
    (*

    contents of this cluster have been copied once to another cluster. If this cluster is modified then the copy should be aborted.

    *)
  3. | Flushed
    (*

    contents of this cluster have been copied and flushed to disk: it is now safe to rewrite the pointer. If this cluster is modified then the copy should be aborted.

    *)
  4. | Referenced
    (*

    the reference has been rewritten; it is now safe to write to this cluster again. On the next flush, the copy is complete and the original block can be recycled.

    *)

Describes the state of a block move

Sourcetype reference = Qcow_types.Cluster.t * int
Sourcemodule Move : sig ... end
Sourcetype move = {
  1. move : Move.t;
  2. state : move_state;
}

describes the state of an in-progress block move

Sourceval string_of_move : move -> string
Sourcetype cluster_state =
  1. | Junk
  2. | Erased
  3. | Available
  4. | Copies
  5. | Roots
    (*

    The state of a cluster

    *)
Sourceval set_cluster_state : t -> Qcow_types.Cluster.IntervalSet.t -> cluster_state -> cluster_state -> unit

Update the state of a cluster

Sourcemodule type MutableSet = sig ... end
Sourceval zero : t

A cluster map for a zero-length disk

Sourceval make : free:Qcow_bitmap.t -> refs:reference Qcow_types.Cluster.Map.t -> cache:Qcow_cache.t -> first_movable_cluster:Qcow_types.Cluster.t -> runtime_asserts:bool -> id:string option -> cluster_size:int -> t

Given a set of free clusters, and the first cluster which can be moved (i.e. that isn't fixed header), construct an empty cluster map.

Sourceval total_used : t -> int64

Return the number of tracked used clusters

Sourceval total_free : t -> int64

Return the number of tracked free clusters

Sourceval resize : t -> Qcow_types.Cluster.t -> unit

resize t new_size_clusters is called when the file is to be resized.

Sourceval add : t -> reference -> Qcow_types.Cluster.t -> unit

add t ref cluster marks cluster as in-use and notes the reference from reference.

Sourceval remove : t -> Qcow_types.Cluster.t -> unit

remove t cluster marks cluster as free and invalidates any reference to it (e.g. in response to a discard)

Clusters which contain arbitrary data

Clusters which have been erased but haven't been flushed yet so can't be safely reallocated.

Clusters which are available for reallocation

Clusters which contain copies, as part of a compact

Clusters which have been allocated but not yet placed somewhere reachable from the GC

Sourceval wait : t -> unit Lwt.t

wait t wait for some amount of recycling work to become available, e.g.

  • junk could be created
  • available could be used
  • a move might require a reference update
Sourceval start_moves : t -> Move.t list

start_moves t calculates the block moves required to compact t and marks the clusters as moving

moves t returns the state of the current active moves

Sourceval set_move_state : t -> Move.t -> move_state -> unit

Update the state of the given move operation

Sourceval is_moving : t -> Qcow_types.Cluster.t -> bool

is_moving t cluster returns true if cluster is still moving

Sourceval cancel_move : t -> Qcow_types.Cluster.t -> unit

cancel_move cluster cancels any in-progress move of cluster cluster. This should be called with the cluster write lock held whenever there has been a change in the contents of cluster

Sourceval complete_move : t -> Move.t -> unit

complete_move t move marks the move as complete.

find t cluster returns the reference to cluster, or raises Not_found

Sourceval get_last_block : t -> Qcow_types.Cluster.t

get_last_block t is the last allocated block in t. Note if there are no data blocks this will point to the last header block even though it is immovable.

Sourceval is_immovable : t -> Qcow_types.Cluster.t -> bool

is_immovable t cluster is true if cluster is fixed and cannot be moved i.e. it is before the first_movable_cluster i.e. it is part of the fixed (L1) header structure.

Sourceval update_references : t -> Qcow_types.Cluster.t Qcow_types.Cluster.Map.t -> unit

update_references t subst updates the reference table following the given set of substitutions. Any reference to a source block must be updated to the destination block otherwise it will be left pointing to junk. Normally this is guaranteed by the Metadata.Physical.set function, but when compacting we split the operation into phases and copy the block first at the byte level, leaving the map out-of-sync

Sourceval to_summary_string : t -> string

to_summary_string t returns a terse printable summary of t

Sourcemodule Debug : sig ... end
OCaml

Innovation. Community. Security.