Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2527007rdg; Mon, 16 Oct 2023 07:11:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDNyKDGa41IHLde6zMMnUKjs1W2wpE68xtcdpwiXh4BzbPHxlzIwx40v3ru8hN9iHhrXgv X-Received: by 2002:a05:6a00:1389:b0:6b2:6835:2a82 with SMTP id t9-20020a056a00138900b006b268352a82mr8792931pfg.13.1697465487256; Mon, 16 Oct 2023 07:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697465487; cv=none; d=google.com; s=arc-20160816; b=u3AR8r41F7jvt6PFVD7u5B1SO0gU2+L0YiTr2srXnphhWTPtS58MvhzxB7N45cJcl3 UzWMuHOHACF48hbC41DVkQ7M7GlFbQVsCVHLvt/f1Rhz8nBVOGVTama1e/+CKjsHnwHA 7nc5yTPpgjtOALqkfzVdeuYELNd0NvuHqSWwCB7esMmyM/8I8DZociyUpTge2Egpyfkx NPtR1IAMi2s+K3yZt/khCbW24hn1d5yYyV9ZqXcSG+fmAHqjhycEraxzSSELB/BvsWfG Sz9CHZ4PT5OX7DRhfQAh2VB4QlYshynwHig9NyB9ebigyAYzA/xGuyU0iuetYq7fWQPN 2fMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=czV84VhOyQlJV3boH+4QfGzVmblLtaU2dw7F3ceDF1A=; fh=3SG/n9obsiGYEka8O9aIb5XdHpOnwoFIP3taAO90IdM=; b=jvs5uhhzZDEC+R9DoAPSPG3se0ZrIjwIJb+ojs+bWj9s/rIB/jtHKuEA2RApvhuZs0 kULHgAE+lUYdMR3oy1fdZzvJyuEUNUtNPDS0ZRiverA+d1LQD1HjcGGzEIUER84JOlNB 59dVZdOge2EWSvqC+IY+vQkCeMm5aeJsRlQf4g4Ov64wFFcULpANxLF4MCdCHwWJufyr 5MBxp4I/r3QjvRNnc9nr6WFRI9Q5+JG9qUkDfK6if0jZcbWxz9hH/HVWeAhiMM0IO7Jq yVSkUU8w/Ex9y40uyryNaHnUf8Uggpo1M8ott2Vropg9PrvXLHnBlKNFIj9AwAkHC/kq yVvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AdtBRvrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k9-20020a635609000000b005638179cecasi10147673pgb.833.2023.10.16.07.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 07:11:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AdtBRvrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 022858059179; Mon, 16 Oct 2023 07:11:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233374AbjJPOLQ (ORCPT + 99 others); Mon, 16 Oct 2023 10:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbjJPOLP (ORCPT ); Mon, 16 Oct 2023 10:11:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 175A29B; Mon, 16 Oct 2023 07:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=czV84VhOyQlJV3boH+4QfGzVmblLtaU2dw7F3ceDF1A=; b=AdtBRvrY0I7rDxLM3v6Xhb14vK pgYuVcXg9Fc97jR6r0nofizvmWPF7ePoe3c518Uiix2HWu8YOKh9+jkLQaO/SLHahQf9hf1ZKSo4Z QuYvPyeMoXlz130uNdkiG9okgrwfKPybajkRTryFhfDHVlpw3dKqhXBxpDtY3dTajR640O/16fDG3 aLJonvWi/fNtdnYvbFHdHtt4UYGEZJtOJqsy8ySp5XydZXV4xycLu6wCZbsDaNolEcr1flKH9wbSB XuPeRhrD7TVuwT8XQo+8UEurGWyZSjnyj1siPNHt3Zd0d6YBjt1bPsDkY3leLRpkJ1zwGeAOmqiaZ mJdmezOQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qsOIT-006Str-8h; Mon, 16 Oct 2023 14:10:17 +0000 Date: Mon, 16 Oct 2023 15:10:17 +0100 From: Matthew Wilcox To: Peng Zhang Cc: Liam.Howlett@oracle.com, corbet@lwn.net, akpm@linux-foundation.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com, mst@redhat.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Message-ID: References: <20231016032226.59199-1-zhangpeng.00@bytedance.com> <20231016032226.59199-4-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231016032226.59199-4-zhangpeng.00@bytedance.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 07:11:25 -0700 (PDT) On Mon, Oct 16, 2023 at 11:22:19AM +0800, Peng Zhang wrote: > +++ b/lib/maple_tree.c > @@ -4,6 +4,10 @@ > * Copyright (c) 2018-2022 Oracle Corporation > * Authors: Liam R. Howlett > * Matthew Wilcox > + * > + * Algorithm for duplicating Maple Tree > + * Copyright (c) 2023 ByteDance > + * Author: Peng Zhang You can't copyright an algorithm. You can copyright the _implementation_ of an algorithm. You have a significant chunk of code in this file, so adding your copyright is reasonable (although not legally required, AIUI). Just leave out this line: + * Algorithm for duplicating Maple Tree > +/** > + * __mt_dup(): Duplicate an entire maple tree > + * @mt: The source maple tree > + * @new: The new maple tree > + * @gfp: The GFP_FLAGS to use for allocations > + * > + * This function duplicates a maple tree in Depth-First Search (DFS) pre-order > + * traversal. It uses memcopy() to copy nodes in the source tree and allocate memcpy()? > +int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp) > +{ > + int ret = 0; > + MA_STATE(mas, mt, 0, 0); > + MA_STATE(new_mas, new, 0, 0); > + > + mas_dup_build(&mas, &new_mas, gfp); > + > + if (unlikely(mas_is_err(&mas))) { > + ret = xa_err(mas.node); > + if (ret == -ENOMEM) > + mas_dup_free(&new_mas); > + } > + > + return ret; > +} > +EXPORT_SYMBOL(__mt_dup); Why does it need to be exported?