From: Christoph Lameter <cl@linux-foundation.org>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: akpm@linux-foundation.org, Christoph Lameter <cl@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: Mel Gorman <mel@skynet.ie>
Cc: andi@firstfloor.org
Cc: Rik van Riel <riel@redhat.com>
Cc: mpm@selenic.com
Cc: Dave Chinner <david@fromorbit.com>
Subject: [patch 1/3] dentries: Always use list_del_init() when removing a dentry from the lru
Date: Mon, 25 Aug 2008 14:20:36 -0700 [thread overview]
Message-ID: <20080825212053.255444022@quilx.com> (raw)
In-Reply-To: 20080825212035.861870487@quilx.com
[-- Attachment #1: consitent --]
[-- Type: text/plain, Size: 2831 bytes --]
The patch restores what commit 4a0962abd187df29b7d1378b2f372a55667d54c0
already implemented. The feature was subsequently clobbered by
commit da3bbdd4632c0171406b2677e31494afa5bde2f8
Before this patch some execution path use list_del() instead of
list_del_init() which results in inconsitencies in the state of d_lru
when the object is freed.
The performance of list_del_init() and list_del() is the same.
So lets just have one dentry removal function named dentry_lru_del() that always
does a list_del_init().
The result of this patch is that dentry->d_lru is now always empty when a
dentry is freed. The dentry defragmentation patch depends on a defined state
of a dentry on free.
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Index: linux-next/fs/dcache.c
===================================================================
--- linux-next.orig/fs/dcache.c 2008-08-25 15:44:58.000000000 -0500
+++ linux-next/fs/dcache.c 2008-08-25 15:45:59.000000000 -0500
@@ -141,15 +141,6 @@
static void dentry_lru_del(struct dentry *dentry)
{
if (!list_empty(&dentry->d_lru)) {
- list_del(&dentry->d_lru);
- dentry->d_sb->s_nr_dentry_unused--;
- dentry_stat.nr_unused--;
- }
-}
-
-static void dentry_lru_del_init(struct dentry *dentry)
-{
- if (likely(!list_empty(&dentry->d_lru))) {
list_del_init(&dentry->d_lru);
dentry->d_sb->s_nr_dentry_unused--;
dentry_stat.nr_unused--;
@@ -316,7 +307,7 @@
static inline struct dentry * __dget_locked(struct dentry *dentry)
{
atomic_inc(&dentry->d_count);
- dentry_lru_del_init(dentry);
+ dentry_lru_del(dentry);
return dentry;
}
@@ -432,7 +423,7 @@
if (dentry->d_op && dentry->d_op->d_delete)
dentry->d_op->d_delete(dentry);
- dentry_lru_del_init(dentry);
+ dentry_lru_del(dentry);
__d_drop(dentry);
dentry = d_kill(dentry);
spin_lock(&dcache_lock);
@@ -492,7 +483,7 @@
}
while (!list_empty(&tmp)) {
dentry = list_entry(tmp.prev, struct dentry, d_lru);
- dentry_lru_del_init(dentry);
+ dentry_lru_del(dentry);
spin_lock(&dentry->d_lock);
/*
* We found an inuse dentry which was not removed from
@@ -621,7 +612,7 @@
/* detach this root from the system */
spin_lock(&dcache_lock);
- dentry_lru_del_init(dentry);
+ dentry_lru_del(dentry);
__d_drop(dentry);
spin_unlock(&dcache_lock);
@@ -635,7 +626,7 @@
spin_lock(&dcache_lock);
list_for_each_entry(loop, &dentry->d_subdirs,
d_u.d_child) {
- dentry_lru_del_init(loop);
+ dentry_lru_del(loop);
__d_drop(loop);
cond_resched_lock(&dcache_lock);
}
@@ -817,7 +808,7 @@
struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
next = tmp->next;
- dentry_lru_del_init(dentry);
+ dentry_lru_del(dentry);
/*
* move only zero ref count dentries to the end
* of the unused list for prune_dcache
--
next prev parent reply other threads:[~2008-08-25 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-25 21:20 [patch 0/3] Dentry support for Slab Fragmentation Reduction Christoph Lameter
2008-08-25 21:20 ` Christoph Lameter [this message]
2008-08-31 14:50 ` [patch 1/3] dentries: Always use list_del_init() when removing a dentry from the lru Pekka Enberg
2008-08-25 21:20 ` [patch 2/3] dentries: Add constructor Christoph Lameter
2008-08-31 14:50 ` Pekka Enberg
2008-08-25 21:20 ` [patch 3/3] dentries: dentry defragmentation Christoph Lameter
2008-08-31 14:50 ` Pekka Enberg
2008-09-01 7:28 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080825212053.255444022@quilx.com \
--to=cl@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.