Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
8e7bf94f
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看板
提交
8e7bf94f
编写于
4月 28, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Do more optimal file RA during shrinking and defrag
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
3bf3d9e9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
9 deletion
+22
-9
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+15
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+7
-8
未找到文件。
fs/btrfs/extent-tree.c
浏览文件 @
8e7bf94f
...
...
@@ -2263,6 +2263,12 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
return
0
;
}
static
unsigned
long
calc_ra
(
unsigned
long
start
,
unsigned
long
last
,
unsigned
long
nr
)
{
return
min
(
last
,
start
+
nr
-
1
);
}
static
int
noinline
relocate_inode_pages
(
struct
inode
*
inode
,
u64
start
,
u64
len
)
{
...
...
@@ -2275,6 +2281,8 @@ static int noinline relocate_inode_pages(struct inode *inode, u64 start,
struct
page
*
page
;
struct
extent_io_tree
*
io_tree
=
&
BTRFS_I
(
inode
)
->
io_tree
;
struct
file_ra_state
*
ra
;
unsigned
long
total_read
=
0
;
unsigned
long
ra_pages
;
ra
=
kzalloc
(
sizeof
(
*
ra
),
GFP_NOFS
);
...
...
@@ -2282,11 +2290,17 @@ static int noinline relocate_inode_pages(struct inode *inode, u64 start,
i
=
start
>>
PAGE_CACHE_SHIFT
;
last_index
=
(
start
+
len
-
1
)
>>
PAGE_CACHE_SHIFT
;
ra_pages
=
BTRFS_I
(
inode
)
->
root
->
fs_info
->
bdi
.
ra_pages
;
file_ra_state_init
(
ra
,
inode
->
i_mapping
);
btrfs_force_ra
(
inode
->
i_mapping
,
ra
,
NULL
,
i
,
last_index
);
kfree
(
ra
);
for
(;
i
<=
last_index
;
i
++
)
{
if
(
total_read
%
ra_pages
==
0
)
{
btrfs_force_ra
(
inode
->
i_mapping
,
ra
,
NULL
,
i
,
calc_ra
(
i
,
last_index
,
ra_pages
));
}
total_read
++
;
page
=
grab_cache_page
(
inode
->
i_mapping
,
i
);
if
(
!
page
)
goto
out_unlock
;
...
...
fs/btrfs/inode.c
浏览文件 @
8e7bf94f
...
...
@@ -2814,14 +2814,12 @@ unsigned long btrfs_force_ra(struct address_space *mapping,
struct
file_ra_state
*
ra
,
struct
file
*
file
,
pgoff_t
offset
,
pgoff_t
last_index
)
{
pgoff_t
req_size
;
pgoff_t
req_size
=
last_index
-
offset
+
1
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
req_size
=
last_index
-
offset
+
1
;
offset
=
page_cache_readahead
(
mapping
,
ra
,
file
,
offset
,
req_size
);
return
offset
;
#else
req_size
=
min
(
last_index
-
offset
+
1
,
(
pgoff_t
)
128
);
page_cache_sync_readahead
(
mapping
,
ra
,
file
,
offset
,
req_size
);
return
offset
+
req_size
;
#endif
...
...
@@ -2833,7 +2831,8 @@ int btrfs_defrag_file(struct file *file) {
struct
extent_io_tree
*
io_tree
=
&
BTRFS_I
(
inode
)
->
io_tree
;
struct
page
*
page
;
unsigned
long
last_index
;
unsigned
long
ra_index
=
0
;
unsigned
long
ra_pages
=
root
->
fs_info
->
bdi
.
ra_pages
;
unsigned
long
total_read
=
0
;
u64
page_start
;
u64
page_end
;
unsigned
long
i
;
...
...
@@ -2848,11 +2847,11 @@ int btrfs_defrag_file(struct file *file) {
mutex_lock
(
&
inode
->
i_mutex
);
last_index
=
inode
->
i_size
>>
PAGE_CACHE_SHIFT
;
for
(
i
=
0
;
i
<=
last_index
;
i
++
)
{
if
(
i
==
ra_index
)
{
ra_index
=
btrfs_force_ra
(
inode
->
i_mapping
,
&
file
->
f_ra
,
file
,
ra_index
,
last_index
);
if
(
total_read
%
ra_pages
==
0
)
{
btrfs_force_ra
(
inode
->
i_mapping
,
&
file
->
f_ra
,
file
,
i
,
min
(
last_index
,
i
+
ra_pages
-
1
));
}
total_read
++
;
page
=
grab_cache_page
(
inode
->
i_mapping
,
i
);
if
(
!
page
)
goto
out_unlock
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录