Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
81d7ed29
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
81d7ed29
编写于
4月 25, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Throttle file_write when data=ordered is flushing the inode
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
bce4eae9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
2 deletion
+28
-2
fs/btrfs/btrfs_inode.h
fs/btrfs/btrfs_inode.h
+1
-0
fs/btrfs/file.c
fs/btrfs/file.c
+1
-0
fs/btrfs/inode.c
fs/btrfs/inode.c
+4
-0
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.c
+13
-0
fs/btrfs/ordered-data.h
fs/btrfs/ordered-data.h
+1
-0
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+8
-2
未找到文件。
fs/btrfs/btrfs_inode.h
浏览文件 @
81d7ed29
...
@@ -31,6 +31,7 @@ struct btrfs_inode {
...
@@ -31,6 +31,7 @@ struct btrfs_inode {
struct
extent_io_tree
io_tree
;
struct
extent_io_tree
io_tree
;
struct
extent_io_tree
io_failure_tree
;
struct
extent_io_tree
io_failure_tree
;
struct
inode
vfs_inode
;
struct
inode
vfs_inode
;
atomic_t
ordered_writeback
;
u64
ordered_trans
;
u64
ordered_trans
;
/*
/*
...
...
fs/btrfs/file.c
浏览文件 @
81d7ed29
...
@@ -977,6 +977,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
...
@@ -977,6 +977,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
(
start_pos
+
num_written
-
1
)
>>
PAGE_CACHE_SHIFT
);
(
start_pos
+
num_written
-
1
)
>>
PAGE_CACHE_SHIFT
);
}
}
current
->
backing_dev_info
=
NULL
;
current
->
backing_dev_info
=
NULL
;
btrfs_ordered_throttle
(
root
,
inode
);
return
num_written
?
num_written
:
err
;
return
num_written
?
num_written
:
err
;
}
}
...
...
fs/btrfs/inode.c
浏览文件 @
81d7ed29
...
@@ -1419,6 +1419,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
...
@@ -1419,6 +1419,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
atomic_set
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
,
0
);
return
0
;
return
0
;
}
}
...
@@ -1728,6 +1729,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
...
@@ -1728,6 +1729,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
atomic_set
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
,
0
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
BTRFS_I
(
inode
)
->
root
=
root
;
BTRFS_I
(
inode
)
->
root
=
root
;
...
@@ -1956,6 +1958,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
...
@@ -1956,6 +1958,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
atomic_set
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
,
0
);
BTRFS_I
(
inode
)
->
io_tree
.
ops
=
&
btrfs_extent_io_ops
;
BTRFS_I
(
inode
)
->
io_tree
.
ops
=
&
btrfs_extent_io_ops
;
}
}
dir
->
i_sb
->
s_dirt
=
1
;
dir
->
i_sb
->
s_dirt
=
1
;
...
@@ -3292,6 +3295,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
...
@@ -3292,6 +3295,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
inode
->
i_mapping
,
GFP_NOFS
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
atomic_set
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
,
0
);
BTRFS_I
(
inode
)
->
io_tree
.
ops
=
&
btrfs_extent_io_ops
;
BTRFS_I
(
inode
)
->
io_tree
.
ops
=
&
btrfs_extent_io_ops
;
}
}
dir
->
i_sb
->
s_dirt
=
1
;
dir
->
i_sb
->
s_dirt
=
1
;
...
...
fs/btrfs/ordered-data.c
浏览文件 @
81d7ed29
...
@@ -269,3 +269,16 @@ int btrfs_del_ordered_inode(struct inode *inode)
...
@@ -269,3 +269,16 @@ int btrfs_del_ordered_inode(struct inode *inode)
return
ret
;
return
ret
;
}
}
int
btrfs_ordered_throttle
(
struct
btrfs_root
*
root
,
struct
inode
*
inode
)
{
struct
btrfs_transaction
*
cur
=
root
->
fs_info
->
running_transaction
;
while
(
cur
==
root
->
fs_info
->
running_transaction
&&
atomic_read
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
))
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
congestion_wait
(
WRITE
,
HZ
/
20
);
#else
blk_congestion_wait
(
WRITE
,
HZ
/
20
);
#endif
}
return
0
;
}
fs/btrfs/ordered-data.h
浏览文件 @
81d7ed29
...
@@ -39,4 +39,5 @@ int btrfs_find_first_ordered_inode(struct btrfs_ordered_inode_tree *tree,
...
@@ -39,4 +39,5 @@ int btrfs_find_first_ordered_inode(struct btrfs_ordered_inode_tree *tree,
u64
*
root_objectid
,
u64
*
objectid
,
u64
*
root_objectid
,
u64
*
objectid
,
struct
inode
**
inode
);
struct
inode
**
inode
);
int
btrfs_del_ordered_inode
(
struct
inode
*
inode
);
int
btrfs_del_ordered_inode
(
struct
inode
*
inode
);
int
btrfs_ordered_throttle
(
struct
btrfs_root
*
root
,
struct
inode
*
inode
);
#endif
#endif
fs/btrfs/transaction.c
浏览文件 @
81d7ed29
...
@@ -512,8 +512,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
...
@@ -512,8 +512,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
if
(
S_ISREG
(
inode
->
i_mode
))
if
(
S_ISREG
(
inode
->
i_mode
))
{
atomic_inc
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
);
filemap_fdatawrite
(
inode
->
i_mapping
);
filemap_fdatawrite
(
inode
->
i_mapping
);
atomic_dec
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
);
}
iput
(
inode
);
iput
(
inode
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
...
@@ -530,8 +533,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
...
@@ -530,8 +533,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
if
(
S_ISREG
(
inode
->
i_mode
))
if
(
S_ISREG
(
inode
->
i_mode
))
{
atomic_inc
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
);
filemap_write_and_wait
(
inode
->
i_mapping
);
filemap_write_and_wait
(
inode
->
i_mapping
);
atomic_dec
(
&
BTRFS_I
(
inode
)
->
ordered_writeback
);
}
atomic_dec
(
&
inode
->
i_count
);
atomic_dec
(
&
inode
->
i_count
);
iput
(
inode
);
iput
(
inode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录