lkml.org 
[lkml]   [2018]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] fs/dcache: Avoid the try_lock loops in dentry_kill()
On Tue, Feb 20, 2018 at 12:34:57AM +0100, John Ogness wrote:
> Implementation 2: Using switch on a dentry_lock_inode() that returns a
> tristate value. Does not support branch prediction. This approach is
> probably easiest to understand.
>
> /*
> * Lock the inode. Might drop dentry->d_lock temporarily
> * which allows inode to change. Start over if that happens.
> */
> switch (dentry_lock_inode(dentry)) {
> case LOCK_FAST:

Bah, I just checked, you cannot use GCC label attributes on statements
:/ Otherwise you could've done:

case LOCK_FAST: __attribute__((hot));

> break;
> case LOCK_SLOW:
> /*
> * Recheck refcount as it might have been
> * incremented while d_lock was dropped.
> */
> if (unlikely(dentry->d_lockref.count != 1))
> goto drop_ref;
> break;
> case LOCK_FAILED:
> goto again;
> }
>

\
 
 \ /
  Last update: 2018-02-20 14:04    [W:0.108 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site