From nobody Sun Feb 8 15:59:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487293027706407.7331262475061; Thu, 16 Feb 2017 16:57:07 -0800 (PST) Received: from localhost ([::1]:51039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceWrC-0005VD-ML for importer@patchew.org; Thu, 16 Feb 2017 19:57:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceWm9-0001HT-3D for qemu-devel@nongnu.org; Thu, 16 Feb 2017 19:51:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceWm8-0007sB-4p for qemu-devel@nongnu.org; Thu, 16 Feb 2017 19:51:53 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:35436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceWm7-0007rB-V6; Thu, 16 Feb 2017 19:51:52 -0500 Received: by mail-wr0-x243.google.com with SMTP id q39so3775063wrb.2; Thu, 16 Feb 2017 16:51:51 -0800 (PST) Received: from lean.local (bzq-79-181-80-34.red.bezeqint.net. [79.181.80.34]) by smtp.gmail.com with ESMTPSA id u184sm123712wmb.29.2017.02.16.16.51.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 16:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W5kSPSMkBLe3on5gFApAHXIVGAp4L6pHuUT946Qc+0g=; b=CV1FaJRiYp2wWFSouY/l9Cb2g7t/Y+8OVAJgf8aUEL0TwGxLypj6O4RxIuVS8SqRzx 3nYvRXbatjaf58qHa45kT87x4WVl2fVqS/+WPxv1pqzOHfJuigAOUlVMvY8eO1wqXh5v XVOGLz1vXuYbJsP9AmFjAwmPB5Mipu6ih/AT2cX5jB2pWq0jYMUgQK4qj9ionKJazlNa UpKG3grgvShqAEEQ1atvW13SIAfiXRH0Pw4HVfIhN4Vrh1tg9Cd7wuWhyJFlZzwc+YsM UtMtqtnn1XbwhfqO1tyAwbtk9EaHWkToLV5e0LYMPcFSbLKenn/xt0RBvG2pepkRBJg5 kVug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W5kSPSMkBLe3on5gFApAHXIVGAp4L6pHuUT946Qc+0g=; b=g+Fc6r6C4F8NBU2I9iFkn5dfNXqdGfS1JXw2D5SlHrpnhs013AqAJ+6c48g/NRWES7 81GxpMDJU25NA30pmL8Q3viB5gCPfIX00Z9P85VqpSQ7sw9YyPlQEGTYBGJZErPmXsmb vCrf5s1yuRgHziBrXeRKyuAPHKPvrqrg87KJkq4E22f9rnVuOmQ1mJmjtSHZ+ZcI+XKW F6O1qy+JEmNLfTIZHLEZ3Di3SsqYXIRjNekpB6EpAkYLoThX1X1fy5UKShfIM2Uk1fW2 pAXnGQdSrfF9igFDyzWmw70shLfJ/0ImjXyRJIV/AysmUNXw3k3rOFt1TiZpiptITaR1 QylA== X-Gm-Message-State: AMke39lf1lsj7NUqnt7kbxyh+fBeEDuF8EMu1dzx5zrBUK4JPbkc0xUImornGwuRqB42Dg== X-Received: by 10.223.160.132 with SMTP id m4mr4885543wrm.116.1487292710866; Thu, 16 Feb 2017 16:51:50 -0800 (PST) From: Nir Soffer To: qemu-devel@nongnu.org Date: Fri, 17 Feb 2017 02:51:27 +0200 Message-Id: <20170217005127.21010-4-nirsof@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170217005127.21010-1-nirsof@gmail.com> References: <20170217005127.21010-1-nirsof@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PATCH 3/3] qemu-img: Improve documentation for PREALLOC_MODE_FALLOC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Nir Soffer , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that we are truncating the file in both PREALLOC_MODE_FULL and PREALLOC_MODE_OFF, not truncating in PREALLOC_MODE_FALLOC looks odd. Add a comment explaining why we do not truncate in this case. Signed-off-by: Nir Soffer --- block/file-posix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index d24e34b..20a261f 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1594,9 +1594,14 @@ static int raw_create(const char *filename, QemuOpts= *opts, Error **errp) switch (prealloc) { #ifdef CONFIG_POSIX_FALLOCATE case PREALLOC_MODE_FALLOC: - /* posix_fallocate() doesn't set errno. */ + /* + * Truncating before posix_fallocate() makes it about twice slower= on + * file systems that do not support fallocate(), trying to check i= f a + * block is allocated before allocating it. + */ result =3D -posix_fallocate(fd, 0, total_size); if (result !=3D 0) { + /* posix_fallocate() doesn't set errno. */ error_setg_errno(errp, -result, "Could not preallocate data for the new file"= ); } --=20 2.9.3