Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
2da98f00
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,发现更多精彩内容 >>
提交
2da98f00
编写于
1月 16, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Run igrab on data=ordered inodes to prevent deadlocks during writeout
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
9cce6c3b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
10 deletion
+37
-10
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+26
-6
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.c
+8
-2
fs/btrfs/super.c
fs/btrfs/super.c
+1
-1
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+1
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
2da98f00
...
...
@@ -1145,7 +1145,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
int
btrfs_page_mkwrite
(
struct
vm_area_struct
*
vma
,
struct
page
*
page
);
int
btrfs_readpage
(
struct
file
*
file
,
struct
page
*
page
);
void
btrfs_delete_inode
(
struct
inode
*
inode
);
void
btrfs_
drop
_inode
(
struct
inode
*
inode
);
void
btrfs_
put
_inode
(
struct
inode
*
inode
);
void
btrfs_read_locked_inode
(
struct
inode
*
inode
);
int
btrfs_write_inode
(
struct
inode
*
inode
,
int
wait
);
void
btrfs_dirty_inode
(
struct
inode
*
inode
);
...
...
fs/btrfs/inode.c
浏览文件 @
2da98f00
...
...
@@ -601,6 +601,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
{
struct
btrfs_root
*
root
;
struct
btrfs_trans_handle
*
trans
;
struct
inode
*
inode
=
dentry
->
d_inode
;
int
ret
;
unsigned
long
nr
=
0
;
...
...
@@ -617,6 +618,18 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
ret
=
btrfs_unlink_trans
(
trans
,
root
,
dir
,
dentry
);
nr
=
trans
->
blocks_used
;
if
(
inode
->
i_nlink
==
0
)
{
int
found
;
/* if the inode isn't linked anywhere,
* we don't need to worry about
* data=ordered
*/
found
=
btrfs_del_ordered_inode
(
inode
);
if
(
found
==
1
)
{
atomic_dec
(
&
inode
->
i_count
);
}
}
btrfs_end_transaction
(
trans
,
root
);
fail:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
...
...
@@ -993,15 +1006,22 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
return
err
;
}
void
btrfs_
drop
_inode
(
struct
inode
*
inode
)
void
btrfs_
put
_inode
(
struct
inode
*
inode
)
{
if
(
!
BTRFS_I
(
inode
)
->
ordered_trans
||
inode
->
i_nlink
)
{
generic_drop_inode
(
inode
);
int
ret
;
if
(
!
BTRFS_I
(
inode
)
->
ordered_trans
)
{
return
;
}
if
(
mapping_tagged
(
inode
->
i_mapping
,
PAGECACHE_TAG_DIRTY
)
||
mapping_tagged
(
inode
->
i_mapping
,
PAGECACHE_TAG_WRITEBACK
))
return
;
ret
=
btrfs_del_ordered_inode
(
inode
);
if
(
ret
==
1
)
{
atomic_dec
(
&
inode
->
i_count
);
}
/* FIXME, make sure this delete actually ends up in the transaction */
btrfs_del_ordered_inode
(
inode
);
generic_drop_inode
(
inode
);
}
void
btrfs_delete_inode
(
struct
inode
*
inode
)
...
...
fs/btrfs/ordered-data.c
浏览文件 @
2da98f00
...
...
@@ -153,6 +153,8 @@ int btrfs_add_ordered_inode(struct inode *inode)
write_unlock
(
&
tree
->
lock
);
if
(
node
)
kfree
(
entry
);
else
igrab
(
inode
);
return
0
;
}
...
...
@@ -221,6 +223,7 @@ int btrfs_find_del_first_ordered_inode(struct btrfs_ordered_inode_tree *tree,
}
static
int
__btrfs_del_ordered_inode
(
struct
btrfs_ordered_inode_tree
*
tree
,
struct
inode
*
inode
,
u64
root_objectid
,
u64
objectid
)
{
struct
tree_entry
*
entry
;
...
...
@@ -234,6 +237,7 @@ static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree,
return
0
;
}
rb_erase
(
node
,
&
tree
->
tree
);
BTRFS_I
(
inode
)
->
ordered_trans
=
0
;
write_unlock
(
&
tree
->
lock
);
entry
=
rb_entry
(
node
,
struct
tree_entry
,
rb_node
);
kfree
(
entry
);
...
...
@@ -244,14 +248,16 @@ int btrfs_del_ordered_inode(struct inode *inode)
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
u64
root_objectid
=
root
->
root_key
.
objectid
;
int
ret
=
0
;
spin_lock
(
&
root
->
fs_info
->
new_trans_lock
);
if
(
root
->
fs_info
->
running_transaction
)
{
struct
btrfs_ordered_inode_tree
*
tree
;
tree
=
&
root
->
fs_info
->
running_transaction
->
ordered_inode_tree
;
__btrfs_del_ordered_inode
(
tree
,
root_objectid
,
inode
->
i_ino
);
ret
=
__btrfs_del_ordered_inode
(
tree
,
inode
,
root_objectid
,
inode
->
i_ino
);
}
spin_unlock
(
&
root
->
fs_info
->
new_trans_lock
);
return
0
;
return
ret
;
}
fs/btrfs/super.c
浏览文件 @
2da98f00
...
...
@@ -425,7 +425,7 @@ static struct file_system_type btrfs_fs_type = {
static
struct
super_operations
btrfs_super_ops
=
{
.
delete_inode
=
btrfs_delete_inode
,
.
drop_inode
=
btrfs_drop
_inode
,
.
put_inode
=
btrfs_put
_inode
,
.
put_super
=
btrfs_put_super
,
.
read_inode
=
btrfs_read_locked_inode
,
.
write_super
=
btrfs_write_super
,
...
...
fs/btrfs/transaction.c
浏览文件 @
2da98f00
...
...
@@ -521,6 +521,7 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
if
(
inode
)
{
if
(
S_ISREG
(
inode
->
i_mode
))
filemap_write_and_wait
(
inode
->
i_mapping
);
atomic_dec
(
&
inode
->
i_count
);
iput
(
inode
);
}
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录