qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests
@ 2009-03-14 13:00 Christoph Hellwig
  2009-03-14 13:35 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2009-03-14 13:00 UTC (permalink / raw)
  To: qemu-devel

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.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c	2009-03-11 11:50:27.000000000 +0100
+++ qemu/block.c	2009-03-11 11:51:42.000000000 +0100
@@ -542,15 +542,15 @@ static int bdrv_check_byte_request(Block
 static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,
                               int nb_sectors)
 {
-    int64_t offset;
+    size_t len;
 
     /* Deal with byte accesses */
-    if (sector_num < 0)
-        offset = -sector_num;
+    if (nb_sectors < 0)
+        len = -nb_sectors;
     else
-        offset = sector_num * 512;
+        len = nb_sectors * 512;
 
-    return bdrv_check_byte_request(bs, offset, nb_sectors * 512);
+    return bdrv_check_byte_request(bs, sector_num * 512, len);
 }
 
 /* return < 0 if error. See bdrv_write() for the return codes */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-29  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-14 13:00 [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests Christoph Hellwig
2009-03-14 13:35 ` Christoph Hellwig
2009-03-28 16:21   ` Anthony Liguori
2009-03-28 18:31     ` [Qemu-devel] [PATCH] remove dead code in bdrv_check_request Christoph Hellwig
2009-03-29  1:33       ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).