From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LnbI6-0006TH-J1 for qemu-devel@nongnu.org; Sat, 28 Mar 2009 12:21:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LnbI2-0006PO-TC for qemu-devel@nongnu.org; Sat, 28 Mar 2009 12:21:50 -0400 Received: from [199.232.76.173] (port=36501 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LnbI2-0006P4-Lg for qemu-devel@nongnu.org; Sat, 28 Mar 2009 12:21:46 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:33083) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LnbI2-0002qX-C7 for qemu-devel@nongnu.org; Sat, 28 Mar 2009 12:21:46 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e31.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n2SGIi54028790 for ; Sat, 28 Mar 2009 10:18:44 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n2SGLjw0202820 for ; Sat, 28 Mar 2009 10:21:45 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n2SGLidB025037 for ; Sat, 28 Mar 2009 10:21:44 -0600 Received: from squirrel.codemonkey.ws (sig-9-65-67-103.mts.ibm.com [9.65.67.103]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n2SGLhaq025006 for ; Sat, 28 Mar 2009 10:21:44 -0600 Message-ID: <49CE4E97.7080705@us.ibm.com> Date: Sat, 28 Mar 2009 11:21:43 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests References: <20090314130003.GA24344@lst.de> <20090314133540.GA25440@lst.de> In-Reply-To: <20090314133540.GA25440@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 Christoph Hellwig wrote: > 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: > Needs a SoB. Regards, Anthony Liguori > 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 */ > > > >