Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
b3d9b7a3
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b3d9b7a3
编写于
6月 09, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: switch i_dentry/d_alias to hlist
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
9f713878
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
36 addition
and
28 deletion
+36
-28
fs/affs/amigaffs.c
fs/affs/amigaffs.c
+2
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+1
-1
fs/cifs/inode.c
fs/cifs/inode.c
+3
-2
fs/dcache.c
fs/dcache.c
+18
-15
fs/exportfs/expfs.c
fs/exportfs/expfs.c
+2
-1
fs/ext4/fsync.c
fs/ext4/fsync.c
+1
-1
fs/fuse/dir.c
fs/fuse/dir.c
+1
-1
fs/inode.c
fs/inode.c
+1
-1
fs/nfs/getroot.c
fs/nfs/getroot.c
+1
-1
fs/notify/fsnotify.c
fs/notify/fsnotify.c
+2
-1
fs/ocfs2/dcache.c
fs/ocfs2/dcache.c
+2
-1
include/linux/dcache.h
include/linux/dcache.h
+1
-1
include/linux/fs.h
include/linux/fs.h
+1
-1
未找到文件。
fs/affs/amigaffs.c
浏览文件 @
b3d9b7a3
...
...
@@ -125,8 +125,9 @@ static void
affs_fix_dcache
(
struct
inode
*
inode
,
u32
entry_ino
)
{
struct
dentry
*
dentry
;
struct
hlist_node
*
p
;
spin_lock
(
&
inode
->
i_lock
);
list_for_each_entry
(
dentry
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
dentry
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
if
(
entry_ino
==
(
u32
)(
long
)
dentry
->
d_fsdata
)
{
dentry
->
d_fsdata
=
(
void
*
)
inode
->
i_ino
;
break
;
...
...
fs/btrfs/inode.c
浏览文件 @
b3d9b7a3
...
...
@@ -6987,7 +6987,7 @@ void btrfs_destroy_inode(struct inode *inode)
struct
btrfs_ordered_extent
*
ordered
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
WARN_ON
(
!
list_empty
(
&
inode
->
i_dentry
));
WARN_ON
(
!
h
list_empty
(
&
inode
->
i_dentry
));
WARN_ON
(
inode
->
i_data
.
nrpages
);
WARN_ON
(
BTRFS_I
(
inode
)
->
outstanding_extents
);
WARN_ON
(
BTRFS_I
(
inode
)
->
reserved_extents
);
...
...
fs/cifs/inode.c
浏览文件 @
b3d9b7a3
...
...
@@ -800,7 +800,7 @@ cifs_find_inode(struct inode *inode, void *opaque)
return
0
;
/* if it's not a directory or has no dentries, then flag it */
if
(
S_ISDIR
(
inode
->
i_mode
)
&&
!
list_empty
(
&
inode
->
i_dentry
))
if
(
S_ISDIR
(
inode
->
i_mode
)
&&
!
h
list_empty
(
&
inode
->
i_dentry
))
fattr
->
cf_flags
|=
CIFS_FATTR_INO_COLLISION
;
return
1
;
...
...
@@ -825,9 +825,10 @@ static bool
inode_has_hashed_dentries
(
struct
inode
*
inode
)
{
struct
dentry
*
dentry
;
struct
hlist_node
*
p
;
spin_lock
(
&
inode
->
i_lock
);
list_for_each_entry
(
dentry
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
dentry
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
if
(
!
d_unhashed
(
dentry
)
||
IS_ROOT
(
dentry
))
{
spin_unlock
(
&
inode
->
i_lock
);
return
true
;
...
...
fs/dcache.c
浏览文件 @
b3d9b7a3
...
...
@@ -218,7 +218,7 @@ static void __d_free(struct rcu_head *head)
{
struct
dentry
*
dentry
=
container_of
(
head
,
struct
dentry
,
d_u
.
d_rcu
);
WARN_ON
(
!
list_empty
(
&
dentry
->
d_alias
));
WARN_ON
(
!
hlist_unhashed
(
&
dentry
->
d_alias
));
if
(
dname_external
(
dentry
))
kfree
(
dentry
->
d_name
.
name
);
kmem_cache_free
(
dentry_cache
,
dentry
);
...
...
@@ -267,7 +267,7 @@ static void dentry_iput(struct dentry * dentry)
struct
inode
*
inode
=
dentry
->
d_inode
;
if
(
inode
)
{
dentry
->
d_inode
=
NULL
;
list_del_init
(
&
dentry
->
d_alias
);
h
list_del_init
(
&
dentry
->
d_alias
);
spin_unlock
(
&
dentry
->
d_lock
);
spin_unlock
(
&
inode
->
i_lock
);
if
(
!
inode
->
i_nlink
)
...
...
@@ -291,7 +291,7 @@ static void dentry_unlink_inode(struct dentry * dentry)
{
struct
inode
*
inode
=
dentry
->
d_inode
;
dentry
->
d_inode
=
NULL
;
list_del_init
(
&
dentry
->
d_alias
);
h
list_del_init
(
&
dentry
->
d_alias
);
dentry_rcuwalk_barrier
(
dentry
);
spin_unlock
(
&
dentry
->
d_lock
);
spin_unlock
(
&
inode
->
i_lock
);
...
...
@@ -699,10 +699,11 @@ EXPORT_SYMBOL(dget_parent);
static
struct
dentry
*
__d_find_alias
(
struct
inode
*
inode
,
int
want_discon
)
{
struct
dentry
*
alias
,
*
discon_alias
;
struct
hlist_node
*
p
;
again:
discon_alias
=
NULL
;
list_for_each_entry
(
alias
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
alias
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
spin_lock
(
&
alias
->
d_lock
);
if
(
S_ISDIR
(
inode
->
i_mode
)
||
!
d_unhashed
(
alias
))
{
if
(
IS_ROOT
(
alias
)
&&
...
...
@@ -737,7 +738,7 @@ struct dentry *d_find_alias(struct inode *inode)
{
struct
dentry
*
de
=
NULL
;
if
(
!
list_empty
(
&
inode
->
i_dentry
))
{
if
(
!
h
list_empty
(
&
inode
->
i_dentry
))
{
spin_lock
(
&
inode
->
i_lock
);
de
=
__d_find_alias
(
inode
,
0
);
spin_unlock
(
&
inode
->
i_lock
);
...
...
@@ -753,9 +754,10 @@ EXPORT_SYMBOL(d_find_alias);
void
d_prune_aliases
(
struct
inode
*
inode
)
{
struct
dentry
*
dentry
;
struct
hlist_node
*
p
;
restart:
spin_lock
(
&
inode
->
i_lock
);
list_for_each_entry
(
dentry
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
dentry
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
spin_lock
(
&
dentry
->
d_lock
);
if
(
!
dentry
->
d_count
)
{
__dget_dlock
(
dentry
);
...
...
@@ -977,7 +979,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
inode
=
dentry
->
d_inode
;
if
(
inode
)
{
dentry
->
d_inode
=
NULL
;
list_del_init
(
&
dentry
->
d_alias
);
h
list_del_init
(
&
dentry
->
d_alias
);
if
(
dentry
->
d_op
&&
dentry
->
d_op
->
d_iput
)
dentry
->
d_op
->
d_iput
(
dentry
,
inode
);
else
...
...
@@ -1312,7 +1314,7 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
INIT_HLIST_BL_NODE
(
&
dentry
->
d_hash
);
INIT_LIST_HEAD
(
&
dentry
->
d_lru
);
INIT_LIST_HEAD
(
&
dentry
->
d_subdirs
);
INIT_
LIST_HEAD
(
&
dentry
->
d_alias
);
INIT_
HLIST_NODE
(
&
dentry
->
d_alias
);
INIT_LIST_HEAD
(
&
dentry
->
d_u
.
d_child
);
d_set_d_op
(
dentry
,
dentry
->
d_sb
->
s_d_op
);
...
...
@@ -1400,7 +1402,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
if
(
inode
)
{
if
(
unlikely
(
IS_AUTOMOUNT
(
inode
)))
dentry
->
d_flags
|=
DCACHE_NEED_AUTOMOUNT
;
list_ad
d
(
&
dentry
->
d_alias
,
&
inode
->
i_dentry
);
hlist_add_hea
d
(
&
dentry
->
d_alias
,
&
inode
->
i_dentry
);
}
dentry
->
d_inode
=
inode
;
dentry_rcuwalk_barrier
(
dentry
);
...
...
@@ -1425,7 +1427,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
void
d_instantiate
(
struct
dentry
*
entry
,
struct
inode
*
inode
)
{
BUG_ON
(
!
list_empty
(
&
entry
->
d_alias
));
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_alias
));
if
(
inode
)
spin_lock
(
&
inode
->
i_lock
);
__d_instantiate
(
entry
,
inode
);
...
...
@@ -1458,13 +1460,14 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
int
len
=
entry
->
d_name
.
len
;
const
char
*
name
=
entry
->
d_name
.
name
;
unsigned
int
hash
=
entry
->
d_name
.
hash
;
struct
hlist_node
*
p
;
if
(
!
inode
)
{
__d_instantiate
(
entry
,
NULL
);
return
NULL
;
}
list_for_each_entry
(
alias
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
alias
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
/*
* Don't need alias->d_lock here, because aliases with
* d_parent == entry->d_parent are not subject to name or
...
...
@@ -1490,7 +1493,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
{
struct
dentry
*
result
;
BUG_ON
(
!
list_empty
(
&
entry
->
d_alias
));
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_alias
));
if
(
inode
)
spin_lock
(
&
inode
->
i_lock
);
...
...
@@ -1531,9 +1534,9 @@ static struct dentry * __d_find_any_alias(struct inode *inode)
{
struct
dentry
*
alias
;
if
(
list_empty
(
&
inode
->
i_dentry
))
if
(
h
list_empty
(
&
inode
->
i_dentry
))
return
NULL
;
alias
=
list_first_entry
(
&
inode
->
i_dentry
,
struct
dentry
,
d_alias
);
alias
=
hlist_entry
(
inode
->
i_dentry
.
first
,
struct
dentry
,
d_alias
);
__dget
(
alias
);
return
alias
;
}
...
...
@@ -1607,7 +1610,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
spin_lock
(
&
tmp
->
d_lock
);
tmp
->
d_inode
=
inode
;
tmp
->
d_flags
|=
DCACHE_DISCONNECTED
;
list_ad
d
(
&
tmp
->
d_alias
,
&
inode
->
i_dentry
);
hlist_add_hea
d
(
&
tmp
->
d_alias
,
&
inode
->
i_dentry
);
hlist_bl_lock
(
&
tmp
->
d_sb
->
s_anon
);
hlist_bl_add_head
(
&
tmp
->
d_hash
,
&
tmp
->
d_sb
->
s_anon
);
hlist_bl_unlock
(
&
tmp
->
d_sb
->
s_anon
);
...
...
fs/exportfs/expfs.c
浏览文件 @
b3d9b7a3
...
...
@@ -44,13 +44,14 @@ find_acceptable_alias(struct dentry *result,
{
struct
dentry
*
dentry
,
*
toput
=
NULL
;
struct
inode
*
inode
;
struct
hlist_node
*
p
;
if
(
acceptable
(
context
,
result
))
return
result
;
inode
=
result
->
d_inode
;
spin_lock
(
&
inode
->
i_lock
);
list_for_each_entry
(
dentry
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
dentry
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
dget
(
dentry
);
spin_unlock
(
&
inode
->
i_lock
);
if
(
toput
)
...
...
fs/ext4/fsync.c
浏览文件 @
b3d9b7a3
...
...
@@ -225,7 +225,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
if
(
!
journal
)
{
ret
=
__sync_inode
(
inode
,
datasync
);
if
(
!
ret
&&
!
list_empty
(
&
inode
->
i_dentry
))
if
(
!
ret
&&
!
h
list_empty
(
&
inode
->
i_dentry
))
ret
=
ext4_sync_parent
(
inode
);
goto
out
;
}
...
...
fs/fuse/dir.c
浏览文件 @
b3d9b7a3
...
...
@@ -249,7 +249,7 @@ static struct dentry *fuse_d_add_directory(struct dentry *entry,
/* This tries to shrink the subtree below alias */
fuse_invalidate_entry
(
alias
);
dput
(
alias
);
if
(
!
list_empty
(
&
inode
->
i_dentry
))
if
(
!
h
list_empty
(
&
inode
->
i_dentry
))
return
ERR_PTR
(
-
EBUSY
);
}
else
{
dput
(
alias
);
...
...
fs/inode.c
浏览文件 @
b3d9b7a3
...
...
@@ -182,7 +182,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
}
inode
->
i_private
=
NULL
;
inode
->
i_mapping
=
mapping
;
INIT_LIST_HEAD
(
&
inode
->
i_dentry
);
/* buggered by rcu freeing */
INIT_
H
LIST_HEAD
(
&
inode
->
i_dentry
);
/* buggered by rcu freeing */
#ifdef CONFIG_FS_POSIX_ACL
inode
->
i_acl
=
inode
->
i_default_acl
=
ACL_NOT_CACHED
;
#endif
...
...
fs/nfs/getroot.c
浏览文件 @
b3d9b7a3
...
...
@@ -62,7 +62,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
*/
spin_lock
(
&
sb
->
s_root
->
d_inode
->
i_lock
);
spin_lock
(
&
sb
->
s_root
->
d_lock
);
list_del_init
(
&
sb
->
s_root
->
d_alias
);
h
list_del_init
(
&
sb
->
s_root
->
d_alias
);
spin_unlock
(
&
sb
->
s_root
->
d_lock
);
spin_unlock
(
&
sb
->
s_root
->
d_inode
->
i_lock
);
}
...
...
fs/notify/fsnotify.c
浏览文件 @
b3d9b7a3
...
...
@@ -52,6 +52,7 @@ void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
void
__fsnotify_update_child_dentry_flags
(
struct
inode
*
inode
)
{
struct
dentry
*
alias
;
struct
hlist_node
*
p
;
int
watched
;
if
(
!
S_ISDIR
(
inode
->
i_mode
))
...
...
@@ -63,7 +64,7 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
spin_lock
(
&
inode
->
i_lock
);
/* run all of the dentries associated with this inode. Since this is a
* directory, there damn well better only be one item on this list */
list_for_each_entry
(
alias
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
alias
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
struct
dentry
*
child
;
/* run all of the children of the original inode and fix their
...
...
fs/ocfs2/dcache.c
浏览文件 @
b3d9b7a3
...
...
@@ -170,10 +170,11 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
u64
parent_blkno
,
int
skip_unhashed
)
{
struct
hlist_node
*
p
;
struct
dentry
*
dentry
;
spin_lock
(
&
inode
->
i_lock
);
list_for_each_entry
(
dentry
,
&
inode
->
i_dentry
,
d_alias
)
{
hlist_for_each_entry
(
dentry
,
p
,
&
inode
->
i_dentry
,
d_alias
)
{
spin_lock
(
&
dentry
->
d_lock
);
if
(
ocfs2_match_dentry
(
dentry
,
parent_blkno
,
skip_unhashed
))
{
trace_ocfs2_find_local_alias
(
dentry
->
d_name
.
len
,
...
...
include/linux/dcache.h
浏览文件 @
b3d9b7a3
...
...
@@ -128,7 +128,7 @@ struct dentry {
struct
rcu_head
d_rcu
;
}
d_u
;
struct
list_head
d_subdirs
;
/* our children */
struct
list_head
d_alias
;
/* inode alias list */
struct
hlist_node
d_alias
;
/* inode alias list */
};
/*
...
...
include/linux/fs.h
浏览文件 @
b3d9b7a3
...
...
@@ -826,7 +826,7 @@ struct inode {
struct
list_head
i_lru
;
/* inode LRU list */
struct
list_head
i_sb_list
;
union
{
struct
list_head
i_dentry
;
struct
h
list_head
i_dentry
;
struct
rcu_head
i_rcu
;
};
u64
i_version
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录