From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE8703FC4 for ; Mon, 23 Aug 2021 13:02:51 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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) 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.