[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1611235185-1685-6-git-send-email-gautham.ananthakrishna@oracle.com>
Date: Thu, 21 Jan 2021 18:49:44 +0530
From: Gautham Ananthakrishna <gautham.ananthakrishna@...cle.com>
To: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org
Cc: viro@...iv.linux.org.uk, matthew.wilcox@...cle.com,
khlebnikov@...dex-team.ru, gautham.ananthakrishna@...cle.com
Subject: [PATCH RFC 5/6] dcache: push releasing dentry lock into sweep_negative
From: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Release the dentry lock inside the sweep_negative() function. This
is in preparation for a follow up patch and doesn't change runtime
behavior.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Signed-off-by: Gautham Ananthakrisha <gautham.ananthakrishna@...cle.com>
---
fs/dcache.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 492a42f..22c990b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -638,13 +638,14 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
* Must be called at dput of negative dentry.
*/
static void sweep_negative(struct dentry *dentry)
+ __releases(dentry->d_lock)
{
struct dentry *parent;
if (!d_is_tail_negative(dentry)) {
parent = lock_parent(dentry);
if (!parent)
- return;
+ goto out;
if (!d_count(dentry) && d_is_negative(dentry) &&
!d_is_tail_negative(dentry)) {
@@ -654,6 +655,8 @@ static void sweep_negative(struct dentry *dentry)
spin_unlock(&parent->d_lock);
}
+out:
+ spin_unlock(&dentry->d_lock);
}
/*
@@ -922,7 +925,8 @@ void dput(struct dentry *dentry)
if (likely(retain_dentry(dentry))) {
if (d_is_negative(dentry))
sweep_negative(dentry);
- spin_unlock(&dentry->d_lock);
+ else
+ spin_unlock(&dentry->d_lock);
return;
}
--
1.8.3.1
Powered by blists - more mailing lists