[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e2f1120-9889-445e-8b88-d7b6cb0e0843@bytedance.com>
Date: Tue, 17 Oct 2023 10:44:49 +0800
From: Peng Zhang <zhangpeng.00@...edance.com>
To: Matthew Wilcox <willy@...radead.org>
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,
Peng Zhang <zhangpeng.00@...edance.com>
Subject: Re: [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and
mtree_dup()
在 2023/10/16 22:10, Matthew Wilcox 写道:
> 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
Okay, I will make the correction, thank you.
>
>> +/**
>> + * __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()?
Yes, thank you for pointing this out.
>
>> +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?
I consider __mt_dup() as a general interface for Maple Tree,
uncertain whether it will be used by certain modules in the future.
>
>
Powered by blists - more mailing lists