Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
2932f3ec
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
163
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2932f3ec
编写于
4月 10, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 10, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: when forced to cow for file_write, get the page uptodate first
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
79b2cb1f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
1 deletion
+14
-1
fs/btrfs/super.c
fs/btrfs/super.c
+14
-1
未找到文件。
fs/btrfs/super.c
浏览文件 @
2932f3ec
...
...
@@ -1268,6 +1268,8 @@ static int prepare_pages(struct btrfs_trans_handle *trans,
struct
page
**
pages
,
size_t
num_pages
,
loff_t
pos
,
unsigned
long
first_index
,
unsigned
long
last_index
,
size_t
write_bytes
)
{
int
i
;
...
...
@@ -1289,6 +1291,13 @@ static int prepare_pages(struct btrfs_trans_handle *trans,
}
offset
=
pos
&
(
PAGE_CACHE_SIZE
-
1
);
this_write
=
min
(
PAGE_CACHE_SIZE
-
offset
,
write_bytes
);
if
(
!
PageUptodate
(
pages
[
i
])
&&
(
pages
[
i
]
->
index
==
first_index
||
pages
[
i
]
->
index
==
last_index
)
&&
pos
<
isize
)
{
ret
=
mpage_readpage
(
pages
[
i
],
btrfs_get_block
);
BUG_ON
(
ret
);
lock_page
(
pages
[
i
]);
}
ret
=
nobh_prepare_write
(
pages
[
i
],
offset
,
offset
+
this_write
,
btrfs_get_block
);
...
...
@@ -1323,6 +1332,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
struct
page
*
pages
[
1
];
unsigned
long
first_index
;
unsigned
long
last_index
;
if
(
file
->
f_flags
&
O_DIRECT
)
return
-
EINVAL
;
...
...
@@ -1340,13 +1351,15 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
goto
out
;
file_update_time
(
file
);
mutex_lock
(
&
inode
->
i_mutex
);
first_index
=
pos
>>
PAGE_CACHE_SHIFT
;
last_index
=
(
pos
+
count
)
>>
PAGE_CACHE_SHIFT
;
while
(
count
>
0
)
{
size_t
offset
=
pos
&
(
PAGE_CACHE_SIZE
-
1
);
size_t
write_bytes
=
min
(
count
,
PAGE_CACHE_SIZE
-
offset
);
size_t
num_pages
=
(
write_bytes
+
PAGE_CACHE_SIZE
-
1
)
>>
PAGE_CACHE_SHIFT
;
ret
=
prepare_pages
(
NULL
,
root
,
file
,
pages
,
num_pages
,
pos
,
write_bytes
);
pos
,
first_index
,
last_index
,
write_bytes
);
BUG_ON
(
ret
);
ret
=
btrfs_copy_from_user
(
pos
,
num_pages
,
write_bytes
,
pages
,
buf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录