Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1282798ybg; Fri, 18 Oct 2019 15:10:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+pJqDIQfoKcICerSaOQYtejrvvfuuHK6exGlz9wk/CKRHT7ykYBuVOb5hhKsvEJ+kj/tB X-Received: by 2002:a17:906:4d85:: with SMTP id s5mr11163436eju.192.1571436657274; Fri, 18 Oct 2019 15:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571436657; cv=none; d=google.com; s=arc-20160816; b=aPN9bi6WkzlzazWthR/ETptxtEezuTySOx8uiH/puRmq2nnjqNJJHoM42h/FhBthKx m8qtj28NNPYlYJtAvjkexXf5strNyT1UmR009Sb0suvpRYgsbelrImimKSRs9HPXaCw2 8prEM+EXs55rcatNFDV4r1yl7jU+kcrB1M2Me7y2XE/5A+0hPxJBtenUtaki3aLmxr0s WScLLg3A+8LoQU11Dqx9irc0MzhP80+65Ci5JKO8eY7ke8XcPRAVxErQPLqqKIFhSJj6 fwmH449RP1cXzacX/5Ya6nqstbNFIkFc8qsmCjIxYpLBn5Yxy7EfXTnFyG97/9WBx+7d FO8Q== 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=A/CR7PHPpcU/5/5I+dFoTTHqvSCjwPyHdxbff3qIeNU=; b=QXhS/mcgAGAv8IudDwtys524+17Cp8XgGzNTOwKNEHNJs4Sqq9MT7cCtmNA9mC6O3l u4ov7682w4bsfTwGoBXoH1zDy4ZuwCKBFHm68LE6rDUU9c4oV/NRLa7uvB6b5vT4rkT6 GvxOAZbGhIsqJFvUA+AcUU5SFh3YEB+TpNww1ijtUGbWzSZjCw7tlrMkE4/o05D55MpB OPtwApa/PnwECt0XcdPfSFQcWIE2i7E23occRl7xj3FaSQTFfSdsYxWpNIW1lFiydOfr 2aJJud6lHOdk9KS9TMON+G9jjovB9MALuMApTRqttRp3vmZPVFBDAUVvSB0aPcZsRrFU fPyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=r4kYb7Ir; 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 e7si4374280ejk.20.2019.10.18.15.10.34; Fri, 18 Oct 2019 15:10:57 -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=r4kYb7Ir; 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 S2437827AbfJQR4k (ORCPT + 99 others); Thu, 17 Oct 2019 13:56:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47228 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437730AbfJQR4j (ORCPT ); Thu, 17 Oct 2019 13:56:39 -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=A/CR7PHPpcU/5/5I+dFoTTHqvSCjwPyHdxbff3qIeNU=; b=r4kYb7IrDCx/or/1brPaGMPC3W 17qLswbrjI6klyzXg3WPoiUaXTM7ugMuCmFUkWxsEb2T15jrsJacCFph67T/nRsC7SclGex3Eer1Z hgUwXzVau2A2wacsglBNNAbLdqqlBjoo5iK3mQEbvGJSKnwM1qn5hMCsGZ7rp25Q2JzW3KZsHbiOZ Ko/Xx0+/dbdIrvDx/naBRzPjog1l0GRvNkixaW1FkM7zXXc7hox7cRUqlmsL6DPJ5vbP0pzVTVu/y Io1nCdcMNJD+Adb0QPD6fB6Gfs11xyTFO7k8OW5Zn3c2Lm4YpP3qbIw9IeFd3uR/nkSniaIdXclWB sRl4iIpw==; Received: from [2001:4bb8:18c:d7b:c70:4a89:bc61:3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLA0o-0000mM-Sh; Thu, 17 Oct 2019 17:56:35 +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, Dave Chinner Subject: [PATCH 03/14] xfs: set IOMAP_F_NEW more carefully Date: Thu, 17 Oct 2019 19:56:13 +0200 Message-Id: <20191017175624.30305-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017175624.30305-1-hch@lst.de> References: <20191017175624.30305-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 an 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: Dave Chinner Reviewed-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 699bbb81b8a8..f7b8b1329ddd 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