Received: from eggs.gnu.org ([2001:4830:134:3::10]:44765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSNU0-0006bz-4k for qemu-devel@nongnu.org; Thu, 20 Aug 2015 06:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSNTw-000410-US for qemu-devel@nongnu.org; Thu, 20 Aug 2015 06:54:08 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:44822 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSNTw-00040S-H4 for qemu-devel@nongnu.org; Thu, 20 Aug 2015 06:54:04 -0400 From: Peter Lieven Date: Thu, 20 Aug 2015 12:46:47 +0200 Message-Id: <1440067607-14547-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, jcody@redhat.com, Peter Lieven , qemu-stable@nongnu.org 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 --- block/nfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nfs.c b/block/nfs.c index c026ff6..02eb4e4 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -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) -- 1.9.1