[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SN1PR21MB007701814BA71EBCFBF2B884CB8D0@SN1PR21MB0077.namprd21.prod.outlook.com>
Date: Tue, 29 Nov 2016 14:26:40 +0000
From: Matthew Wilcox <mawilcox@...rosoft.com>
To: Randy Dunlap <rdunlap@...radead.org>,
Matthew Wilcox <mawilcox@...uxonhyperv.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Konstantin Khlebnikov <koct9i@...il.com>,
Ross Zwisler <ross.zwisler@...ux.intel.com>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: RE: [PATCH v3 24/33] radix-tree: Add radix_tree_split
From: Randy Dunlap [mailto:rdunlap@...radead.org]
> > +void radix_tree_iter_replace(struct radix_tree_root *,
> > + const struct radix_tree_iter *, void **slot, void *item);
>
> > +int radix_tree_split(struct radix_tree_root *, unsigned long index,
> > + unsigned new_order);
>
> and above:
>
> As indicated in CodingStyle:
> In function prototypes, include parameter names with their data types.
> Although this is not required by the C language, it is preferred in Linux
> because it is a simple way to add valuable information for the reader.
I think the rule here should be a bit more nuanced. I think it is positively criminal to have an unnamed 'unsigned long' or 'bool' in a function prototype. But what extra information is communicated by adding 'root' after 'struct radix_tree_root *'? I know it's a root, you told me that with the structure name!
Obviously sometimes it would be useful, for example if we had a function to move an entry from one radix tree to another, you might want to have 'struct radix_tree_root *old, struct radix_tree_root *new' as two of your parameters.
> > int radix_tree_join(struct radix_tree_root *, unsigned long index,
> > unsigned new_order, void *);
>
> Yes, the source file already omits some function prototype parameter names,
> so these patches just follow that tradition. It's weird (to me) though that
> the existing code even mixes this style in one function prototype (see
> immed. above).
I agree that void * should probably be named (as new_entry). Naming index and new_order is correct. But again, there's no useful information given by naming root.
Powered by blists - more mailing lists