Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
e6d2ebdd
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e6d2ebdd
编写于
7月 04, 2017
作者:
M
Miklos Szeredi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ovl: simplify getting inode
Signed-off-by:
N
Miklos Szeredi
<
mszeredi@redhat.com
>
上级
13cf199d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
37 deletion
+36
-37
fs/overlayfs/inode.c
fs/overlayfs/inode.c
+18
-8
fs/overlayfs/namei.c
fs/overlayfs/namei.c
+9
-21
fs/overlayfs/overlayfs.h
fs/overlayfs/overlayfs.h
+2
-3
fs/overlayfs/super.c
fs/overlayfs/super.c
+1
-4
fs/overlayfs/util.c
fs/overlayfs/util.c
+6
-1
未找到文件。
fs/overlayfs/inode.c
浏览文件 @
e6d2ebdd
...
@@ -462,18 +462,28 @@ static int ovl_inode_set(struct inode *inode, void *data)
...
@@ -462,18 +462,28 @@ static int ovl_inode_set(struct inode *inode, void *data)
return
0
;
return
0
;
}
}
struct
inode
*
ovl_get_inode
(
struct
super_block
*
sb
,
struct
inode
*
realinode
)
struct
inode
*
ovl_get_inode
(
struct
dentry
*
dentry
)
{
{
struct
dentry
*
upperdentry
=
ovl_dentry_upper
(
dentry
);
struct
inode
*
realinode
=
d_inode
(
ovl_dentry_real
(
dentry
));
struct
inode
*
inode
;
struct
inode
*
inode
;
inode
=
iget5_locked
(
sb
,
(
unsigned
long
)
realinode
,
if
(
upperdentry
&&
!
d_is_dir
(
upperdentry
))
{
ovl_inode_test
,
ovl_inode_set
,
realinode
);
inode
=
iget5_locked
(
dentry
->
d_sb
,
(
unsigned
long
)
realinode
,
if
(
inode
&&
inode
->
i_state
&
I_NEW
)
{
ovl_inode_test
,
ovl_inode_set
,
realinode
);
ovl_fill_inode
(
inode
,
realinode
->
i_mode
,
realinode
->
i_rdev
);
if
(
!
inode
||
!
(
inode
->
i_state
&
I_NEW
))
goto
out
;
set_nlink
(
inode
,
realinode
->
i_nlink
);
set_nlink
(
inode
,
realinode
->
i_nlink
);
unlock_new_inode
(
inode
);
}
else
{
inode
=
new_inode
(
dentry
->
d_sb
);
if
(
!
inode
)
goto
out
;
}
}
ovl_fill_inode
(
inode
,
realinode
->
i_mode
,
realinode
->
i_rdev
);
ovl_inode_init
(
inode
,
dentry
);
if
(
inode
->
i_state
&
I_NEW
)
unlock_new_inode
(
inode
);
out:
return
inode
;
return
inode
;
}
}
fs/overlayfs/namei.c
浏览文件 @
e6d2ebdd
...
@@ -433,41 +433,29 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
...
@@ -433,41 +433,29 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
if
(
!
oe
)
if
(
!
oe
)
goto
out_put
;
goto
out_put
;
if
(
upperdentry
||
ctr
)
{
oe
->
opaque
=
upperopaque
;
struct
dentry
*
realdentry
;
oe
->
impure
=
upperimpure
;
struct
inode
*
realinode
;
oe
->
redirect
=
upperredirect
;
oe
->
__upperdentry
=
upperdentry
;
realdentry
=
upperdentry
?
upperdentry
:
stack
[
0
].
dentry
;
memcpy
(
oe
->
lowerstack
,
stack
,
sizeof
(
struct
path
)
*
ctr
)
;
realinode
=
d_inode
(
realdentry
)
;
dentry
->
d_fsdata
=
oe
;
if
(
upperdentry
||
ctr
)
{
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
if
(
upperdentry
&&
!
d_is_dir
(
upperdentry
))
{
inode
=
ovl_get_inode
(
dentry
);
inode
=
ovl_get_inode
(
dentry
->
d_sb
,
realinode
);
}
else
{
inode
=
ovl_new_inode
(
dentry
->
d_sb
,
realinode
->
i_mode
,
realinode
->
i_rdev
);
if
(
inode
)
ovl_inode_init
(
inode
,
realinode
,
!!
upperdentry
);
}
if
(
!
inode
)
if
(
!
inode
)
goto
out_free_oe
;
goto
out_free_oe
;
ovl_copyattr
(
realdentry
->
d_inode
,
inode
);
}
}
revert_creds
(
old_cred
);
revert_creds
(
old_cred
);
oe
->
opaque
=
upperopaque
;
oe
->
impure
=
upperimpure
;
oe
->
redirect
=
upperredirect
;
oe
->
__upperdentry
=
upperdentry
;
memcpy
(
oe
->
lowerstack
,
stack
,
sizeof
(
struct
path
)
*
ctr
);
kfree
(
stack
);
kfree
(
stack
);
kfree
(
d
.
redirect
);
kfree
(
d
.
redirect
);
dentry
->
d_fsdata
=
oe
;
d_add
(
dentry
,
inode
);
d_add
(
dentry
,
inode
);
return
NULL
;
return
NULL
;
out_free_oe:
out_free_oe:
dentry
->
d_fsdata
=
NULL
;
kfree
(
oe
);
kfree
(
oe
);
out_put:
out_put:
for
(
i
=
0
;
i
<
ctr
;
i
++
)
for
(
i
=
0
;
i
<
ctr
;
i
++
)
...
...
fs/overlayfs/overlayfs.h
浏览文件 @
e6d2ebdd
...
@@ -211,8 +211,7 @@ bool ovl_redirect_dir(struct super_block *sb);
...
@@ -211,8 +211,7 @@ bool ovl_redirect_dir(struct super_block *sb);
const
char
*
ovl_dentry_get_redirect
(
struct
dentry
*
dentry
);
const
char
*
ovl_dentry_get_redirect
(
struct
dentry
*
dentry
);
void
ovl_dentry_set_redirect
(
struct
dentry
*
dentry
,
const
char
*
redirect
);
void
ovl_dentry_set_redirect
(
struct
dentry
*
dentry
,
const
char
*
redirect
);
void
ovl_dentry_update
(
struct
dentry
*
dentry
,
struct
dentry
*
upperdentry
);
void
ovl_dentry_update
(
struct
dentry
*
dentry
,
struct
dentry
*
upperdentry
);
void
ovl_inode_init
(
struct
inode
*
inode
,
struct
inode
*
realinode
,
void
ovl_inode_init
(
struct
inode
*
inode
,
struct
dentry
*
dentry
);
bool
is_upper
);
void
ovl_inode_update
(
struct
inode
*
inode
,
struct
inode
*
upperinode
);
void
ovl_inode_update
(
struct
inode
*
inode
,
struct
inode
*
upperinode
);
void
ovl_dentry_version_inc
(
struct
dentry
*
dentry
);
void
ovl_dentry_version_inc
(
struct
dentry
*
dentry
);
u64
ovl_dentry_version_get
(
struct
dentry
*
dentry
);
u64
ovl_dentry_version_get
(
struct
dentry
*
dentry
);
...
@@ -262,7 +261,7 @@ int ovl_update_time(struct inode *inode, struct timespec *ts, int flags);
...
@@ -262,7 +261,7 @@ int ovl_update_time(struct inode *inode, struct timespec *ts, int flags);
bool
ovl_is_private_xattr
(
const
char
*
name
);
bool
ovl_is_private_xattr
(
const
char
*
name
);
struct
inode
*
ovl_new_inode
(
struct
super_block
*
sb
,
umode_t
mode
,
dev_t
rdev
);
struct
inode
*
ovl_new_inode
(
struct
super_block
*
sb
,
umode_t
mode
,
dev_t
rdev
);
struct
inode
*
ovl_get_inode
(
struct
super_block
*
sb
,
struct
inode
*
realinode
);
struct
inode
*
ovl_get_inode
(
struct
dentry
*
dentry
);
static
inline
void
ovl_copyattr
(
struct
inode
*
from
,
struct
inode
*
to
)
static
inline
void
ovl_copyattr
(
struct
inode
*
from
,
struct
inode
*
to
)
{
{
to
->
i_uid
=
from
->
i_uid
;
to
->
i_uid
=
from
->
i_uid
;
...
...
fs/overlayfs/super.c
浏览文件 @
e6d2ebdd
...
@@ -757,7 +757,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -757,7 +757,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
struct
path
upperpath
=
{
};
struct
path
upperpath
=
{
};
struct
path
workpath
=
{
};
struct
path
workpath
=
{
};
struct
dentry
*
root_dentry
;
struct
dentry
*
root_dentry
;
struct
inode
*
realinode
;
struct
ovl_entry
*
oe
;
struct
ovl_entry
*
oe
;
struct
ovl_fs
*
ufs
;
struct
ovl_fs
*
ufs
;
struct
path
*
stack
=
NULL
;
struct
path
*
stack
=
NULL
;
...
@@ -1009,9 +1008,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -1009,9 +1008,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
root_dentry
->
d_fsdata
=
oe
;
root_dentry
->
d_fsdata
=
oe
;
realinode
=
d_inode
(
ovl_dentry_real
(
root_dentry
));
ovl_inode_init
(
d_inode
(
root_dentry
),
root_dentry
);
ovl_inode_init
(
d_inode
(
root_dentry
),
realinode
,
!!
upperpath
.
dentry
);
ovl_copyattr
(
realinode
,
d_inode
(
root_dentry
));
sb
->
s_root
=
root_dentry
;
sb
->
s_root
=
root_dentry
;
...
...
fs/overlayfs/util.c
浏览文件 @
e6d2ebdd
...
@@ -230,10 +230,15 @@ void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry)
...
@@ -230,10 +230,15 @@ void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry)
oe
->
__upperdentry
=
upperdentry
;
oe
->
__upperdentry
=
upperdentry
;
}
}
void
ovl_inode_init
(
struct
inode
*
inode
,
struct
inode
*
realinode
,
bool
is_upper
)
void
ovl_inode_init
(
struct
inode
*
inode
,
struct
dentry
*
dentry
)
{
{
struct
inode
*
realinode
=
d_inode
(
ovl_dentry_real
(
dentry
));
bool
is_upper
=
ovl_dentry_upper
(
dentry
);
WRITE_ONCE
(
inode
->
i_private
,
(
unsigned
long
)
realinode
|
WRITE_ONCE
(
inode
->
i_private
,
(
unsigned
long
)
realinode
|
(
is_upper
?
OVL_ISUPPER_MASK
:
0
));
(
is_upper
?
OVL_ISUPPER_MASK
:
0
));
ovl_copyattr
(
realinode
,
inode
);
}
}
void
ovl_inode_update
(
struct
inode
*
inode
,
struct
inode
*
upperinode
)
void
ovl_inode_update
(
struct
inode
*
inode
,
struct
inode
*
upperinode
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录