From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Dichtel Subject: Re: [RFC PATCH linux 2/2] fs/proc: use a hash table for the directory entries Date: Fri, 03 Oct 2014 15:07:14 +0200 Message-ID: <542E9F82.20709@6wind.com> References: <20131003.150947.2179820478039260398.davem@davemloft.net> <1412263501-6572-1-git-send-email-nicolas.dichtel@6wind.com> <1412263501-6572-3-git-send-email-nicolas.dichtel@6wind.com> Reply-To: nicolas.dichtel@6wind.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: netdev , Linux Kernel , David Miller , "Eric W. Biederman" , Andrew Morton , rui.xiang@huawei.com, Al Viro , Oleg Nesterov , Cyrill Gorcunov , kirill.shutemov@linux.intel.com, Grant Likely , Theodore Ts'o , Thierry Herbelot To: Alexey Dobriyan Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Le 03/10/2014 12:55, Alexey Dobriyan a =C3=A9crit : > On Thu, Oct 2, 2014 at 6:25 PM, Nicolas Dichtel > wrote: >> --- a/fs/proc/generic.c >> +++ b/fs/proc/generic.c >> @@ -81,10 +81,13 @@ static int __xlate_proc_name(const char *name, s= truct proc_dir_entry **ret, > >> + if (!S_ISDIR(de->mode)) >> + return -EINVAL; > > There are way too many S_ISDIR checks. > In lookup and readdir, it is guaranteed that PDE is directory. > > I'd say all of them aren't needed because non-directories have > ->subdir =3D NULL and > directories have ->subdir !=3D NULL which transforms into hashtable o= r > rbtree or whatever, > so you only need to guarantee only directories appear where they are > expected and > fearlessly use your new data structure traversing directories. To be honest, they was put during the debug stage and I hesitated to re= move them at the end. I will remove them! Thank you, Nicolas