From patchwork Tue Mar 3 10:41:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 445664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 538321400F1 for ; Tue, 3 Mar 2015 21:46:28 +1100 (AEDT) Received: from localhost ([::1]:35844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSkLK-0004pc-Jj for incoming@patchwork.ozlabs.org; Tue, 03 Mar 2015 05:46:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSkIt-0000iy-F2 for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:43:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSkIs-0000Tg-I9 for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:43:55 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:59482 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSkIs-0000TT-8c for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:43:54 -0500 Received: (qmail 12249 invoked by uid 89); 3 Mar 2015 10:47:06 -0000 Received: from [82.141.1.145] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.98.6/20138. hbedv: 8.3.28.28/7.11.213.60. spamassassin: 3.4.0. Clear:RC:1(82.141.1.145):SA:0(-1.2/5.0):. Processed in 0.887311 secs); 03 Mar 2015 10:47:06 -0000 Received: from ns.kamp-intra.net (HELO dns.kamp-intra.net) ([82.141.1.145]) by mx01.kamp.de with SMTP; 3 Mar 2015 10:47:05 -0000 X-GL_Whitelist: yes Received: from lieven-vm-neu (lieven-vm.kamp-intra.net [172.21.12.69]) by dns.kamp-intra.net (Postfix) with ESMTP id 133E6E0065; Tue, 3 Mar 2015 11:42:11 +0100 (CET) Received: by lieven-vm-neu (Postfix, from userid 1000) id C46022025C; Tue, 3 Mar 2015 11:41:59 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Tue, 3 Mar 2015 11:41:56 +0100 Message-Id: <1425379316-19639-6-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1425379316-19639-1-git-send-email-pl@kamp.de> References: <1425379316-19639-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a02:248:0:51::16 Cc: kwolf@redhat.com, carnold@suse.com, famz@redhat.com, jcody@redhat.com, Peter Lieven , mreitz@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 5/5] block/vpc: remove disabled code from get_sector_offset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The code to check the bitmap for the allocation status of each sector has been "disabled by reason" ever since the vpc driver existed. The reason might be that we might end up reading sector by sector in vpc_read if we really used it. This would be a performance desaster. The current code would furthermore not work if the disabled parts get reactivated since vpc_read and vpc_write only use get_sector_offset to check the allocation status of the first sector of a read/write operation. This might lead to sectors incorrectly treated as zero in vpc_read and to sectors getting allocated twice in vpc_write. Signed-off-by: Peter Lieven Reviewed-by: Max Reitz --- block/vpc.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 226be02..43e768e 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -376,38 +376,6 @@ static inline int64_t get_sector_offset(BlockDriverState *bs, bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size); } -// printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", -// sector_num, pagetable_index, pageentry_index, -// bitmap_offset, block_offset); - -// disabled by reason -#if 0 -#ifdef CACHE - if (bitmap_offset != s->last_bitmap) - { - lseek(s->fd, bitmap_offset, SEEK_SET); - - s->last_bitmap = bitmap_offset; - - // Scary! Bitmap is stored as big endian 32bit entries, - // while we used to look it up byte by byte - read(s->fd, s->pageentry_u8, 512); - for (i = 0; i < 128; i++) - be32_to_cpus(&s->pageentry_u32[i]); - } - - if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1) - return -1; -#else - lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET); - - read(s->fd, &bitmap_entry, 1); - - if ((bitmap_entry >> (pageentry_index % 8)) & 1) - return -1; // not allocated -#endif -#endif - return block_offset; }