Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1841910pxb; Mon, 23 Aug 2021 06:05:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx190XMf4bpykCwmHajbTNrkxFIBkMwjz4JAfdB8o7To7x9xgIOX0MPzDQFPtuXbc6QTr8J X-Received: by 2002:a05:6e02:10c2:: with SMTP id s2mr22813993ilj.148.1629723943786; Mon, 23 Aug 2021 06:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629723943; cv=none; d=google.com; s=arc-20160816; b=A85lQPyfgN0DaH7NxtoJcurkK3vt+Ocy/F8ZBmbPYmjbtVRlXz6NmvSvNY9JfylGIb qfplt9M0m7kuH7amMfuk1oCuLErwWR/UHrXARJoH6/a5kdckaJpY681Sy1MPEFrriw8F odM7MsBZocoWaW0GgMBPR+w4yBnpTdLoxDtfRdEiXD3ePl4ifjkaLfAk1UE4VwwO0TDa 5efluZ/GqsxY+CR9xLmgunY6dK4WY8i0890UBi+G8Us6VbnW6tNFIMGX09ddeOvMHNNy 27YxOxFaxlzLT090RQHRZLdTDwujeDuYdyqmMYUqxok/4kURnXX2G2qjX7rhZEyHH+AF tuYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=n0EdUMYPPruGLXWCWNRjOBiPyBAxeBKhntYL/Xh2mlc=; b=NzHl/1MgBLnC9lFip0IDR10qEJ8+6Z7mPJG/1c4b5/NbLYrSJACfranBAPDBuppOrO LJTDmOlZUeP201F9B2wpJSX31bNX7IyLzjySXO9b4PeHoVp3/pe5QfzlzUpbtGVT3FGo x12pwKtoOdMrqXi43aEhu12NSn1Qy2tzTkTjLynhUksmUTNV4DlQq64bgJjKnqkaLPrO E1BqMMcB6q9w62g7PCLhAl6EocYloUGB2acA0HGA1En1MVKgnHYn0fWIODopPunIDDYu MDok12LPceQjpYYqibIuH20Yf5PnSXjhS/YLeNB/fNWEef7x8eschbsQwUGrGqDxJBxN G0Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si14821434ilj.135.2021.08.23.06.05.31; Mon, 23 Aug 2021 06:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237221AbhHWNDe (ORCPT + 99 others); Mon, 23 Aug 2021 09:03:34 -0400 Received: from verein.lst.de ([213.95.11.211]:47850 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237161AbhHWNDe (ORCPT ); Mon, 23 Aug 2021 09:03:34 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 9BD9767357; Mon, 23 Aug 2021 15:02:48 +0200 (CEST) Date: Mon, 23 Aug 2021 15:02:48 +0200 From: Christoph Hellwig To: Dan Williams Cc: "ruansy.fnst" , "Darrick J. Wong" , Christoph Hellwig , linux-xfs , david , linux-fsdevel , Linux Kernel Mailing List , Linux NVDIMM , Goldwyn Rodrigues , Al Viro , Matthew Wilcox Subject: Re: [PATCH v7 7/8] fsdax: Introduce dax_iomap_ops for end of reflink Message-ID: <20210823130248.GC15536@lst.de> References: <20210816060359.1442450-1-ruansy.fnst@fujitsu.com> <20210816060359.1442450-8-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 08:18:44AM -0700, Dan Williams wrote: > I notice that the @iomap argument to ->iomap_end() is reliably coming > from @iter. So you could do the following in your iomap_end() > callback: > > struct iomap_iter *iter = container_of(iomap, typeof(*iter), iomap); > struct xfs_inode *ip = XFS_I(inode); > ssize_t written = iter->processed; > bool cow = xfs_is_cow_inode(ip); > > if (cow) { > if (written <= 0) > xfs_reflink_cancel_cow_range(ip, pos, length, true) > } I think this might be ok for now (with a big comment). Willy's original iomap iter series replaced the iomap_begin and iomap_end with a single next callback that takes the iomap_iter, which would solve this issue. My plan is to look into a series that implements this and sees if this is indeed a net win.