Skip to content

Commit

Permalink
block/nfs: fix calculation of allocated file size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
plieven authored and codyprime committed Sep 25, 2015
1 parent eb9d0ea commit 055c6f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/nfs.c
Expand Up @@ -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)
Expand Down

0 comments on commit 055c6f9

Please sign in to comment.