Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1085775pxb; Thu, 19 Aug 2021 20:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+9O8ULWrtQ60/SUpz120qT6ExgKSWOXfEsfky/oepZJrfsXVdVMJFWr7rn0jJ0vn88C6N X-Received: by 2002:a17:906:34c8:: with SMTP id h8mr18320883ejb.124.1629428614946; Thu, 19 Aug 2021 20:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629428614; cv=none; d=google.com; s=arc-20160816; b=0D7CO165BakzhI2La20J/AuiLbSwivD4B6Wq/fHWS0Gfl7NKZH7CmZMf68NgmrklpH BBpJRpMS00VwHZ6i3IDqBqDcUkPmjf0O2nDN6yaOh96+G14JD7nxcqmy6LKmVf6Tz1Jv yDECKDNEEC8DsymAaqXK18s0Ww+Y/FOfWSu0EICMQt4rrU+lhblq88hX9zB6iXKdvhar +6Vm8tNQkpwURywkj0kUiTPclpDxch7ZFltavt+PAYAbNvHUkJxrL9/X5PL5xkuJsvKK 3T5JdRPeJovgaGUyLCmSdXAJ0uLJcqyO4apTKlnHqJFT+j88AGm+Q882YysrNWl79jaL Y2zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f+qoHaIYFFF4+QiXB7j7KUJJJiqOIA/zGN5Tjr436H8=; b=z+nHyXXJet8u6kDaXHRIVxxggdE7K08h8ypr3Qp3yIpn+OEsWCbKmuvOgGyLYVuc36 b+9kNQSu11/1iK9Q980FcejFgraxtvhWJWzDHxhOL0eas61eOQ2GNCnVdUqAsVGI4U8s Veh4Q3QeNh4xYXAvU29xAmB6sXZHo5xhwHNM9fDlgqDIrPABU/7slmyohWYyVaix2G3C beMBxUVlBAqnQf/eLWAAhtXhQBkksQTOR/d5svwuCdcmRHXz/kkSPvl3XJB7NRiwZ4UM +HPTm3tFatWqOQTUyqWFRVnK0qw8RkihiF66WHdPFBQ0yGaPHWRasQbyUe6vhv5DJx/Y B9Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="kuG8T90/"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hx2si4988703ejc.705.2021.08.19.20.03.12; Thu, 19 Aug 2021 20:03:34 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="kuG8T90/"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237984AbhHTDB5 (ORCPT + 99 others); Thu, 19 Aug 2021 23:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237866AbhHTDB4 (ORCPT ); Thu, 19 Aug 2021 23:01:56 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D0AC061757 for ; Thu, 19 Aug 2021 20:01:19 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id h1so555851pjs.2 for ; Thu, 19 Aug 2021 20:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f+qoHaIYFFF4+QiXB7j7KUJJJiqOIA/zGN5Tjr436H8=; b=kuG8T90/qXgx0IHMQpBfZ+mBvJWi6GWu2OW94VNop4bdF/v0Ajv0stPWwAdY39B7n5 0aB+dCe80t5j46UCI0ZvrGeJn0mFR9VX8hnhHUJdfbFaCMx8Ho5EDzzMsYlp/3xPaxLp j/WFNlI2US+mpDGvS1ZH0lQnqTZSvh7wVwgww7oJS4uXDcSBDIsNWJnDKsF6br0hov4a 220s+hY2spVwQdy7e4PmmtHuKjhrUBgOXmxZteVxKw0AfKz7XUvv7eyiZialc1aa32ND VO3oxca5GGNZpDrFx8Dt2JhAsxvFZSw6J2ewu9KXmYD+BVvuonFZp0Df7/aF1vGZI2u+ JfLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f+qoHaIYFFF4+QiXB7j7KUJJJiqOIA/zGN5Tjr436H8=; b=PfxqNAAvV72+PyM/vRYwbHSwW/1eJrxOEpcdXL2g/In7G3UIUHLIk+XWBZmOYvK+aL 0XtP6W6e3m+gArm+ZcaVtL86lJDP+rKzb1fFuTwN+7YP+1xE5G5T69LHHP6FbOb22Dq7 6xRNMcGPEkNDXTI6KfGXaKN5atPQHCkhlfx2vP2gbydwMAJ6Gwpwu7cOVoN3VbN/3A5V nLVe4BjpYsoqKfrgDlsuHy6GOAVBU8OwY6I4hIEUVHL4MEaYt1ruTFUlyjt5WMngEWAp hJKZBqfun8MXF+ZUnf/xGGtIg8rQt0X9eIkuvjzdkzr44XshoADivEVhgtQgvhXpxFyd u8ow== X-Gm-Message-State: AOAM533rekv0tewaj8wZpmgv+n9Bav56++/eoraQ2kM1NBPqvDwEgD3k /Tak/to0yFp0BeJo5UESuY3RxtbugProFttBWp05jA== X-Received: by 2002:a17:902:9b95:b0:130:6a7b:4570 with SMTP id y21-20020a1709029b9500b001306a7b4570mr2784453plp.27.1629428479249; Thu, 19 Aug 2021 20:01:19 -0700 (PDT) MIME-Version: 1.0 References: <20210816060359.1442450-1-ruansy.fnst@fujitsu.com> <20210816060359.1442450-8-ruansy.fnst@fujitsu.com> In-Reply-To: <20210816060359.1442450-8-ruansy.fnst@fujitsu.com> From: Dan Williams Date: Thu, 19 Aug 2021 20:01:08 -0700 Message-ID: Subject: Re: [PATCH v7 7/8] fsdax: Introduce dax_iomap_ops for end of reflink To: Shiyang Ruan Cc: "Darrick J. Wong" , Christoph Hellwig , linux-xfs , david , linux-fsdevel , Linux Kernel Mailing List , Linux NVDIMM , Goldwyn Rodrigues , Al Viro , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 15, 2021 at 11:05 PM Shiyang Ruan wrote: > > After writing data, reflink requires end operations to remap those new > allocated extents. The current ->iomap_end() ignores the error code > returned from ->actor(), so we introduce this dax_iomap_ops and change > the dax_iomap_*() interfaces to do this job. > > - the dax_iomap_ops contains the original struct iomap_ops and fsdax > specific ->actor_end(), which is for the end operations of reflink > - also introduce dax specific zero_range, truncate_page > - create new dax_iomap_ops for ext2 and ext4 > > Signed-off-by: Shiyang Ruan > --- > fs/dax.c | 68 +++++++++++++++++++++++++++++++++++++----- > fs/ext2/ext2.h | 3 ++ > fs/ext2/file.c | 6 ++-- > fs/ext2/inode.c | 11 +++++-- > fs/ext4/ext4.h | 3 ++ > fs/ext4/file.c | 6 ++-- > fs/ext4/inode.c | 13 ++++++-- > fs/iomap/buffered-io.c | 3 +- > fs/xfs/xfs_bmap_util.c | 3 +- > fs/xfs/xfs_file.c | 8 ++--- > fs/xfs/xfs_iomap.c | 36 +++++++++++++++++++++- > fs/xfs/xfs_iomap.h | 33 ++++++++++++++++++++ > fs/xfs/xfs_iops.c | 7 ++--- > fs/xfs/xfs_reflink.c | 3 +- > include/linux/dax.h | 21 ++++++++++--- > include/linux/iomap.h | 1 + > 16 files changed, 189 insertions(+), 36 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 74dd918cff1f..0e0536765a7e 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -1348,11 +1348,30 @@ static loff_t dax_iomap_iter(const struct iomap_iter *iomi, > return done ? done : ret; > } > > +static inline int > +__dax_iomap_iter(struct iomap_iter *iter, const struct dax_iomap_ops *ops) > +{ > + int ret; > + > + /* > + * Call dax_iomap_ops->actor_end() before iomap_ops->iomap_end() in > + * each iteration. > + */ > + if (iter->iomap.length && ops->actor_end) { > + ret = ops->actor_end(iter->inode, iter->pos, iter->len, > + iter->processed); > + if (ret < 0) > + return ret; > + } > + > + return iomap_iter(iter, &ops->iomap_ops); This reorganization looks needlessly noisy. Why not require the iomap_end operation to perform the actor_end work. I.e. why can't xfs_dax_write_iomap_actor_end() just be the passed in iomap_end? I am not seeing where the ->iomap_end() result is ignored?