|
@@ -48,7 +48,7 @@
|
|
|
* - the dcache hash table
|
|
|
* s_anon bl list spinlock protects:
|
|
|
* - the s_anon list (see __d_drop)
|
|
|
- * dcache_lru_lock protects:
|
|
|
+ * dentry->d_sb->s_dentry_lru_lock protects:
|
|
|
* - the dcache lru lists and counters
|
|
|
* d_lock protects:
|
|
|
* - d_flags
|
|
@@ -63,7 +63,7 @@
|
|
|
* Ordering:
|
|
|
* dentry->d_inode->i_lock
|
|
|
* dentry->d_lock
|
|
|
- * dcache_lru_lock
|
|
|
+ * dentry->d_sb->s_dentry_lru_lock
|
|
|
* dcache_hash_bucket lock
|
|
|
* s_anon lock
|
|
|
*
|
|
@@ -81,7 +81,6 @@
|
|
|
int sysctl_vfs_cache_pressure __read_mostly = 100;
|
|
|
EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
|
|
|
|
|
|
-static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lru_lock);
|
|
|
__cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);
|
|
|
|
|
|
EXPORT_SYMBOL(rename_lock);
|
|
@@ -362,12 +361,12 @@ static void dentry_unlink_inode(struct dentry * dentry)
|
|
|
static void dentry_lru_add(struct dentry *dentry)
|
|
|
{
|
|
|
if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) {
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
dentry->d_flags |= DCACHE_LRU_LIST;
|
|
|
list_add(&dentry->d_lru, &dentry->d_sb->s_dentry_lru);
|
|
|
dentry->d_sb->s_nr_dentry_unused++;
|
|
|
this_cpu_inc(nr_dentry_unused);
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -385,15 +384,15 @@ static void __dentry_lru_del(struct dentry *dentry)
|
|
|
static void dentry_lru_del(struct dentry *dentry)
|
|
|
{
|
|
|
if (!list_empty(&dentry->d_lru)) {
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
__dentry_lru_del(dentry);
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void dentry_lru_move_list(struct dentry *dentry, struct list_head *list)
|
|
|
{
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
if (list_empty(&dentry->d_lru)) {
|
|
|
dentry->d_flags |= DCACHE_LRU_LIST;
|
|
|
list_add_tail(&dentry->d_lru, list);
|
|
@@ -402,7 +401,7 @@ static void dentry_lru_move_list(struct dentry *dentry, struct list_head *list)
|
|
|
} else {
|
|
|
list_move_tail(&dentry->d_lru, list);
|
|
|
}
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&dentry->d_sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -895,14 +894,14 @@ void prune_dcache_sb(struct super_block *sb, int count)
|
|
|
LIST_HEAD(tmp);
|
|
|
|
|
|
relock:
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&sb->s_dentry_lru_lock);
|
|
|
while (!list_empty(&sb->s_dentry_lru)) {
|
|
|
dentry = list_entry(sb->s_dentry_lru.prev,
|
|
|
struct dentry, d_lru);
|
|
|
BUG_ON(dentry->d_sb != sb);
|
|
|
|
|
|
if (!spin_trylock(&dentry->d_lock)) {
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&sb->s_dentry_lru_lock);
|
|
|
cpu_relax();
|
|
|
goto relock;
|
|
|
}
|
|
@@ -918,11 +917,11 @@ relock:
|
|
|
if (!--count)
|
|
|
break;
|
|
|
}
|
|
|
- cond_resched_lock(&dcache_lru_lock);
|
|
|
+ cond_resched_lock(&sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
if (!list_empty(&referenced))
|
|
|
list_splice(&referenced, &sb->s_dentry_lru);
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&sb->s_dentry_lru_lock);
|
|
|
|
|
|
shrink_dentry_list(&tmp);
|
|
|
}
|
|
@@ -938,14 +937,14 @@ void shrink_dcache_sb(struct super_block *sb)
|
|
|
{
|
|
|
LIST_HEAD(tmp);
|
|
|
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&sb->s_dentry_lru_lock);
|
|
|
while (!list_empty(&sb->s_dentry_lru)) {
|
|
|
list_splice_init(&sb->s_dentry_lru, &tmp);
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&sb->s_dentry_lru_lock);
|
|
|
shrink_dentry_list(&tmp);
|
|
|
- spin_lock(&dcache_lru_lock);
|
|
|
+ spin_lock(&sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
- spin_unlock(&dcache_lru_lock);
|
|
|
+ spin_unlock(&sb->s_dentry_lru_lock);
|
|
|
}
|
|
|
EXPORT_SYMBOL(shrink_dcache_sb);
|
|
|
|