Whenever a file is opened for writing, a snapshot of the file is created.
The snapshot includes a copy of the file's metadata. A snapshot file map
is initialized, pointing nowhere. A bitmap of the blocks in the file map
is initialized. As new data are written to a block in the file, the
original contents of the block are copied to a duplicate block. The bitmap
is updated to indicate that the contents of the block have changed. The
snapshot file map is updated to point to the duplicate block, and the new
data are written to the original block. To archive the file, the file
system uses the bitmap to identify which blocks have changed since the
file was opened. Unchanged blocks are read through the original file map,
and changed blocks are read through the snapshot file map. Finally, when
the file is closed and the archive operation is complete, the bitmap and
the resources used by the snapshot are returned to the system.