Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
bb7462b6
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看板
提交
bb7462b6
编写于
2月 20, 2017
作者:
M
Miklos Szeredi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: use helpers for calling f_op->{read,write}_iter()
Signed-off-by:
N
Miklos Szeredi
<
mszeredi@redhat.com
>
上级
0f78d06a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
23 addition
and
11 deletion
+23
-11
drivers/block/loop.c
drivers/block/loop.c
+2
-2
fs/aio.c
fs/aio.c
+2
-2
fs/read_write.c
fs/read_write.c
+6
-6
fs/splice.c
fs/splice.c
+1
-1
include/linux/fs.h
include/linux/fs.h
+12
-0
未找到文件。
drivers/block/loop.c
浏览文件 @
bb7462b6
...
...
@@ -501,9 +501,9 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
cmd
->
iocb
.
ki_flags
=
IOCB_DIRECT
;
if
(
rw
==
WRITE
)
ret
=
file
->
f_op
->
write_iter
(
&
cmd
->
iocb
,
&
iter
);
ret
=
call_write_iter
(
file
,
&
cmd
->
iocb
,
&
iter
);
else
ret
=
file
->
f_op
->
read_iter
(
&
cmd
->
iocb
,
&
iter
);
ret
=
call_read_iter
(
file
,
&
cmd
->
iocb
,
&
iter
);
if
(
ret
!=
-
EIOCBQUEUED
)
cmd
->
iocb
.
ki_complete
(
&
cmd
->
iocb
,
ret
,
0
);
...
...
fs/aio.c
浏览文件 @
bb7462b6
...
...
@@ -1494,7 +1494,7 @@ static ssize_t aio_read(struct kiocb *req, struct iocb *iocb, bool vectored,
return
ret
;
ret
=
rw_verify_area
(
READ
,
file
,
&
req
->
ki_pos
,
iov_iter_count
(
&
iter
));
if
(
!
ret
)
ret
=
aio_ret
(
req
,
file
->
f_op
->
read_iter
(
req
,
&
iter
));
ret
=
aio_ret
(
req
,
call_read_iter
(
file
,
req
,
&
iter
));
kfree
(
iovec
);
return
ret
;
}
...
...
@@ -1519,7 +1519,7 @@ static ssize_t aio_write(struct kiocb *req, struct iocb *iocb, bool vectored,
if
(
!
ret
)
{
req
->
ki_flags
|=
IOCB_WRITE
;
file_start_write
(
file
);
ret
=
aio_ret
(
req
,
file
->
f_op
->
write_iter
(
req
,
&
iter
));
ret
=
aio_ret
(
req
,
call_write_iter
(
file
,
req
,
&
iter
));
/*
* We release freeze protection in aio_complete(). Fool lockdep
* by telling it the lock got released so that it doesn't
...
...
fs/read_write.c
浏览文件 @
bb7462b6
...
...
@@ -367,7 +367,7 @@ ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos)
kiocb
.
ki_pos
=
*
ppos
;
iter
->
type
|=
READ
;
ret
=
file
->
f_op
->
read_iter
(
&
kiocb
,
iter
);
ret
=
call_read_iter
(
file
,
&
kiocb
,
iter
);
BUG_ON
(
ret
==
-
EIOCBQUEUED
);
if
(
ret
>
0
)
*
ppos
=
kiocb
.
ki_pos
;
...
...
@@ -387,7 +387,7 @@ ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos)
kiocb
.
ki_pos
=
*
ppos
;
iter
->
type
|=
WRITE
;
ret
=
file
->
f_op
->
write_iter
(
&
kiocb
,
iter
);
ret
=
call_write_iter
(
file
,
&
kiocb
,
iter
);
BUG_ON
(
ret
==
-
EIOCBQUEUED
);
if
(
ret
>
0
)
*
ppos
=
kiocb
.
ki_pos
;
...
...
@@ -436,7 +436,7 @@ static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
kiocb
.
ki_pos
=
*
ppos
;
iov_iter_init
(
&
iter
,
READ
,
&
iov
,
1
,
len
);
ret
=
filp
->
f_op
->
read_iter
(
&
kiocb
,
&
iter
);
ret
=
call_read_iter
(
filp
,
&
kiocb
,
&
iter
);
BUG_ON
(
ret
==
-
EIOCBQUEUED
);
*
ppos
=
kiocb
.
ki_pos
;
return
ret
;
...
...
@@ -493,7 +493,7 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
kiocb
.
ki_pos
=
*
ppos
;
iov_iter_init
(
&
iter
,
WRITE
,
&
iov
,
1
,
len
);
ret
=
filp
->
f_op
->
write_iter
(
&
kiocb
,
&
iter
);
ret
=
call_write_iter
(
filp
,
&
kiocb
,
&
iter
);
BUG_ON
(
ret
==
-
EIOCBQUEUED
);
if
(
ret
>
0
)
*
ppos
=
kiocb
.
ki_pos
;
...
...
@@ -690,9 +690,9 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
kiocb
.
ki_pos
=
*
ppos
;
if
(
type
==
READ
)
ret
=
filp
->
f_op
->
read_iter
(
&
kiocb
,
iter
);
ret
=
call_read_iter
(
filp
,
&
kiocb
,
iter
);
else
ret
=
filp
->
f_op
->
write_iter
(
&
kiocb
,
iter
);
ret
=
call_write_iter
(
filp
,
&
kiocb
,
iter
);
BUG_ON
(
ret
==
-
EIOCBQUEUED
);
*
ppos
=
kiocb
.
ki_pos
;
return
ret
;
...
...
fs/splice.c
浏览文件 @
bb7462b6
...
...
@@ -306,7 +306,7 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
idx
=
to
.
idx
;
init_sync_kiocb
(
&
kiocb
,
in
);
kiocb
.
ki_pos
=
*
ppos
;
ret
=
in
->
f_op
->
read_iter
(
&
kiocb
,
&
to
);
ret
=
call_read_iter
(
in
,
&
kiocb
,
&
to
);
if
(
ret
>
0
)
{
*
ppos
=
kiocb
.
ki_pos
;
file_accessed
(
in
);
...
...
include/linux/fs.h
浏览文件 @
bb7462b6
...
...
@@ -1715,6 +1715,18 @@ struct inode_operations {
int
(
*
set_acl
)(
struct
inode
*
,
struct
posix_acl
*
,
int
);
}
____cacheline_aligned
;
static
inline
ssize_t
call_read_iter
(
struct
file
*
file
,
struct
kiocb
*
kio
,
struct
iov_iter
*
iter
)
{
return
file
->
f_op
->
read_iter
(
kio
,
iter
);
}
static
inline
ssize_t
call_write_iter
(
struct
file
*
file
,
struct
kiocb
*
kio
,
struct
iov_iter
*
iter
)
{
return
file
->
f_op
->
write_iter
(
kio
,
iter
);
}
ssize_t
rw_copy_check_uvector
(
int
type
,
const
struct
iovec
__user
*
uvector
,
unsigned
long
nr_segs
,
unsigned
long
fast_segs
,
struct
iovec
*
fast_pointer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录