Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
619d30b4
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
619d30b4
编写于
3月 04, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
convert the guts of nfs_direct_IO() to iov_iter
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
d8d3d94b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
33 deletion
+35
-33
fs/nfs/direct.c
fs/nfs/direct.c
+21
-25
fs/nfs/file.c
fs/nfs/file.c
+12
-6
include/linux/nfs_fs.h
include/linux/nfs_fs.h
+2
-2
未找到文件。
fs/nfs/direct.c
浏览文件 @
619d30b4
...
...
@@ -132,9 +132,9 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t
VM_BUG_ON
(
iocb
->
ki_nbytes
!=
PAGE_SIZE
);
if
(
rw
==
READ
||
rw
==
KERNEL_READ
)
return
nfs_file_direct_read
(
iocb
,
iter
->
iov
,
iter
->
nr_segs
,
pos
,
return
nfs_file_direct_read
(
iocb
,
iter
,
pos
,
rw
==
READ
?
true
:
false
);
return
nfs_file_direct_write
(
iocb
,
iter
->
iov
,
iter
->
nr_segs
,
pos
,
return
nfs_file_direct_write
(
iocb
,
iter
,
pos
,
rw
==
WRITE
?
true
:
false
);
#endif
/* CONFIG_NFS_SWAP */
}
...
...
@@ -414,8 +414,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de
}
static
ssize_t
nfs_direct_read_schedule_iovec
(
struct
nfs_direct_req
*
dreq
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
)
{
struct
nfs_pageio_descriptor
desc
;
...
...
@@ -430,8 +429,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
desc
.
pg_dreq
=
dreq
;
atomic_inc
(
&
inode
->
i_dio_count
);
for
(
seg
=
0
;
seg
<
nr_segs
;
seg
++
)
{
const
struct
iovec
*
vec
=
&
iov
[
seg
];
for
(
seg
=
0
;
seg
<
iter
->
nr_segs
;
seg
++
)
{
const
struct
iovec
*
vec
=
&
i
ter
->
i
ov
[
seg
];
result
=
nfs_direct_read_schedule_segment
(
&
desc
,
vec
,
pos
,
uio
);
if
(
result
<
0
)
break
;
...
...
@@ -461,8 +460,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
/**
* nfs_file_direct_read - file direct read operation for NFS files
* @iocb: target I/O control block
* @iov: vector of user buffers into which to read data
* @nr_segs: size of iov vector
* @iter: vector of user buffers into which to read data
* @pos: byte offset in file where reading starts
*
* We use this function for direct reads instead of calling
...
...
@@ -479,8 +477,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
* client must read the updated atime from the server back into its
* cache.
*/
ssize_t
nfs_file_direct_read
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
,
bool
uio
)
ssize_t
nfs_file_direct_read
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
)
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
address_space
*
mapping
=
file
->
f_mapping
;
...
...
@@ -490,7 +488,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
ssize_t
result
=
-
EINVAL
;
size_t
count
;
count
=
iov_length
(
i
ov
,
nr_segs
);
count
=
iov_length
(
i
ter
->
iov
,
iter
->
nr_segs
);
nfs_add_stats
(
mapping
->
host
,
NFSIOS_DIRECTREADBYTES
,
count
);
dfprintk
(
FILE
,
"NFS: direct read(%pD2, %zd@%Ld)
\n
"
,
...
...
@@ -513,7 +511,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
goto
out_unlock
;
dreq
->
inode
=
inode
;
dreq
->
bytes_left
=
iov_length
(
iov
,
nr_segs
)
;
dreq
->
bytes_left
=
count
;
dreq
->
ctx
=
get_nfs_open_context
(
nfs_file_open_context
(
iocb
->
ki_filp
));
l_ctx
=
nfs_get_lock_context
(
dreq
->
ctx
);
if
(
IS_ERR
(
l_ctx
))
{
...
...
@@ -524,8 +522,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
if
(
!
is_sync_kiocb
(
iocb
))
dreq
->
iocb
=
iocb
;
NFS_I
(
inode
)
->
read_io
+=
iov_length
(
iov
,
nr_segs
)
;
result
=
nfs_direct_read_schedule_iovec
(
dreq
,
i
ov
,
nr_segs
,
pos
,
uio
);
NFS_I
(
inode
)
->
read_io
+=
count
;
result
=
nfs_direct_read_schedule_iovec
(
dreq
,
i
ter
,
pos
,
uio
);
mutex_unlock
(
&
inode
->
i_mutex
);
...
...
@@ -864,8 +862,7 @@ static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {
};
static
ssize_t
nfs_direct_write_schedule_iovec
(
struct
nfs_direct_req
*
dreq
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
)
{
struct
nfs_pageio_descriptor
desc
;
...
...
@@ -880,9 +877,9 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
get_dreq
(
dreq
);
atomic_inc
(
&
inode
->
i_dio_count
);
NFS_I
(
dreq
->
inode
)
->
write_io
+=
iov_length
(
i
ov
,
nr_segs
);
for
(
seg
=
0
;
seg
<
nr_segs
;
seg
++
)
{
const
struct
iovec
*
vec
=
&
iov
[
seg
];
NFS_I
(
dreq
->
inode
)
->
write_io
+=
iov_length
(
i
ter
->
iov
,
iter
->
nr_segs
);
for
(
seg
=
0
;
seg
<
iter
->
nr_segs
;
seg
++
)
{
const
struct
iovec
*
vec
=
&
i
ter
->
i
ov
[
seg
];
result
=
nfs_direct_write_schedule_segment
(
&
desc
,
vec
,
pos
,
uio
);
if
(
result
<
0
)
break
;
...
...
@@ -911,8 +908,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
/**
* nfs_file_direct_write - file direct write operation for NFS files
* @iocb: target I/O control block
* @iov: vector of user buffers from which to write data
* @nr_segs: size of iov vector
* @iter: vector of user buffers from which to write data
* @pos: byte offset in file where writing starts
*
* We use this function for direct writes instead of calling
...
...
@@ -930,8 +926,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
* Note that O_APPEND is not supported for NFS direct writes, as there
* is no atomic O_APPEND write facility in the NFS protocol.
*/
ssize_t
nfs_file_direct_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
,
bool
uio
)
ssize_t
nfs_file_direct_write
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
)
{
ssize_t
result
=
-
EINVAL
;
struct
file
*
file
=
iocb
->
ki_filp
;
...
...
@@ -942,7 +938,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
loff_t
end
;
size_t
count
;
count
=
iov_length
(
i
ov
,
nr_segs
);
count
=
iov_length
(
i
ter
->
iov
,
iter
->
nr_segs
);
end
=
(
pos
+
count
-
1
)
>>
PAGE_CACHE_SHIFT
;
nfs_add_stats
(
mapping
->
host
,
NFSIOS_DIRECTWRITTENBYTES
,
count
);
...
...
@@ -993,7 +989,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
if
(
!
is_sync_kiocb
(
iocb
))
dreq
->
iocb
=
iocb
;
result
=
nfs_direct_write_schedule_iovec
(
dreq
,
i
ov
,
nr_segs
,
pos
,
uio
);
result
=
nfs_direct_write_schedule_iovec
(
dreq
,
i
ter
,
pos
,
uio
);
if
(
mapping
->
nrpages
)
{
invalidate_inode_pages2_range
(
mapping
,
...
...
fs/nfs/file.c
浏览文件 @
619d30b4
...
...
@@ -169,14 +169,18 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
unsigned
long
nr_segs
,
loff_t
pos
)
{
struct
inode
*
inode
=
file_inode
(
iocb
->
ki_filp
);
size_t
count
=
iov_length
(
iov
,
nr_segs
);
ssize_t
result
;
struct
iov_iter
to
;
iov_iter_init
(
&
to
,
iov
,
nr_segs
,
count
,
0
);
if
(
iocb
->
ki_filp
->
f_flags
&
O_DIRECT
)
return
nfs_file_direct_read
(
iocb
,
iov
,
nr_segs
,
pos
,
true
);
return
nfs_file_direct_read
(
iocb
,
&
to
,
pos
,
true
);
dprintk
(
"NFS: read(%pD2, %
l
u@%lu)
\n
"
,
dprintk
(
"NFS: read(%pD2, %
z
u@%lu)
\n
"
,
iocb
->
ki_filp
,
(
unsigned
long
)
iov_length
(
iov
,
nr_segs
)
,
(
unsigned
long
)
pos
);
count
,
(
unsigned
long
)
pos
);
result
=
nfs_revalidate_mapping
(
inode
,
iocb
->
ki_filp
->
f_mapping
);
if
(
!
result
)
{
...
...
@@ -643,16 +647,18 @@ ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
unsigned
long
written
=
0
;
ssize_t
result
;
size_t
count
=
iov_length
(
iov
,
nr_segs
);
struct
iov_iter
from
;
iov_iter_init
(
&
from
,
iov
,
nr_segs
,
count
,
0
);
result
=
nfs_key_timeout_notify
(
file
,
inode
);
if
(
result
)
return
result
;
if
(
file
->
f_flags
&
O_DIRECT
)
return
nfs_file_direct_write
(
iocb
,
iov
,
nr_segs
,
pos
,
true
);
return
nfs_file_direct_write
(
iocb
,
&
from
,
pos
,
true
);
dprintk
(
"NFS: write(%pD2, %
l
u@%Ld)
\n
"
,
file
,
(
unsigned
long
)
count
,
(
long
long
)
pos
);
dprintk
(
"NFS: write(%pD2, %
z
u@%Ld)
\n
"
,
file
,
count
,
(
long
long
)
pos
);
result
=
-
EBUSY
;
if
(
IS_SWAPFILE
(
inode
))
...
...
include/linux/nfs_fs.h
浏览文件 @
619d30b4
...
...
@@ -461,10 +461,10 @@ extern int nfs3_removexattr (struct dentry *, const char *name);
*/
extern
ssize_t
nfs_direct_IO
(
int
,
struct
kiocb
*
,
struct
iov_iter
*
,
loff_t
);
extern
ssize_t
nfs_file_direct_read
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
);
extern
ssize_t
nfs_file_direct_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
struct
iov_iter
*
iter
,
loff_t
pos
,
bool
uio
);
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录