Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
14048ed0
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
7
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看板
提交
14048ed0
编写于
10月 15, 2007
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Cache extent buffer mappings
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
db94535d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
6 deletion
+49
-6
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+36
-4
fs/btrfs/extent_map.c
fs/btrfs/extent_map.c
+13
-2
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
14048ed0
...
...
@@ -436,10 +436,18 @@ static inline u##bits btrfs_##name(struct extent_buffer *eb, \
unsigned long map_len; \
unsigned long offset = (unsigned long)s + \
offsetof(type, member); \
err = map_extent_buffer(eb, offset, \
if (eb->map_token && offset >= eb->map_start && \
offset + sizeof(((type *)0)->member) <= eb->map_start + \
eb->map_len) { \
kaddr = eb->kaddr; \
map_start = eb->map_start; \
err = 0; \
} else { \
err = map_extent_buffer(eb, offset, \
sizeof(((type *)0)->member), \
&map_token, &kaddr, \
&map_start, &map_len, KM_USER1); \
} \
if (!err) { \
__le##bits *tmp = (__le##bits *)(kaddr + offset - \
map_start); \
...
...
@@ -464,10 +472,18 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \
int unmap_on_exit = (eb->map_token == NULL); \
unsigned long offset = (unsigned long)s + \
offsetof(type, member); \
err = map_extent_buffer(eb, offset, \
if (eb->map_token && offset >= eb->map_start && \
offset + sizeof(((type *)0)->member) <= eb->map_start + \
eb->map_len) { \
kaddr = eb->kaddr; \
map_start = eb->map_start; \
err = 0; \
} else { \
err = map_extent_buffer(eb, offset, \
sizeof(((type *)0)->member), \
&map_token, &kaddr, \
&map_start, &map_len, KM_USER1); \
} \
if (!err) { \
__le##bits *tmp = (__le##bits *)(kaddr + offset - \
map_start); \
...
...
@@ -490,10 +506,18 @@ static inline u##bits btrfs_##name(struct extent_buffer *eb) \
unsigned long map_len; \
unsigned long offset = offsetof(type, member); \
int unmap_on_exit = (eb->map_token == NULL); \
err = map_extent_buffer(eb, offset, \
if (eb->map_token && offset >= eb->map_start && \
offset + sizeof(((type *)0)->member) <= eb->map_start + \
eb->map_len) { \
kaddr = eb->kaddr; \
map_start = eb->map_start; \
err = 0; \
} else { \
err = map_extent_buffer(eb, offset, \
sizeof(((type *)0)->member), \
&map_token, &kaddr, \
&map_start, &map_len, KM_USER1); \
} \
if (!err) { \
__le##bits *tmp = (__le##bits *)(kaddr + offset - \
map_start); \
...
...
@@ -517,10 +541,18 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \
unsigned long map_len; \
unsigned long offset = offsetof(type, member); \
int unmap_on_exit = (eb->map_token == NULL); \
err = map_extent_buffer(eb, offset, \
if (eb->map_token && offset >= eb->map_start && \
offset + sizeof(((type *)0)->member) <= eb->map_start + \
eb->map_len) { \
kaddr = eb->kaddr; \
map_start = eb->map_start; \
err = 0; \
} else { \
err = map_extent_buffer(eb, offset, \
sizeof(((type *)0)->member), \
&map_token, &kaddr, \
&map_start, &map_len, KM_USER1); \
} \
if (!err) { \
__le##bits *tmp = (__le##bits *)(kaddr + offset - \
map_start); \
...
...
fs/btrfs/extent_map.c
浏览文件 @
14048ed0
...
...
@@ -2037,6 +2037,7 @@ struct extent_buffer *find_extent_buffer(struct extent_map_tree *tree,
struct
extent_buffer
*
eb
;
struct
page
*
p
;
struct
address_space
*
mapping
=
tree
->
mapping
;
int
uptodate
=
1
;
eb
=
__alloc_extent_buffer
(
mask
);
if
(
!
eb
||
IS_ERR
(
eb
))
...
...
@@ -2048,7 +2049,7 @@ struct extent_buffer *find_extent_buffer(struct extent_map_tree *tree,
atomic_set
(
&
eb
->
refs
,
1
);
for
(
i
=
0
;
i
<
num_pages
;
i
++
,
index
++
)
{
p
=
find_
get
_page
(
mapping
,
index
);
p
=
find_
lock
_page
(
mapping
,
index
);
if
(
!
p
)
{
/* make sure the free only frees the pages we've
* grabbed a reference on
...
...
@@ -2060,7 +2061,12 @@ struct extent_buffer *find_extent_buffer(struct extent_map_tree *tree,
set_page_extent_mapped
(
p
);
if
(
i
==
0
)
eb
->
first_page
=
p
;
if
(
!
PageUptodate
(
p
))
uptodate
=
0
;
unlock_page
(
p
);
}
if
(
uptodate
)
eb
->
flags
|=
EXTENT_UPTODATE
;
return
eb
;
fail:
free_extent_buffer
(
eb
);
...
...
@@ -2192,7 +2198,7 @@ int read_extent_buffer_pages(struct extent_map_tree *tree,
if
(
eb
->
flags
&
EXTENT_UPTODATE
)
return
0
;
if
(
test_range_bit
(
tree
,
eb
->
start
,
eb
->
start
+
eb
->
len
-
1
,
if
(
0
&&
test_range_bit
(
tree
,
eb
->
start
,
eb
->
start
+
eb
->
len
-
1
,
EXTENT_UPTODATE
,
1
))
{
return
0
;
}
...
...
@@ -2247,6 +2253,7 @@ void read_extent_buffer(struct extent_buffer *eb, void *dstv,
char
*
dst
=
(
char
*
)
dstv
;
size_t
start_offset
=
eb
->
start
&
((
u64
)
PAGE_CACHE_SIZE
-
1
);
unsigned
long
i
=
(
start_offset
+
start
)
>>
PAGE_CACHE_SHIFT
;
unsigned
long
num_pages
=
num_extent_pages
(
eb
->
start
,
eb
->
len
);
WARN_ON
(
start
>
eb
->
len
);
WARN_ON
(
start
+
len
>
eb
->
start
+
eb
->
len
);
...
...
@@ -2257,6 +2264,10 @@ void read_extent_buffer(struct extent_buffer *eb, void *dstv,
while
(
len
>
0
)
{
page
=
extent_buffer_page
(
eb
,
i
);
if
(
!
PageUptodate
(
page
))
{
printk
(
"page %lu not up to date i %lu, total %lu, len %lu
\n
"
,
page
->
index
,
i
,
num_pages
,
eb
->
len
);
WARN_ON
(
1
);
}
WARN_ON
(
!
PageUptodate
(
page
));
cur
=
min
(
len
,
(
PAGE_CACHE_SIZE
-
offset
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录