Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3295611ybp; Sun, 6 Oct 2019 08:51:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHDszIxZaDgXfLfgFbtRIuSjeAehIM8Qs7YfycMG5vJDPZZVRUgXW2s80Fkg6btx62hqxn X-Received: by 2002:aa7:d758:: with SMTP id a24mr2058627eds.61.1570377087721; Sun, 06 Oct 2019 08:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570377087; cv=none; d=google.com; s=arc-20160816; b=IpmHsVJ8Sa958PNOcXORRBe697FFz2A0wK4JMdqW0XGMWCk0l5jX6uIPAdgR6n4HCJ 4owaKQBgCHVZzrRnBwGk0QglvdT4fUHKsW2PPAxTF698D+M60Uy9DVqjO13WU3/dB4jv PMp23submRZ1+4TALAfPgH2Xg4RAIqwoIZC9huoAbqsWfDglqj5GAWhZdWlaB53LQTft OIZWCzU5mxMZ6mft0kACe681Rh+PhN0/WegcEU7WJWtug4QGochA00DgdOqO2SbmUb5c /qPOvbFNdD6CF/XAs6Ctoi/r6hRec56vIkmMgmF/TEtgGTC69z1ijqDgVUyeO1VOaZjC 6Sow== 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=1AxvKHIngVRfMhfo/wmpTLMROPdKoW1NbQhbFZf+6b6Jf5nUKKz6WsYAULMc9zYjM0 dEDrN8OX0gZhjV4ulWhPxy+/22TaRY+W3tJZvjI1oKdqnsrYc9swtZUhuOkdRqzNMunN 0pcjmEtUCgYi8F9pHm/xy/DTwdQ2wrCMyUxA+/SHv47VmBOTG6aV3w5VN4AK//GFA1hh oY6iqDIjSk9zvH3AAuotHqIHhUA+XW+LiImbGZoVpRbRmggLPVM2DMGZ9K7f8+rgzpou x8yWkv0hO7v5kCNVckAHhRuyZh+zYMgFHmTK0U0E+Yaufdnij9Xoak1Y9oRYh4vH1RZi Gi/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=k8q0w8zJ; 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 z55si7350215edz.254.2019.10.06.08.51.04; Sun, 06 Oct 2019 08:51:27 -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=k8q0w8zJ; 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 S1726766AbfJFPsg (ORCPT + 99 others); Sun, 6 Oct 2019 11:48:36 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53510 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfJFPsf (ORCPT ); Sun, 6 Oct 2019 11:48:35 -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=k8q0w8zJAUI/uFTodVGSSLvx/5 p1MNX3j6Uiy8seGaa0x7M/avIIKGbYUJ43R+nbr8AjDraA3JSoc4mX3dXDuq6V9sNwLjQ2y961O5i XVFuEJv/Df2CU9EunEAmc+7jocmhjANkesUv78uLBDutbOEwtjLHeL9icv+gwrkwpf9xMCCR8uS3e h3+8KaYnW2tD3clJV2zACFWyUVu69f5cPY71ghR/Ws8cBEQFGr2HsZvMKu+35M5Xm5zNlsT+leekj Mm279nS9BJBONgOzR+uZ9Sf0v+TB3cJV2E8k34zMiEmupqxjWeNxLhLd6LdgQ0nvu1rsldpiM+Nty 2yyf2T4A==; Received: from [2001:4bb8:18c:4d4a:c70:4a89:bc61:3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iH8ls-0008SA-RM; Sun, 06 Oct 2019 15:48:33 +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: Sun, 6 Oct 2019 17:46:01 +0200 Message-Id: <20191006154608.24738-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191006154608.24738-1-hch@lst.de> References: <20191006154608.24738-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