Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
6d1ebbca
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
6d1ebbca
编写于
6月 18, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split ufs_truncate_branch() into full- and partial-branch variants
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
a138b4b6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
16 deletion
+58
-16
fs/ufs/inode.c
fs/ufs/inode.c
+58
-16
未找到文件。
fs/ufs/inode.c
浏览文件 @
6d1ebbca
...
...
@@ -1070,6 +1070,60 @@ static void ufs_trunc_direct(struct inode *inode)
UFSD
(
"EXIT: ino %lu
\n
"
,
inode
->
i_ino
);
}
static
void
free_full_branch
(
struct
inode
*
inode
,
int
depth
,
void
*
p
)
{
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
ufs_buffer_head
*
ubh
;
u64
tmp
;
unsigned
i
;
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
if
(
!
tmp
)
return
;
ubh
=
ubh_bread
(
sb
,
tmp
,
uspi
->
s_bsize
);
if
(
!
ubh
)
{
write_seqlock
(
&
ufsi
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
ufsi
->
meta_lock
);
return
;
}
if
(
--
depth
)
{
for
(
i
=
0
;
i
<
uspi
->
s_apb
;
i
++
)
{
void
*
ind
=
ubh_get_data_ptr
(
uspi
,
ubh
,
i
);
free_full_branch
(
inode
,
depth
,
ind
);
ubh_mark_buffer_dirty
(
ubh
);
}
}
else
{
struct
to_free
ctx
=
{.
inode
=
inode
};
for
(
i
=
0
;
i
<
uspi
->
s_apb
;
i
++
)
{
void
*
ind
=
ubh_get_data_ptr
(
uspi
,
ubh
,
i
);
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
ind
);
if
(
!
tmp
)
continue
;
write_seqlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
ind
);
write_sequnlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
ubh_mark_buffer_dirty
(
ubh
);
free_data
(
&
ctx
,
tmp
,
uspi
->
s_fpb
);
mark_inode_dirty
(
inode
);
}
free_data
(
&
ctx
,
0
,
0
);
}
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
write_seqlock
(
&
ufsi
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
ufsi
->
meta_lock
);
ubh_bforget
(
ubh
);
ufs_free_blocks
(
inode
,
tmp
,
uspi
->
s_fpb
);
mark_inode_dirty
(
inode
);
}
static
void
ufs_trunc_branch
(
struct
inode
*
inode
,
unsigned
*
offsets
,
int
depth2
,
int
depth
,
void
*
p
)
{
struct
super_block
*
sb
=
inode
->
i_sb
;
...
...
@@ -1077,8 +1131,7 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2,
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
ufs_buffer_head
*
ubh
;
u64
tmp
;
bool
free_it
=
!
offsets
;
unsigned
from
=
offsets
?
*
offsets
++
:
0
;
unsigned
from
=
*
offsets
++
;
unsigned
i
;
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
...
...
@@ -1093,14 +1146,14 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2,
}
if
(
--
depth
)
{
if
(
offsets
&&
--
depth2
)
{
if
(
--
depth2
)
{
void
*
ind
=
ubh_get_data_ptr
(
uspi
,
ubh
,
from
++
);
ufs_trunc_branch
(
inode
,
offsets
,
depth2
,
depth
,
ind
);
ubh_mark_buffer_dirty
(
ubh
);
}
for
(
i
=
from
;
i
<
uspi
->
s_apb
;
i
++
)
{
void
*
ind
=
ubh_get_data_ptr
(
uspi
,
ubh
,
i
);
ufs_trunc_branch
(
inode
,
NULL
,
0
,
depth
,
ind
);
free_full_branch
(
inode
,
depth
,
ind
);
ubh_mark_buffer_dirty
(
ubh
);
}
}
else
{
...
...
@@ -1121,17 +1174,6 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2,
}
free_data
(
&
ctx
,
0
,
0
);
}
if
(
free_it
)
{
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
write_seqlock
(
&
ufsi
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
ufsi
->
meta_lock
);
ubh_bforget
(
ubh
);
ufs_free_blocks
(
inode
,
tmp
,
uspi
->
s_fpb
);
mark_inode_dirty
(
inode
);
return
;
}
if
(
IS_SYNC
(
inode
)
&&
ubh_buffer_dirty
(
ubh
))
ubh_sync_block
(
ubh
);
ubh_brelse
(
ubh
);
...
...
@@ -1235,7 +1277,7 @@ static void __ufs_truncate_blocks(struct inode *inode)
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
offsets
[
0
]
++
));
}
for
(
i
=
offsets
[
0
];
i
<=
UFS_TIND_BLOCK
;
i
++
)
{
ufs_trunc_branch
(
inode
,
NULL
,
0
,
i
-
UFS_IND_BLOCK
+
1
,
free_full_branch
(
inode
,
i
-
UFS_IND_BLOCK
+
1
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
i
));
}
ufsi
->
i_lastfrag
=
DIRECT_FRAGMENT
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录