1. 20 Dec, 2013 1 commit
    • Jeff Cody's avatar
      block: vhdx - improve error message, and .bdrv_check implementation · 7e30e6a6
      Jeff Cody authored
      If there is a dirty log file to be replayed in a VHDX image, it is
      replayed in .vhdx_open().  However, if the file is opened read-only,
      then a somewhat cryptic error message results.
      
      This adds a more helpful error message for the user.  If an image file
      contains a log to be replayed, and is opened read-only, the user is
      instructed to run 'qemu-img check -r all' on the image file.
      
      Running qemu-img check -r all will cause the image file to be opened
      r/w, which will replay the log file.  If a log file replay is detected,
      this is flagged, and bdrv_check will increase the corruptions_fixed
      count for the image.
      
      [Fixed typo in error message that was pointed out by Eric Blake
      <eblake@redhat.com>.
      --Stefan]
      Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      7e30e6a6
  2. 07 Nov, 2013 2 commits
    • Jeff Cody's avatar
      block: vhdx - add log write support · 8adc5233
      Jeff Cody authored
      This adds support for writing to the VHDX log.
      
      For spec details, see VHDX Specification Format v1.00:
      https://www.microsoft.com/en-us/download/details.aspx?id=34750
      
      There are a few limitations to this log support:
      1.) There is no caching yet
      2.) The log is flushed after each entry
      
      The primary write interface, vhdx_log_write_and_flush(), performs a log
      write followed by an immediate flush of the log.
      
      As each log entry sector is a minimum of 4KB, partial sector writes are
      filled in with data from the disk write destination.
      
      If the current file log GUID is 0, a new GUID is generated and updated
      in the header.
      Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      8adc5233
    • Jeff Cody's avatar
      block: vhdx - log parsing, replay, and flush support · 0a43a1b5
      Jeff Cody authored
      This adds support for VHDX v0 logs, as specified in Microsoft's
      VHDX Specification Format v1.00:
      https://www.microsoft.com/en-us/download/details.aspx?id=34750
      
      The following support is added:
      
      * Log parsing, and validation - validate that an existing log
        is correct.
      
      * Log search - search through an existing log, to find any valid
        sequence of entries.
      
      * Log replay and flush - replay an existing log, and flush/clear
        the log when complete.
      
      The VHDX log is a circular buffer, with elements (sectors) of 4KB.
      
      A log entry is a variably-length number of sectors, that is
      comprised of a header and 'descriptors', that describe each sector.
      
      A log may contain multiple entries, know as a log sequence.  In a log
      sequence, each log entry immediately follows the previous entry, with an
      incrementing sequence number.  There can only ever be one active and
      valid sequence in the log.
      
      Each log entry must match the file log GUID in order to be valid (along
      with other criteria).  Once we have flushed all valid log entries, we
      marked the file log GUID to be zero, which indicates a buffer with no
      valid entries.
      Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      0a43a1b5