lkml.org 
[lkml]   [2019]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: introduce is_dot_dotdot helper for cleanup
On Tue, Dec 03, 2019 at 10:07:41AM +0800, Tiezhu Yang wrote:
> On 12/03/2019 04:03 AM, Matthew Wilcox wrote:
> > On Mon, Dec 02, 2019 at 06:10:13PM +0800, Tiezhu Yang wrote:
> > > There exists many similar and duplicate codes to check "." and "..",
> > > so introduce is_dot_dotdot helper to make the code more clean.
> > The idea is good. The implementation is, I'm afraid, badly chosen.
> > Did you benchmark this change at all? In general, you should prefer the
>
> Thanks for your reply and suggestion. I measured the
> performance with the test program, the following
> implementation is better for various of test cases:
>
> bool is_dot_dotdot(const struct qstr *str)
> {
> if (unlikely(str->name[0] == '.')) {
> if (str->len < 2 || (str->len == 2 && str->name[1] == '.'))
> return true;
> }
>
> return false;
> }
>
> I will send a v2 patch used with this implementation.

Well, hang on. If you haven't done any benchmarking, please do so
before sending a v2. In particular, you've now moved this to being a
function call. That might slow things down, or it might speed things up.
I also don't know if passing a qstr is going to be the right API --
let's hear from the filesystems affected by the API change that they're
OK with this change.

\
 
 \ /
  Last update: 2019-12-03 03:49    [W:0.060 / U:9.856 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site