Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7946797ybn; Tue, 1 Oct 2019 00:17:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzduhACz6AWnMIq8QNed2T0MxqhZ/Ewl5OkFojoPvRIuTkpk2l75ILNdRz+DnSI1fK0XrKx X-Received: by 2002:a50:aa86:: with SMTP id q6mr24562500edc.288.1569914229906; Tue, 01 Oct 2019 00:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569914229; cv=none; d=google.com; s=arc-20160816; b=bk0QIhmy37U/Sjf7xxyBpWiaWiolGlvhfaurfb9t5JfGCEDtFcMoCj4Ux4A5lXiaWm IfiB7Cexn8lbj9noFrc6GIhSkzG2u+CqXtMVdA9v7ubZt4f158bljkStf6ooLoi+6C6c aiwWGIf+0oZG4dvde7gW0Nwsu4CygqTFzghSJ8R9IWeXoLROsAIffa2o7SBwc6g6QTXc +4DyuC2W+FlKaoxYqGKmTO0j4XhurvNKwIuax+kAQC8RNG2Q0sCeOr1nYskxCPxecjhE Y/6a1teHZxvEgdm3wSKuEG4R6pGe9bovwCxDlf6PgjsHpp7KqDSuPO1ZKn0CqZd5EmMO wqfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ssX5S50+8rElNg+qujiPsX9Urg+ktJ5Cp16e5jVQ2Go=; b=LCW7tPpBSdFD9bn+h3qNjsW4/lzsi4aBfOKUUMUbYYLUu+OYqV+khHNd9Bty4qWUsG qcUuSrzcY9S1kGgB9K1g7au6+EbyqZon4FJTjD8/vBLKUtJI5o0eqquwEFLaPJPwAT2W 2sifdYe9pFE+1ZeOMdJ+7mbnXAQyEZz+6PYL9vcOaleW+gBSRn+x6xwadEaC9jEEzz3/ L+csBVIJ3DSW63rQG/uRrkO90NDcnSwBTQ2Nr+zig7ahMnKX8UyUeWD27ImCuJ7UqJMI h0ID0iUxDKlOFsOQBz+3J7u61RRHYpB1xYGxQsfAE8jdJ9gVaRUt3t5vAVEt2b9TNIO0 ly+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JXEwrgMV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si9147293ede.38.2019.10.01.00.16.45; Tue, 01 Oct 2019 00:17:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JXEwrgMV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732947AbfJAHQ1 (ORCPT + 99 others); Tue, 1 Oct 2019 03:16:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45502 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732829AbfJAHQ0 (ORCPT ); Tue, 1 Oct 2019 03:16:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ssX5S50+8rElNg+qujiPsX9Urg+ktJ5Cp16e5jVQ2Go=; b=JXEwrgMV8xqqQkiwGvJNBQCwO1 HThnx3GEjFf/zIKKqqjD3t1/GIjnJaSwuAUQEiJw71GtFH0EkPJdTv+3tTsfWEscVhL/AjhTIkyxw rMIVSHLg0n2LWXsONu+rYB4W7iKFVWmk2SU18GyBPCyZL3re3QuEebbyadKUExU5NNX+Y2LmxN2fi wg5oApoNsAauIXeOTGQzWWX7jLo6JRgtBamuTNvmviADruHGOqmV8M/dc8qXOC9kSybvOsOoduBHz 9qSrXFBOFoT3V1XznJlFp2HtS0QrWA64CJ6OqylYsLqaGtbeLl4QbtqfKJDvKOxLXP/5o4pwbNfaH TZfE+YgQ==; Received: from [2001:4bb8:18c:4d4a:b9e5:f9f0:a515:3f0a] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFCOW-0001QN-Nd; Tue, 01 Oct 2019 07:16:25 +0000 From: Christoph Hellwig To: "Darrick J . Wong" Cc: Damien Le Moal , Andreas Gruenbacher , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/11] xfs: set IOMAP_F_NEW more carefully Date: Tue, 1 Oct 2019 09:11:45 +0200 Message-Id: <20191001071152.24403-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191001071152.24403-1-hch@lst.de> References: <20191001071152.24403-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't set IOMAP_F_NEW if we COW over and existing allocated range, as these aren't strictly new allocations. This is required to be able to use IOMAP_F_NEW to zero newly allocated blocks, which is required for the iomap code to fully support file systems that don't do delayed allocations or use unwritten extents. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_iomap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index f780e223b118..2dc0f182f125 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -707,9 +707,12 @@ xfs_file_iomap_begin_delay( * Flag newly allocated delalloc blocks with IOMAP_F_NEW so we punch * them out if the write happens to fail. */ - iomap->flags |= IOMAP_F_NEW; - trace_xfs_iomap_alloc(ip, offset, count, whichfork, - whichfork == XFS_DATA_FORK ? &imap : &cmap); + if (whichfork == XFS_DATA_FORK) { + iomap->flags |= IOMAP_F_NEW; + trace_xfs_iomap_alloc(ip, offset, count, whichfork, &imap); + } else { + trace_xfs_iomap_alloc(ip, offset, count, whichfork, &cmap); + } done: if (whichfork == XFS_COW_FORK) { if (imap.br_startoff > offset_fsb) { -- 2.20.1