Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
1a81bb8a
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a81bb8a
编写于
5月 13, 2010
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Clean up nfs_access_zap_cache()
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
61d5eb29
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
29 deletion
+31
-29
fs/nfs/dir.c
fs/nfs/dir.c
+31
-29
未找到文件。
fs/nfs/dir.c
浏览文件 @
1a81bb8a
...
...
@@ -1697,6 +1697,17 @@ static void nfs_access_free_entry(struct nfs_access_entry *entry)
smp_mb__after_atomic_dec
();
}
static
void
nfs_access_free_list
(
struct
list_head
*
head
)
{
struct
nfs_access_entry
*
cache
;
while
(
!
list_empty
(
head
))
{
cache
=
list_entry
(
head
->
next
,
struct
nfs_access_entry
,
lru
);
list_del
(
&
cache
->
lru
);
nfs_access_free_entry
(
cache
);
}
}
int
nfs_access_cache_shrinker
(
int
nr_to_scan
,
gfp_t
gfp_mask
)
{
LIST_HEAD
(
head
);
...
...
@@ -1743,52 +1754,41 @@ int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask)
goto
restart
;
}
spin_unlock
(
&
nfs_access_lru_lock
);
while
(
!
list_empty
(
&
head
))
{
cache
=
list_entry
(
head
.
next
,
struct
nfs_access_entry
,
lru
);
list_del
(
&
cache
->
lru
);
nfs_access_free_entry
(
cache
);
}
nfs_access_free_list
(
&
head
);
return
(
atomic_long_read
(
&
nfs_access_nr_entries
)
/
100
)
*
sysctl_vfs_cache_pressure
;
}
static
void
__nfs_access_zap_cache
(
struct
inode
*
inode
)
static
void
__nfs_access_zap_cache
(
struct
nfs_inode
*
nfsi
,
struct
list_head
*
head
)
{
struct
nfs_inode
*
nfsi
=
NFS_I
(
inode
);
struct
rb_root
*
root_node
=
&
nfsi
->
access_cache
;
struct
rb_node
*
n
,
*
dispose
=
NULL
;
struct
rb_node
*
n
;
struct
nfs_access_entry
*
entry
;
/* Unhook entries from the cache */
while
((
n
=
rb_first
(
root_node
))
!=
NULL
)
{
entry
=
rb_entry
(
n
,
struct
nfs_access_entry
,
rb_node
);
rb_erase
(
n
,
root_node
);
list_del
(
&
entry
->
lru
);
n
->
rb_left
=
dispose
;
dispose
=
n
;
list_move
(
&
entry
->
lru
,
head
);
}
nfsi
->
cache_validity
&=
~
NFS_INO_INVALID_ACCESS
;
spin_unlock
(
&
inode
->
i_lock
);
/* Now kill them all! */
while
(
dispose
!=
NULL
)
{
n
=
dispose
;
dispose
=
n
->
rb_left
;
nfs_access_free_entry
(
rb_entry
(
n
,
struct
nfs_access_entry
,
rb_node
));
}
}
void
nfs_access_zap_cache
(
struct
inode
*
inode
)
{
LIST_HEAD
(
head
);
if
(
test_bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
)
==
0
)
return
;
/* Remove from global LRU init */
if
(
test_and_clear_bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
))
{
spin_lock
(
&
nfs_access_lru_lock
);
spin_lock
(
&
nfs_access_lru_lock
);
if
(
test_and_clear_bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
))
list_del_init
(
&
NFS_I
(
inode
)
->
access_cache_inode_lru
);
spin_unlock
(
&
nfs_access_lru_lock
);
}
spin_lock
(
&
inode
->
i_lock
);
/* This will release the spinlock */
__nfs_access_zap_cache
(
inode
);
__nfs_access_zap_cache
(
NFS_I
(
inode
),
&
head
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
nfs_access_lru_lock
);
nfs_access_free_list
(
&
head
);
}
static
struct
nfs_access_entry
*
nfs_access_search_rbtree
(
struct
inode
*
inode
,
struct
rpc_cred
*
cred
)
...
...
@@ -1839,8 +1839,8 @@ static int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, str
nfs_access_free_entry
(
cache
);
return
-
ENOENT
;
out_zap:
/* This will release the spinlock */
__
nfs_access_zap_cache
(
inode
);
spin_unlock
(
&
inode
->
i_lock
);
nfs_access_zap_cache
(
inode
);
return
-
ENOENT
;
}
...
...
@@ -1895,9 +1895,11 @@ static void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *s
smp_mb__after_atomic_inc
();
/* Add inode to global LRU list */
if
(
!
test_
and_set_
bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
))
{
if
(
!
test_bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
))
{
spin_lock
(
&
nfs_access_lru_lock
);
list_add_tail
(
&
NFS_I
(
inode
)
->
access_cache_inode_lru
,
&
nfs_access_lru_list
);
if
(
!
test_and_set_bit
(
NFS_INO_ACL_LRU_SET
,
&
NFS_I
(
inode
)
->
flags
))
list_add_tail
(
&
NFS_I
(
inode
)
->
access_cache_inode_lru
,
&
nfs_access_lru_list
);
spin_unlock
(
&
nfs_access_lru_lock
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录