OSDN Git Service

block/nfs: fix calculation of allocated file size
authorPeter Lieven <pl@kamp.de>
Thu, 20 Aug 2015 10:46:47 +0000 (12:46 +0200)
committerJeff Cody <jcody@redhat.com>
Fri, 25 Sep 2015 12:37:07 +0000 (08:37 -0400)
st.st_blocks is always counted in 512 byte units. Do not
use st.st_blksize as multiplicator which may be larger.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 1440067607-14547-1-git-send-email-pl@kamp.de
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/nfs.c

index c026ff6..02eb4e4 100644 (file)
@@ -475,7 +475,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
         aio_poll(client->aio_context, true);
     }
 
-    return (task.ret < 0 ? task.ret : st.st_blocks * st.st_blksize);
+    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
 }
 
 static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)