Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
e2008b61
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2008b61
编写于
1月 08, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Add some simple throttling to wait for data=ordered and snapshot deletion
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
3063d29f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
26 addition
and
0 deletion
+26
-0
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+7
-0
fs/btrfs/disk-io.h
fs/btrfs/disk-io.h
+1
-0
fs/btrfs/file.c
fs/btrfs/file.c
+1
-0
fs/btrfs/inode.c
fs/btrfs/inode.c
+12
-0
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+4
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
e2008b61
...
...
@@ -345,6 +345,7 @@ struct btrfs_fs_info {
struct
completion
kobj_unregister
;
int
do_barriers
;
int
closing
;
unsigned
long
throttles
;
u64
total_pinned
;
spinlock_t
delalloc_lock
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
e2008b61
...
...
@@ -631,6 +631,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
tree_root
=
tree_root
;
fs_info
->
extent_root
=
extent_root
;
fs_info
->
sb
=
sb
;
fs_info
->
throttles
=
0
;
fs_info
->
mount_opt
=
0
;
fs_info
->
max_extent
=
(
u64
)
-
1
;
fs_info
->
delalloc_bytes
=
0
;
...
...
@@ -889,6 +890,12 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
set_extent_buffer_dirty
(
&
BTRFS_I
(
btree_inode
)
->
extent_tree
,
buf
);
}
void
btrfs_throttle
(
struct
btrfs_root
*
root
)
{
if
(
root
->
fs_info
->
throttles
)
congestion_wait
(
WRITE
,
HZ
/
10
);
}
void
btrfs_btree_balance_dirty
(
struct
btrfs_root
*
root
,
unsigned
long
nr
)
{
balance_dirty_pages_ratelimited_nr
(
...
...
fs/btrfs/disk-io.h
浏览文件 @
e2008b61
...
...
@@ -64,4 +64,5 @@ int btrfs_clear_buffer_defrag_done(struct extent_buffer *buf);
int
btrfs_read_buffer
(
struct
extent_buffer
*
buf
);
u32
btrfs_csum_data
(
struct
btrfs_root
*
root
,
char
*
data
,
u32
seed
,
size_t
len
);
void
btrfs_csum_final
(
u32
crc
,
char
*
result
);
void
btrfs_throttle
(
struct
btrfs_root
*
root
);
#endif
fs/btrfs/file.c
浏览文件 @
e2008b61
...
...
@@ -800,6 +800,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
balance_dirty_pages_ratelimited_nr
(
inode
->
i_mapping
,
num_pages
);
if
(
num_pages
<
(
root
->
leafsize
>>
PAGE_CACHE_SHIFT
)
+
1
)
btrfs_btree_balance_dirty
(
root
,
1
);
btrfs_throttle
(
root
);
cond_resched
();
}
out:
...
...
fs/btrfs/inode.c
浏览文件 @
e2008b61
...
...
@@ -610,6 +610,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
fail:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
ret
;
}
...
...
@@ -644,6 +645,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
fail:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
if
(
ret
&&
!
err
)
err
=
ret
;
...
...
@@ -1010,6 +1012,7 @@ void btrfs_delete_inode(struct inode *inode)
btrfs_end_transaction
(
trans
,
root
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
;
no_delete_lock:
...
...
@@ -1017,6 +1020,7 @@ void btrfs_delete_inode(struct inode *inode)
btrfs_end_transaction
(
trans
,
root
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
no_delete:
clear_inode
(
inode
);
}
...
...
@@ -1574,6 +1578,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
iput
(
inode
);
}
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
err
;
}
...
...
@@ -1633,6 +1638,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
iput
(
inode
);
}
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
err
;
}
...
...
@@ -1684,6 +1690,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
iput
(
inode
);
}
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
err
;
}
...
...
@@ -1752,6 +1759,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if
(
drop_on_err
)
iput
(
inode
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
err
;
}
...
...
@@ -2117,6 +2125,7 @@ static void btrfs_truncate(struct inode *inode)
BUG_ON
(
ret
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
}
static
int
noinline
create_subvol
(
struct
btrfs_root
*
root
,
char
*
name
,
...
...
@@ -2245,6 +2254,7 @@ static int noinline create_subvol(struct btrfs_root *root, char *name,
fail_commit:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
ret
;
}
...
...
@@ -2287,6 +2297,7 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
fail_unlock:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
ret
;
}
...
...
@@ -2827,6 +2838,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
iput
(
inode
);
}
btrfs_btree_balance_dirty
(
root
,
nr
);
btrfs_throttle
(
root
);
return
err
;
}
...
...
fs/btrfs/transaction.c
浏览文件 @
e2008b61
...
...
@@ -424,6 +424,7 @@ static int drop_dirty_roots(struct btrfs_root *tree_root,
num_bytes
=
btrfs_root_used
(
&
dirty
->
root
->
root_item
);
root
=
dirty
->
latest_root
;
root
->
fs_info
->
throttles
++
;
while
(
1
)
{
trans
=
btrfs_start_transaction
(
tree_root
,
1
);
...
...
@@ -447,6 +448,7 @@ static int drop_dirty_roots(struct btrfs_root *tree_root,
mutex_lock
(
&
tree_root
->
fs_info
->
fs_mutex
);
}
BUG_ON
(
ret
);
root
->
fs_info
->
throttles
--
;
num_bytes
-=
btrfs_root_used
(
&
dirty
->
root
->
root_item
);
bytes_used
=
btrfs_root_used
(
&
root
->
root_item
);
...
...
@@ -484,6 +486,7 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
u64
objectid
=
0
;
int
ret
;
root
->
fs_info
->
throttles
++
;
while
(
1
)
{
ret
=
btrfs_find_first_ordered_inode
(
&
cur_trans
->
ordered_inode_tree
,
...
...
@@ -523,6 +526,7 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_lock
(
&
root
->
fs_info
->
trans_mutex
);
}
root
->
fs_info
->
throttles
--
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录