Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
0d23cf76
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看板
提交
0d23cf76
编写于
6月 16, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ufs: no retries are needed on truncate
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
68785793
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
40 deletion
+17
-40
fs/ufs/truncate.c
fs/ufs/truncate.c
+17
-40
未找到文件。
fs/ufs/truncate.c
浏览文件 @
0d23cf76
...
...
@@ -169,7 +169,7 @@ static void ufs_trunc_direct(struct inode *inode)
}
static
int
ufs_trunc_indirect
(
struct
inode
*
inode
,
u64
offset
,
void
*
p
)
static
void
ufs_trunc_indirect
(
struct
inode
*
inode
,
u64
offset
,
void
*
p
)
{
struct
super_block
*
sb
;
struct
ufs_sb_private_info
*
uspi
;
...
...
@@ -177,7 +177,6 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p)
void
*
ind
;
u64
tmp
,
indirect_block
,
i
,
frag_to_free
;
unsigned
free_count
;
int
retry
;
UFSD
(
"ENTER: ino %lu, offset %llu, p: %p
\n
"
,
inode
->
i_ino
,
(
unsigned
long
long
)
offset
,
p
);
...
...
@@ -189,17 +188,16 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p)
frag_to_free
=
0
;
free_count
=
0
;
retry
=
0
;
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
if
(
!
tmp
)
return
0
;
return
;
ind_ubh
=
ubh_bread
(
sb
,
tmp
,
uspi
->
s_bsize
);
if
(
!
ind_ubh
)
{
write_seqlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
return
0
;
return
;
}
indirect_block
=
(
DIRECT_BLOCK
>
offset
)
?
(
DIRECT_BLOCK
-
offset
)
:
0
;
...
...
@@ -250,18 +248,15 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p)
ubh_brelse
(
ind_ubh
);
UFSD
(
"EXIT: ino %lu
\n
"
,
inode
->
i_ino
);
return
retry
;
}
static
int
ufs_trunc_dindirect
(
struct
inode
*
inode
,
u64
offset
,
void
*
p
)
static
void
ufs_trunc_dindirect
(
struct
inode
*
inode
,
u64
offset
,
void
*
p
)
{
struct
super_block
*
sb
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_buffer_head
*
dind_bh
;
u64
i
,
tmp
,
dindirect_block
;
void
*
dind
;
int
retry
=
0
;
UFSD
(
"ENTER: ino %lu
\n
"
,
inode
->
i_ino
);
...
...
@@ -270,17 +265,16 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)
dindirect_block
=
(
DIRECT_BLOCK
>
offset
)
?
((
DIRECT_BLOCK
-
offset
)
>>
uspi
->
s_apbshift
)
:
0
;
retry
=
0
;
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
);
if
(
!
tmp
)
return
0
;
return
;
dind_bh
=
ubh_bread
(
sb
,
tmp
,
uspi
->
s_bsize
);
if
(
!
dind_bh
)
{
write_seqlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
UFS_I
(
inode
)
->
meta_lock
);
return
0
;
return
;
}
for
(
i
=
dindirect_block
;
i
<
uspi
->
s_apb
;
i
++
)
{
...
...
@@ -288,7 +282,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
dind
);
if
(
!
tmp
)
continue
;
retry
|=
ufs_trunc_indirect
(
inode
,
offset
+
(
i
<<
uspi
->
s_apbshift
),
dind
);
ufs_trunc_indirect
(
inode
,
offset
+
(
i
<<
uspi
->
s_apbshift
),
dind
);
ubh_mark_buffer_dirty
(
dind_bh
);
}
...
...
@@ -312,11 +306,9 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)
ubh_brelse
(
dind_bh
);
UFSD
(
"EXIT: ino %lu
\n
"
,
inode
->
i_ino
);
return
retry
;
}
static
int
ufs_trunc_tindirect
(
struct
inode
*
inode
)
static
void
ufs_trunc_tindirect
(
struct
inode
*
inode
)
{
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
...
...
@@ -324,29 +316,26 @@ static int ufs_trunc_tindirect(struct inode *inode)
struct
ufs_buffer_head
*
tind_bh
;
u64
tindirect_block
,
tmp
,
i
;
void
*
tind
,
*
p
;
int
retry
;
UFSD
(
"ENTER: ino %lu
\n
"
,
inode
->
i_ino
);
retry
=
0
;
tindirect_block
=
(
DIRECT_BLOCK
>
(
UFS_NDADDR
+
uspi
->
s_apb
+
uspi
->
s_2apb
))
?
((
DIRECT_BLOCK
-
UFS_NDADDR
-
uspi
->
s_apb
-
uspi
->
s_2apb
)
>>
uspi
->
s_2apbshift
)
:
0
;
p
=
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_TIND_BLOCK
);
if
(
!
(
tmp
=
ufs_data_ptr_to_cpu
(
sb
,
p
)))
return
0
;
return
;
tind_bh
=
ubh_bread
(
sb
,
tmp
,
uspi
->
s_bsize
);
if
(
!
tind_bh
)
{
write_seqlock
(
&
ufsi
->
meta_lock
);
ufs_data_ptr_clear
(
uspi
,
p
);
write_sequnlock
(
&
ufsi
->
meta_lock
);
return
0
;
return
;
}
for
(
i
=
tindirect_block
;
i
<
uspi
->
s_apb
;
i
++
)
{
tind
=
ubh_get_data_ptr
(
uspi
,
tind_bh
,
i
);
retry
|=
ufs_trunc_dindirect
(
inode
,
UFS_NDADDR
+
ufs_trunc_dindirect
(
inode
,
UFS_NDADDR
+
uspi
->
s_apb
+
((
i
+
1
)
<<
uspi
->
s_2apbshift
),
tind
);
ubh_mark_buffer_dirty
(
tind_bh
);
}
...
...
@@ -370,7 +359,6 @@ static int ufs_trunc_tindirect(struct inode *inode)
ubh_brelse
(
tind_bh
);
UFSD
(
"EXIT: ino %lu
\n
"
,
inode
->
i_ino
);
return
retry
;
}
static
int
ufs_alloc_lastblock
(
struct
inode
*
inode
,
loff_t
size
)
...
...
@@ -448,25 +436,14 @@ static void __ufs_truncate_blocks(struct inode *inode)
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
int
retry
;
mutex_lock
(
&
ufsi
->
truncate_mutex
);
while
(
1
)
{
ufs_trunc_direct
(
inode
);
retry
=
ufs_trunc_indirect
(
inode
,
UFS_IND_BLOCK
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_IND_BLOCK
));
retry
|=
ufs_trunc_dindirect
(
inode
,
UFS_IND_BLOCK
+
uspi
->
s_apb
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_DIND_BLOCK
));
retry
|=
ufs_trunc_tindirect
(
inode
);
if
(
!
retry
)
break
;
if
(
IS_SYNC
(
inode
)
&&
(
inode
->
i_state
&
I_DIRTY
))
ufs_sync_inode
(
inode
);
yield
();
}
ufs_trunc_direct
(
inode
);
ufs_trunc_indirect
(
inode
,
UFS_IND_BLOCK
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_IND_BLOCK
));
ufs_trunc_dindirect
(
inode
,
UFS_IND_BLOCK
+
uspi
->
s_apb
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_DIND_BLOCK
));
ufs_trunc_tindirect
(
inode
);
ufsi
->
i_lastfrag
=
DIRECT_FRAGMENT
;
mutex_unlock
(
&
ufsi
->
truncate_mutex
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录