Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
2b777c9d
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
2b777c9d
编写于
4月 03, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ceph_sync_read: stop poking into iov_iter guts
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
f0d1bec9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
61 deletion
+22
-61
fs/ceph/file.c
fs/ceph/file.c
+18
-28
include/linux/ceph/libceph.h
include/linux/ceph/libceph.h
+0
-2
net/ceph/pagevec.c
net/ceph/pagevec.c
+4
-31
未找到文件。
fs/ceph/file.c
浏览文件 @
2b777c9d
...
@@ -418,7 +418,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
...
@@ -418,7 +418,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
struct
page
**
pages
;
struct
page
**
pages
;
u64
off
=
iocb
->
ki_pos
;
u64
off
=
iocb
->
ki_pos
;
int
num_pages
,
ret
;
int
num_pages
,
ret
;
size_t
len
=
i
->
count
;
size_t
len
=
i
ov_iter_count
(
i
)
;
dout
(
"sync_read on file %p %llu~%u %s
\n
"
,
file
,
off
,
dout
(
"sync_read on file %p %llu~%u %s
\n
"
,
file
,
off
,
(
unsigned
)
len
,
(
unsigned
)
len
,
...
@@ -436,25 +436,26 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
...
@@ -436,25 +436,26 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
if
(
file
->
f_flags
&
O_DIRECT
)
{
if
(
file
->
f_flags
&
O_DIRECT
)
{
while
(
iov_iter_count
(
i
))
{
while
(
iov_iter_count
(
i
))
{
void
__user
*
data
=
i
->
iov
[
0
].
iov_base
+
i
->
iov_offse
t
;
size_t
star
t
;
s
ize_t
len
=
i
->
iov
[
0
].
iov_len
-
i
->
iov_offset
;
s
size_t
n
;
num_pages
=
calc_pages_for
((
unsigned
long
)
data
,
len
);
n
=
iov_iter_get_pages_alloc
(
i
,
&
pages
,
INT_MAX
,
&
start
);
pages
=
ceph_get_direct_page_vector
(
data
,
if
(
n
<
0
)
num_pages
,
true
);
return
n
;
if
(
IS_ERR
(
pages
))
return
PTR_ERR
(
pages
);
ret
=
striped_read
(
inode
,
off
,
len
,
num_pages
=
(
n
+
start
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
;
ret
=
striped_read
(
inode
,
off
,
n
,
pages
,
num_pages
,
checkeof
,
pages
,
num_pages
,
checkeof
,
1
,
(
unsigned
long
)
data
&
~
PAGE_MASK
);
1
,
start
);
ceph_put_page_vector
(
pages
,
num_pages
,
true
);
ceph_put_page_vector
(
pages
,
num_pages
,
true
);
if
(
ret
<=
0
)
if
(
ret
<=
0
)
break
;
break
;
off
+=
ret
;
off
+=
ret
;
iov_iter_advance
(
i
,
ret
);
iov_iter_advance
(
i
,
ret
);
if
(
ret
<
le
n
)
if
(
ret
<
n
)
break
;
break
;
}
}
}
else
{
}
else
{
...
@@ -466,25 +467,14 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
...
@@ -466,25 +467,14 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
num_pages
,
checkeof
,
0
,
0
);
num_pages
,
checkeof
,
0
,
0
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
int
l
,
k
=
0
;
int
l
,
k
=
0
;
size_t
left
=
len
=
ret
;
size_t
left
=
ret
;
while
(
left
)
{
while
(
left
)
{
void
__user
*
data
=
i
->
iov
[
0
].
iov_base
int
copy
=
min_t
(
size_t
,
PAGE_SIZE
,
left
);
+
i
->
iov_offset
;
l
=
copy_page_to_iter
(
pages
[
k
++
],
0
,
copy
,
i
);
l
=
min
(
i
->
iov
[
0
].
iov_len
-
i
->
iov_offset
,
off
+=
l
;
left
);
left
-=
l
;
if
(
l
<
copy
)
ret
=
ceph_copy_page_vector_to_user
(
&
pages
[
k
],
data
,
off
,
l
);
if
(
ret
>
0
)
{
iov_iter_advance
(
i
,
ret
);
left
-=
ret
;
off
+=
ret
;
k
=
calc_pages_for
(
iocb
->
ki_pos
,
len
-
left
+
1
)
-
1
;
BUG_ON
(
k
>=
num_pages
&&
left
);
}
else
break
;
break
;
}
}
}
}
...
...
include/linux/ceph/libceph.h
浏览文件 @
2b777c9d
...
@@ -222,8 +222,6 @@ extern void ceph_copy_to_page_vector(struct page **pages,
...
@@ -222,8 +222,6 @@ extern void ceph_copy_to_page_vector(struct page **pages,
extern
void
ceph_copy_from_page_vector
(
struct
page
**
pages
,
extern
void
ceph_copy_from_page_vector
(
struct
page
**
pages
,
void
*
data
,
void
*
data
,
loff_t
off
,
size_t
len
);
loff_t
off
,
size_t
len
);
extern
int
ceph_copy_page_vector_to_user
(
struct
page
**
pages
,
void
__user
*
data
,
loff_t
off
,
size_t
len
);
extern
void
ceph_zero_page_vector_range
(
int
off
,
int
len
,
struct
page
**
pages
);
extern
void
ceph_zero_page_vector_range
(
int
off
,
int
len
,
struct
page
**
pages
);
...
...
net/ceph/pagevec.c
浏览文件 @
2b777c9d
...
@@ -53,7 +53,10 @@ void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
...
@@ -53,7 +53,10 @@ void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
set_page_dirty_lock
(
pages
[
i
]);
set_page_dirty_lock
(
pages
[
i
]);
put_page
(
pages
[
i
]);
put_page
(
pages
[
i
]);
}
}
kfree
(
pages
);
if
(
is_vmalloc_addr
(
pages
))
vfree
(
pages
);
else
kfree
(
pages
);
}
}
EXPORT_SYMBOL
(
ceph_put_page_vector
);
EXPORT_SYMBOL
(
ceph_put_page_vector
);
...
@@ -164,36 +167,6 @@ void ceph_copy_from_page_vector(struct page **pages,
...
@@ -164,36 +167,6 @@ void ceph_copy_from_page_vector(struct page **pages,
}
}
EXPORT_SYMBOL
(
ceph_copy_from_page_vector
);
EXPORT_SYMBOL
(
ceph_copy_from_page_vector
);
/*
* copy user data from a page vector into a user pointer
*/
int
ceph_copy_page_vector_to_user
(
struct
page
**
pages
,
void
__user
*
data
,
loff_t
off
,
size_t
len
)
{
int
i
=
0
;
int
po
=
off
&
~
PAGE_CACHE_MASK
;
int
left
=
len
;
int
l
,
bad
;
while
(
left
>
0
)
{
l
=
min_t
(
int
,
left
,
PAGE_CACHE_SIZE
-
po
);
bad
=
copy_to_user
(
data
,
page_address
(
pages
[
i
])
+
po
,
l
);
if
(
bad
==
l
)
return
-
EFAULT
;
data
+=
l
-
bad
;
left
-=
l
-
bad
;
if
(
po
)
{
po
+=
l
-
bad
;
if
(
po
==
PAGE_CACHE_SIZE
)
po
=
0
;
}
i
++
;
}
return
len
;
}
EXPORT_SYMBOL
(
ceph_copy_page_vector_to_user
);
/*
/*
* Zero an extent within a page vector. Offset is relative to the
* Zero an extent within a page vector. Offset is relative to the
* start of the first page.
* start of the first page.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录