summaryrefslogtreecommitdiff
path: root/block/vhdx-log.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-31block/vhdx: Error checking fixesMarkus Armbruster1-2/+2
Errors are inadvertently ignored in a few places. Has always been broken. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20block: vhdx - improve error message, and .bdrv_check implementationJeff Cody1-1/+12
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: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-07block: vhdx - add log write supportJeff Cody1-0/+282
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: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-07block: vhdx - log parsing, replay, and flush supportJeff Cody1-0/+728
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: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>