From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQzyP-0005sj-Oz for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:26:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQzyJ-0001gc-Lv for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:26:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQzyJ-0001gP-AW for qemu-devel@nongnu.org; Tue, 01 Oct 2013 09:26:39 -0400 Date: Tue, 1 Oct 2013 09:26:34 -0400 From: Jeff Cody Message-ID: <20131001132634.GE10859@localhost.localdomain> References: <20131001130415.GC6035@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131001130415.GC6035@stefanha-thinkpad.redhat.com> 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: Stefan Hajnoczi Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Tue, Oct 01, 2013 at 03:04:15PM +0200, Stefan Hajnoczi wrote: > 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? Oof! Yes it is, thanks.