Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
至沁
Kernel Liteos A
提交
1d0a3f02
K
Kernel Liteos A
项目概览
至沁
/
Kernel Liteos A
与 Fork 源项目一致
Fork自
OpenHarmony / Kernel Liteos A
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1d0a3f02
编写于
4月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!186 将VnodeInUseIter和VnodeFreeAll函数改为非递归
Merge pull request !186 from Far/dev
上级
6467ebb2
5f6656cb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
78 deletion
+28
-78
fs/include/fs/vnode.h
fs/include/fs/vnode.h
+2
-3
fs/vfs/vnode.c
fs/vfs/vnode.c
+25
-74
fs/vfs/vnode_hash.c
fs/vfs/vnode_hash.c
+1
-1
未找到文件。
fs/include/fs/vnode.h
浏览文件 @
1d0a3f02
...
...
@@ -111,15 +111,14 @@ int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
int
VnodeHold
(
void
);
int
VnodeDrop
(
void
);
void
VnodeRefDec
(
struct
Vnode
*
vnode
);
int
VnodeFreeIter
(
struct
Vnode
*
vnode
);
int
VnodeFreeAll
(
struct
Mount
*
mnt
);
int
VnodeFreeAll
(
const
struct
Mount
*
mnt
);
int
VnodeHashInit
(
void
);
uint32_t
VfsHashIndex
(
struct
Vnode
*
vnode
);
int
VfsHashGet
(
const
struct
Mount
*
mount
,
uint32_t
hash
,
struct
Vnode
**
vnode
,
VfsHashCmp
*
fun
,
void
*
arg
);
void
VfsHashRemove
(
struct
Vnode
*
vnode
);
int
VfsHashInsert
(
struct
Vnode
*
vnode
,
uint32_t
hash
);
void
ChangeRoot
(
struct
Vnode
*
newRoot
);
BOOL
VnodeInUseIter
(
struct
Vnode
*
vnode
);
BOOL
VnodeInUseIter
(
const
struct
Mount
*
mount
);
struct
Vnode
*
VnodeGetRoot
(
void
);
void
VnodeMemoryDump
(
void
);
...
...
fs/vfs/vnode.c
浏览文件 @
1d0a3f02
...
...
@@ -47,7 +47,6 @@ static struct VnodeOps g_devfsOps;
#define ENTRY_TO_VNODE(ptr) LOS_DL_LIST_ENTRY(ptr, struct Vnode, actFreeEntry)
#define VNODE_LRU_COUNT 10
#define DEV_VNODE_MODE 0755
#define MAX_ITER_TIMES 10
int
VnodesInit
(
void
)
{
...
...
@@ -98,8 +97,8 @@ struct Vnode *VnodeReclaimLru(void)
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
item
,
nextItem
,
&
g_vnodeCurrList
,
struct
Vnode
,
actFreeEntry
)
{
if
((
item
->
useCount
>
0
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
NEW
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
ORIGIN
))
{
(
item
->
flag
&
VNODE_FLAG_MOUNT_
ORIGIN
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
NEW
))
{
continue
;
}
...
...
@@ -201,83 +200,35 @@ int VnodeFree(struct Vnode *vnode)
return
LOS_OK
;
}
int
VnodeFree
Iter
(
struct
Vnode
*
vnode
)
int
VnodeFree
All
(
const
struct
Mount
*
mount
)
{
struct
Vnode
*
vp
=
NULL
;
struct
PathCache
*
item
=
NULL
;
struct
PathCache
*
nextItem
=
NULL
;
int
ret
;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
item
,
nextItem
,
&
vnode
->
childPathCaches
,
struct
PathCache
,
childEntry
)
{
vp
=
item
->
childVnode
;
if
(
vp
==
NULL
)
{
continue
;
}
ret
=
VnodeFreeIter
(
vp
);
if
(
ret
!=
LOS_OK
)
{
return
ret
;
}
}
return
VnodeFree
(
vnode
);
}
int
VnodeFreeAll
(
struct
Mount
*
mnt
)
{
struct
Vnode
*
vp
=
NULL
;
struct
Vnode
*
mountptVnode
=
mnt
->
vnodeCovered
;
struct
PathCache
*
item
=
NULL
;
struct
PathCache
*
nextItem
=
NULL
;
struct
Vnode
*
vnode
=
NULL
;
struct
Vnode
*
nextVnode
=
NULL
;
int
ret
;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
item
,
nextItem
,
&
mountptVnode
->
childPathCaches
,
struct
PathCache
,
childEntry
)
{
vp
=
item
->
childVnode
;
if
(
vp
==
NULL
)
{
continue
;
}
ret
=
VnodeFreeIter
(
vp
);
if
(
ret
!=
LOS_OK
)
{
return
ret
;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
vnode
,
nextVnode
,
&
g_vnodeCurrList
,
struct
Vnode
,
actFreeEntry
)
{
if
((
vnode
->
originMount
==
mount
)
&&
!
(
vnode
->
flag
&
VNODE_FLAG_MOUNT_NEW
))
{
ret
=
VnodeFree
(
vnode
);
if
(
ret
!=
LOS_OK
)
{
return
ret
;
}
}
}
return
0
;
}
static
VOID
VnodeIterDump
(
struct
Vnode
*
vnode
,
int
increase
)
{
static
int
count
=
0
;
LIST_ENTRY
*
list
=
&
vnode
->
parentPathCaches
;
struct
PathCache
*
pathCache
=
LOS_DL_LIST_ENTRY
(
list
->
pstNext
,
struct
PathCache
,
parentEntry
);
count
+=
increase
;
if
(
count
>=
MAX_ITER_TIMES
)
{
PRINTK
(
"########## Vnode In Use Iteration ##########
\n
"
);
PRINTK
(
"Iteration times: %d
\n
"
,
count
);
PRINTK
(
"%p -- %s --> %p
\n
"
,
vnode
->
parent
,
pathCache
->
name
,
vnode
);
PathCacheDump
();
}
return
LOS_OK
;
}
BOOL
VnodeInUseIter
(
struct
Vnode
*
vnode
)
BOOL
VnodeInUseIter
(
const
struct
Mount
*
mount
)
{
struct
Vnode
*
vp
=
NULL
;
struct
PathCache
*
item
=
NULL
;
struct
PathCache
*
nextItem
=
NULL
;
struct
Vnode
*
vnode
=
NULL
;
VnodeIterDump
(
vnode
,
1
);
if
(
vnode
->
useCount
>
0
)
{
VnodeIterDump
(
vnode
,
-
1
);
return
TRUE
;
}
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
item
,
nextItem
,
&
vnode
->
childPathCaches
,
struct
PathCache
,
childEntry
)
{
vp
=
item
->
childVnode
;
if
(
vp
==
NULL
)
{
continue
;
}
if
(
VnodeInUseIter
(
vp
)
==
TRUE
)
{
VnodeIterDump
(
vnode
,
-
1
);
return
TRUE
;
LOS_DL_LIST_FOR_EACH_ENTRY
(
vnode
,
&
g_vnodeCurrList
,
struct
Vnode
,
actFreeEntry
)
{
if
(
vnode
->
originMount
==
mount
)
{
if
((
vnode
->
useCount
>
0
)
||
(
vnode
->
flag
&
VNODE_FLAG_MOUNT_ORIGIN
))
{
return
TRUE
;
}
}
}
VnodeIterDump
(
vnode
,
-
1
);
return
FALSE
;
}
...
...
@@ -335,7 +286,7 @@ static int PreProcess(const char *originPath, struct Vnode **startVnode, char **
static
struct
Vnode
*
ConvertVnodeIfMounted
(
struct
Vnode
*
vnode
)
{
if
((
vnode
==
NULL
)
||
!
(
vnode
->
flag
&
VNODE_FLAG_MOUNT_
NEW
))
{
if
((
vnode
==
NULL
)
||
!
(
vnode
->
flag
&
VNODE_FLAG_MOUNT_
ORIGIN
))
{
return
vnode
;
}
return
vnode
->
newMount
->
vnodeCovered
;
...
...
@@ -487,7 +438,7 @@ static void ChangeRootInternal(struct Vnode *rootOld, char *dirname)
mnt
->
vnodeBeCovered
=
nodeInFs
;
nodeInFs
->
newMount
=
mnt
;
nodeInFs
->
flag
|=
VNODE_FLAG_MOUNT_
NEW
;
nodeInFs
->
flag
|=
VNODE_FLAG_MOUNT_
ORIGIN
;
break
;
}
...
...
@@ -600,7 +551,7 @@ int VnodeDevInit()
return
-
ENOMEM
;
}
devMount
->
vnodeCovered
=
devNode
;
devMount
->
vnodeBeCovered
->
flag
|=
VNODE_FLAG_MOUNT_
NEW
;
devMount
->
vnodeBeCovered
->
flag
|=
VNODE_FLAG_MOUNT_
ORIGIN
;
return
LOS_OK
;
}
...
...
@@ -668,8 +619,8 @@ void VnodeMemoryDump(void)
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE
(
item
,
nextItem
,
&
g_vnodeCurrList
,
struct
Vnode
,
actFreeEntry
)
{
if
((
item
->
useCount
>
0
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
NEW
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
ORIGIN
))
{
(
item
->
flag
&
VNODE_FLAG_MOUNT_
ORIGIN
)
||
(
item
->
flag
&
VNODE_FLAG_MOUNT_
NEW
))
{
continue
;
}
...
...
@@ -678,4 +629,4 @@ void VnodeMemoryDump(void)
PRINTK
(
"Vnode number = %d
\n
"
,
vnodeCount
);
PRINTK
(
"Vnode memory size = %d(B)
\n
"
,
vnodeCount
*
sizeof
(
struct
Vnode
));
}
}
\ No newline at end of file
fs/vfs/vnode_hash.c
浏览文件 @
1d0a3f02
...
...
@@ -134,4 +134,4 @@ int VfsHashInsert(struct Vnode *vnode, uint32_t hash)
LOS_ListHeadInsert
(
VfsHashBucket
(
vnode
->
originMount
,
hash
),
&
vnode
->
hashEntry
);
(
void
)
LOS_MuxUnlock
(
&
g_vnodeHashMux
);
return
LOS_OK
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录