lkml.org 
[lkml]   [2022]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RESEND PATCH v7 7/8] kernfs: Replace per-fs rwsem with hashed rwsems.
From
Hello Al,

On 22/3/22 1:40 pm, Al Viro wrote:
[...]
>
> Sorry, misread that thing - the reason it copies the damn thing at all is
> the use of strsep(). Yecch... Rule of the thumb regarding strsep() use,
> be it in kernel or in the userland: don't. It's almost never the right
> primitive to use.
>
> Lookups should use qstr; it has both the length and place for hash.
> Switch kernfs_find_ns() to that (and lift the calculation of length
> into the callers that do not have it - note that kernfs_iop_lookup()
> does) and you don't need the strsep() shite (or copying) anymore.
>

Regarding using qstr in kernfs_find_ns, do you mean that I should remove
->name and ->hash with a ->qstr in kernfs_node and further modify
kernfs_name_compare to make use of qstr.name and qstr.hash.

Also the suggestion about removing buffer copying from kernfs_walk_ns is
not clear to me because kernfs_walk_ns invokes kernfs_find_ns with
individual path components so we need some mechanism to separate path
components.

Sorry if I have missed or misunderstood something in your suggestion.

Thanks,
-- Imran

\
 
 \ /
  Last update: 2022-03-28 02:17    [W:0.112 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site