Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1006974pxb; Thu, 26 Aug 2021 22:02:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1EeQ2kRx+H8RRqgHzu2Y/PCU9DTWDTyA60kOTBRu4As71MKhMZUUPByCLWfY2XNdAUc// X-Received: by 2002:a05:6402:157:: with SMTP id s23mr7994076edu.36.1630040545816; Thu, 26 Aug 2021 22:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630040545; cv=none; d=google.com; s=arc-20160816; b=Ri+mXJjBHa3mY2xePSbswVxuG4WhOO3310TUeHvh8wthEIesHdE6bimM4pwiujLt7v fVmdAjAND5O0h25ef+hNIYa4ok8HWPib1Xd0jAjBL0PA9WFLDdJLNgGILqSmRF3WpUUH cLK26Rj9KqkCrJdMdtRqPluw1jb4T9se4+8c6ctikesuztNT+81+TnZNEWwc09GWHRS4 74amNeBaldQcdSkq7jv6l5IaFTgnjDVVo6ekGwTirVXD9ojKLMr7mJVVnnb3Bn/8uRtM v6MYkwwehgFMCzaNGhEDCZNjX1f6UAMcH8LUVQ/XSiYVHMWp9x7W3sPdZfhScROpzpU5 2xKA== 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=5od/kUgahC3y4f1RegWK6+73V4iglz5jm4qob9t0vVA=; b=NgktaBi1K0ZSxqzB2fNbb/WS1v0aNF9QxAHIq+iyUXMG/pRE3vnAkQy1wz6NS1uyOm PBuKKjzVpMhdh5m2DKLRc+tfbYjgV5vVNum0ogwzYIh7kOjNaqNb2O8jx7JgEdf8chd8 KMpw1n9L0wiWK4AXXrzwocVaoSJbO0MHwB0+eMzdL912XrsTt3QzvbgtfMfyvD8RuSv4 RZ+fbY9ldaVTpLSu+gPV+nnU3AzgrdJBoMIdQTzH+lNXPXvGHlNJEi8arliEJAx0y2Xs AvxtTCBnWmcCIIYzTMJmDY4v9PA7rxduj7Eb2kH97r31NbKMmPnQp/vbJ/8wbsBJIOvy VZHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=BSu7p4nm; 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 dr8si6584213ejc.133.2021.08.26.22.02.02; Thu, 26 Aug 2021 22:02:25 -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=BSu7p4nm; 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 S229645AbhH0FBX (ORCPT + 99 others); Fri, 27 Aug 2021 01:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231164AbhH0FBW (ORCPT ); Fri, 27 Aug 2021 01:01:22 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA11C0613CF for ; Thu, 26 Aug 2021 22:00:34 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id t42so4653512pfg.12 for ; Thu, 26 Aug 2021 22:00:34 -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=5od/kUgahC3y4f1RegWK6+73V4iglz5jm4qob9t0vVA=; b=BSu7p4nmJtMlK80d5oAhh7aFXPoGGP+gl+hWZhWWIym1U6RhBLlAe/5bDvao/kKQAb F39MWe9mIjaOnTpfH0sgCcSh4cuXrGB6gDl0qrmlTddQzhzT8/Y7tfrP9EJm+wgSKeyR YI9BJmpRsJNULOYGZDCFXG3Z52Al39rgl3cMQTZmGMp3uZyNRxFbN0typYd/gfbgCyan LNge0leybWB0kT3kk7W1+86pqLCXA7QIHKUc7zyBr5jt3Z5THZ430BUoxy/REUuce2/G Fv36xRBwtc6uC6mupKmmmNaDkbND8kdsV+OgqlhOEw0jJEjDLFYZJIJerQd+Kcj1mqEm 8U9A== 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=5od/kUgahC3y4f1RegWK6+73V4iglz5jm4qob9t0vVA=; b=mXGlUVaHQvj5c5TOVIZDCRnssyeUBxnC7muSltTBI/E5pUtY3U1cPC+Rk6mU3TkT9s pCYJ9QvAF2cB7ZsDp6Stejm4D/64LYi4i0oQCAL2bIMe32e2PpFNd7xCepvjOML8ga8N IBYS2bj7or3VhBECt9hHIwUUWE8trpSBMWZRdS79fryM40jLDjScs8W8ilauAQlFIUxE NhTv6uP8okV7oC4oUM5KheQuhMVLQYNhKFt+Q7O6DvYbuXs30WAVmkauUg6EiiMQVJqU Zu0H1tGIobI0kZcMS+/GoW07LK2LwkdvZ1EAqwdBVydmFn/KdIyayZPIvYmpLxtPP4Y8 Jlfw== X-Gm-Message-State: AOAM530nIJ+bCIX+/Hr4MsG3U6EE68uWh3mDpeNcEZwAykww8zLRxbW0 AN7a5PAvcmGd6b1Qqy2K9D4q2VsUXau8pNjYoihjSg== X-Received: by 2002:aa7:818c:0:b0:3f1:e024:dcbc with SMTP id g12-20020aa7818c000000b003f1e024dcbcmr7357771pfi.31.1630040433928; Thu, 26 Aug 2021 22:00:33 -0700 (PDT) MIME-Version: 1.0 References: <20210816060359.1442450-1-ruansy.fnst@fujitsu.com> <20210816060359.1442450-4-ruansy.fnst@fujitsu.com> <20210823125715.GA15536@lst.de> In-Reply-To: From: Dan Williams Date: Thu, 26 Aug 2021 22:00:23 -0700 Message-ID: Subject: Re: [PATCH v7 3/8] fsdax: Replace mmap entry in case of CoW To: Shiyang Ruan Cc: Christoph Hellwig , "Darrick J. Wong" , linux-xfs , david , linux-fsdevel , Linux Kernel Mailing List , Linux NVDIMM , Goldwyn Rodrigues , Al Viro , Matthew Wilcox , Goldwyn Rodrigues , Ritesh Harjani Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 26, 2021 at 8:22 PM Shiyang Ruan wrote: > > > > On 2021/8/23 20:57, Christoph Hellwig wrote: > > On Thu, Aug 19, 2021 at 03:54:01PM -0700, Dan Williams wrote: > >> > >> static void *dax_insert_entry(struct xa_state *xas, struct vm_fault *vmf, > >> const struct iomap_iter *iter, void > >> *entry, pfn_t pfn, > >> unsigned long flags) > >> > >> > >>> { > >>> + struct address_space *mapping = vmf->vma->vm_file->f_mapping; > >>> void *new_entry = dax_make_entry(pfn, flags); > >>> + bool dirty = insert_flags & DAX_IF_DIRTY; > >>> + bool cow = insert_flags & DAX_IF_COW; > >> > >> ...and then calculate these flags from the source data. I'm just > >> reacting to "yet more flags". > > > > Except for the overly long line above that seems like a good idea. > > The iomap_iter didn't exist for most of the time this patch has been > > around. > > > > So should I reuse the iter->flags to pass the insert_flags? (left shift > it to higher bits) No, the advice is to just pass the @iter to dax_insert_entry directly and calculate @dirty and @cow internally.