From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LiU1k-0004lD-7d for qemu-devel@nongnu.org; Sat, 14 Mar 2009 09:35:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LiU1e-0004kw-Tt for qemu-devel@nongnu.org; Sat, 14 Mar 2009 09:35:46 -0400 Received: from [199.232.76.173] (port=52301 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LiU1e-0004kt-Ma for qemu-devel@nongnu.org; Sat, 14 Mar 2009 09:35:42 -0400 Received: from verein.lst.de ([213.95.11.210]:55325) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1LiU1e-0002ZM-6r for qemu-devel@nongnu.org; Sat, 14 Mar 2009 09:35:42 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n2EDZeIF025541 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 14 Mar 2009 14:35:40 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id n2EDZe10025539 for qemu-devel@nongnu.org; Sat, 14 Mar 2009 14:35:40 +0100 Date: Sat, 14 Mar 2009 14:35:40 +0100 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests Message-ID: <20090314133540.GA25440@lst.de> References: <20090314130003.GA24344@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090314130003.GA24344@lst.de> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Sat, Mar 14, 2009 at 02:00:03PM +0100, Christoph Hellwig wrote: > We never allow the offset to be byte-granularity for the sector-based > interface, instead the negative value for byte values applied to the > request length. Actually - looking over the updates that happened during the week that I was away it looks like the whole negative length hack is gone now, so we can simplify bdrv_check_request instead: Index: qemu/block.c =================================================================== --- qemu.orig/block.c 2009-03-14 14:34:49.000000000 +0100 +++ qemu/block.c 2009-03-14 14:35:12.000000000 +0100 @@ -546,15 +546,7 @@ static int bdrv_check_byte_request(Block static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { - int64_t offset; - - /* Deal with byte accesses */ - if (sector_num < 0) - offset = -sector_num; - else - offset = sector_num * 512; - - return bdrv_check_byte_request(bs, offset, nb_sectors * 512); + return bdrv_check_byte_request(bs, sector_num * 512, nb_sectors * 512); } /* return < 0 if error. See bdrv_write() for the return codes */