[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZS1ESVpQ+vY0yDt4@casper.infradead.org>
Date: Mon, 16 Oct 2023 15:10:17 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Peng Zhang <zhangpeng.00@...edance.com>
Cc: Liam.Howlett@...cle.com, corbet@....net, akpm@...ux-foundation.org,
brauner@...nel.org, surenb@...gle.com, michael.christie@...cle.com,
mjguzik@...il.com, mathieu.desnoyers@...icios.com,
npiggin@...il.com, peterz@...radead.org, oliver.sang@...el.com,
mst@...hat.com, maple-tree@...ts.infradead.org, linux-mm@...ck.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and
mtree_dup()
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 <Liam.Howlett@...cle.com>
> * Matthew Wilcox <willy@...radead.org>
> + *
> + * Algorithm for duplicating Maple Tree
> + * Copyright (c) 2023 ByteDance
> + * Author: Peng Zhang <zhangpeng.00@...edance.com>
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?
Powered by blists - more mailing lists