qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity req


From: Christoph Hellwig
Subject: Re: [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests
Date: Sat, 14 Mar 2009 14:35:40 +0100
User-agent: Mutt/1.3.28i

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 */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]