Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6040686ybp; Tue, 15 Oct 2019 08:44:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUNdgf2JxZzIFvpcukt4wm4qibhlLCzWqANr6bs0AprLlxmCNICyJEDl4Po+uKMv3x/gXy X-Received: by 2002:a05:6402:2046:: with SMTP id bc6mr13221967edb.147.1571154291563; Tue, 15 Oct 2019 08:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571154291; cv=none; d=google.com; s=arc-20160816; b=BH7OD8KDIQCcbRb5fRcNo3SDH1FQfdTNfpFsv10/+W9G5gLEk0yn8Oy9UKmJbWwF8V ObREClvN98wtFMFFI+UC+BOGa/AHxFFNAW+TsdD0eh1/Jut55QBgVO/3t2jGAbR7MSut k1iTh8SP/n+r07vik8u8gGINagQU7dIae++EIId7t8Al9vPvjetPhGmC365OtmeAnQru MqgUuEWSFNJIxy1KRZu/Rr/pnKzZNHr8vWjWiIDNJd8z7ezwE/KDHVsz6RXfZyTFcKWI eYfQ4SuyDgyAYU2UT6qNs6/hSYC3YQjHZB6ggv4sBONCAv05MAtkGVEdvl2vyNHvqqQu xQxQ== 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=Z2mOV5fCnzJ/ajtJffEAioA43RGvYrL3qCbBjued7wQ=; b=oSJgZ6AmcsyUZcK4I0h20k7jGceucvHYmHMGksgs4RlhSZ3RTJLIUZGwDJehYUDE1a 2Mjg4/QHnZqApCWwPGvXAR14Dy+78QUSWSomefK9spiI5yxfFcJJu0DBhFXkfoXjwocQ SSydRsxmuf5JIXAejrMfO9ESpJZ6Iccap+kkECmEc/ltnR/W0PFeETFSIZackSRYyEg/ 5RftGuX3sVQFk15bd+uQT24mxffRjtd/FJwp78QwJSV7dZ26z9RYRaTZJJISO4r6BEKn ovFMfZA5YwdGFDPKhPrLcsmN2ghgn+xp8jfH2cwEjcqHzs5gSlPJl64s0jN8n7y3YFTY jttg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CdNtKYwS; 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 ox13si13032873ejb.0.2019.10.15.08.44.23; Tue, 15 Oct 2019 08:44:51 -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=CdNtKYwS; 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 S2387558AbfJOPoC (ORCPT + 99 others); Tue, 15 Oct 2019 11:44:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47986 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731230AbfJOPn6 (ORCPT ); Tue, 15 Oct 2019 11:43:58 -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=Z2mOV5fCnzJ/ajtJffEAioA43RGvYrL3qCbBjued7wQ=; b=CdNtKYwSXmP7KlUNGRzsNW9j82 Vn6sBfLdpMUS6sC/oIgDOCC9n9TxPv1q1B4AchmEVzjGq3d9pz8pCa3euTaYQ1ZvOCv44+Yy2cmRz F4xorByijm4gHqGmShZ5O/BwNiARIEmeBMKSTFr0/Aca4tvn2qPLhqh0JZMH1AcMgbW6wVsNnDM4N arv2+HS4NY7sKICPf7FoW/68/C91s2sjvqVa+B6DOSlZoZRvJTAJepYaAkyl/HFOxRUMv6sg5O392 CnaudvhiSxtLY/I5P/JTExcTSRYjpEkqZF6Ohrmdfb+q02cVmZtMRN9HZHG73oEo+mt172wT/Jh+0 VnF/b7Jw==; 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 1iKOzM-0007uc-Rf; Tue, 15 Oct 2019 15:43:57 +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 02/12] xfs: set IOMAP_F_NEW more carefully Date: Tue, 15 Oct 2019 17:43:35 +0200 Message-Id: <20191015154345.13052-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015154345.13052-1-hch@lst.de> References: <20191015154345.13052-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 --- 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 54c9ec7ad337..c0a492353826 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