summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-11 04:02:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-11 04:02:40 +0000
commite47f00743fc4776491344f2c618cc8dc2c23bcbc (patch)
tree13e03a113a82a184c51c19c209867cfd3a59b3b9 /fs/dcache.c
parentb2ad5f821b1381492d792ca10b1eb7a107b48f14 (diff)
Merge with Linux 2.4.0.
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 090bf1686..e0b170ad7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -339,10 +339,18 @@ void prune_dcache(int count)
if (tmp == &dentry_unused)
break;
- dentry_stat.nr_unused--;
list_del_init(tmp);
dentry = list_entry(tmp, struct dentry, d_lru);
+ /* If the dentry was recently referenced, don't free it. */
+ if (dentry->d_flags & DCACHE_REFERENCED) {
+ dentry->d_flags &= ~DCACHE_REFERENCED;
+ list_add(&dentry->d_lru, &dentry_unused);
+ count--;
+ continue;
+ }
+ dentry_stat.nr_unused--;
+
/* Unused dentry with a count? */
if (atomic_read(&dentry->d_count))
BUG();
@@ -732,6 +740,7 @@ struct dentry * d_lookup(struct dentry * parent, struct qstr * name)
continue;
}
__dget_locked(dentry);
+ dentry->d_flags |= DCACHE_REFERENCED;
spin_unlock(&dcache_lock);
return dentry;
}