From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06591C4338F for ; Mon, 23 Aug 2021 13:02:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D900F61374 for ; Mon, 23 Aug 2021 13:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236917AbhHWNDe (ORCPT ); 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-xfs@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.