From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQzcq-0001X2-4n for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:04:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQzch-0002Hb-NB for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:04:28 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:50420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQzch-0002HM-EB for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:04:19 -0400 Received: by mail-wi0-f176.google.com with SMTP id cb5so5496610wib.3 for ; Tue, 01 Oct 2013 06:04:18 -0700 (PDT) Date: Tue, 1 Oct 2013 15:04:15 +0200 From: Stefan Hajnoczi Message-ID: <20131001130415.GC6035@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v6 10/20] block: vhdx - add log write support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Wed, Sep 25, 2013 at 05:02:55PM -0400, Jeff Cody wrote: > +static int vhdx_log_write(BlockDriverState *bs, BDRVVHDXState *s, > + void *data, uint32_t length, uint64_t offset) > +{ > + int ret = 0; > + void *buffer = NULL; > + void *merged_sector = NULL; > + void *data_tmp, *sector_write; > + unsigned int i; > + int sector_offset; > + uint32_t desc_sectors, sectors, total_length; > + uint32_t sectors_written = 0; > + uint32_t aligned_length; > + uint32_t leading_length = 0; > + uint32_t trailing_length = 0; > + uint32_t partial_sectors = 0; > + uint32_t bytes_written = 0; > + uint64_t file_offset; > + VHDXHeader *header; > + VHDXLogEntryHeader new_hdr; > + VHDXLogDescriptor *new_desc = NULL; > + VHDXLogDataSector *data_sector = NULL; > + MSGUID new_guid = { 0 }; > + > + header = s->headers[s->curr_header]; > + > + /* need to have offset read data, and be on 4096 byte boundary */ > + > + if (length > header->log_length) { > + /* no log present. we could create a log here instead of failing */ > + ret = -EINVAL; > + goto exit; > + } > + > + if (guid_eq(header->log_guid, zero_guid)) { > + vhdx_guid_generate(&new_guid); > + vhdx_update_headers(bs, s, false, &new_guid); > + } else { > + /* currently, we require that the log be flushed after > + * every write. */ > + ret = -ENOTSUP; Missing goto exit?