[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2e7c9f1-7152-1d74-c434-c2c4d57d0422@huawei.com>
Date: Sat, 30 Nov 2019 15:53:10 +0800
From: "yukuai (C)" <yukuai3@...wei.com>
To: Matthew Wilcox <willy@...radead.org>
CC: <gregkh@...uxfoundation.org>, <rafael@...nel.org>,
<viro@...iv.linux.org.uk>, <rostedt@...dmis.org>,
<oleg@...hat.com>, <mchehab+samsung@...nel.org>, <corbet@....net>,
<tytso@....edu>, <jmorris@...ei.org>,
<linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<zhengbin13@...wei.com>, <yi.zhang@...wei.com>,
<chenxiang66@...ilicon.com>, <xiexiuqi@...wei.com>
Subject: Re: [PATCH V2 1/3] dcache: add a new enum type for
'dentry_d_lock_class'
On 2019/11/30 11:43, Matthew Wilcox wrote:
> On Sat, Nov 30, 2019 at 10:02:23AM +0800, yu kuai wrote:
>> However, a single 'DENTRY_D_LOCK_NESTED' may not be enough if more than
>> two dentry are involed. So, add in 'DENTRY_D_LOCK_NESTED_TWICE'.
>
> No. These need meaningful names. Indeed, I think D_LOCK_NESTED is
> a terrible name.
>
> Looking at the calls:
>
> $ git grep -n nested.*d_lock fs
> fs/autofs/expire.c:82: spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
> fs/dcache.c:619: spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
> fs/dcache.c:1086: spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
> fs/dcache.c:1303: spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
> fs/dcache.c:2822: spin_lock_nested(&old_parent->d_lock, DENTRY_D_LOCK_NESTED);
> fs/dcache.c:2827: spin_lock_nested(&target->d_parent->d_lock,
> fs/dcache.c:2830: spin_lock_nested(&dentry->d_lock, 2);
> fs/dcache.c:2831: spin_lock_nested(&target->d_lock, 3);
> fs/dcache.c:3121: spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
> fs/libfs.c:112: spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
> fs/libfs.c:341: spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
> fs/notify/fsnotify.c:129: spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
>
> Most of these would be well-expressed by DENTRY_D_LOCK_CHILD.
>
> The exception is __d_move() where I think we should actually name the
> different lock classes instead of using a bare '2' and '3'. Something
> like this, perhaps:
>
Thanks for looking into this, do you mind if I replace your patch with
the first two patches in the patchset?
Yu Kuai
Powered by blists - more mailing lists