From patchwork Fri Sep 25 15:50:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 522905 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1358E1400A0 for ; Sat, 26 Sep 2015 01:51:57 +1000 (AEST) Received: from localhost ([::1]:48136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfVHu-0003eM-F8 for incoming@patchwork.ozlabs.org; Fri, 25 Sep 2015 11:51:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfVH6-0002Fr-FR for qemu-devel@nongnu.org; Fri, 25 Sep 2015 11:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfVH5-0002uB-MB for qemu-devel@nongnu.org; Fri, 25 Sep 2015 11:51:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfVH3-0002sQ-44; Fri, 25 Sep 2015 11:51:01 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B5C43AED50; Fri, 25 Sep 2015 15:51:00 +0000 (UTC) Received: from localhost (ovpn-112-77.phx2.redhat.com [10.3.112.77]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8PFoxZh031111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO); Fri, 25 Sep 2015 11:51:00 -0400 From: Jeff Cody To: qemu-block@nongnu.org Date: Fri, 25 Sep 2015 11:50:50 -0400 Message-Id: <1443196256-5601-2-git-send-email-jcody@redhat.com> In-Reply-To: <1443196256-5601-1-git-send-email-jcody@redhat.com> References: <1443196256-5601-1-git-send-email-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 1/7] block/nfs: fix calculation of allocated file size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Lieven 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 Reviewed-by: Max Reitz Reviewed-by: Jeff Cody Message-id: 1440067607-14547-1-git-send-email-pl@kamp.de Signed-off-by: Jeff Cody --- 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)