Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3dae8750
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看板
提交
3dae8750
编写于
4月 03, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cifs: switch to ->write_iter()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
d4637bc1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
42 deletion
+35
-42
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+15
-16
fs/cifs/cifsfs.h
fs/cifs/cifsfs.h
+2
-4
fs/cifs/file.c
fs/cifs/file.c
+18
-22
未找到文件。
fs/cifs/cifsfs.c
浏览文件 @
3dae8750
...
...
@@ -733,8 +733,7 @@ cifs_do_mount(struct file_system_type *fs_type,
goto
out
;
}
static
ssize_t
cifs_file_aio_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
static
ssize_t
cifs_file_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
struct
inode
*
inode
=
file_inode
(
iocb
->
ki_filp
);
struct
cifsInodeInfo
*
cinode
=
CIFS_I
(
inode
);
...
...
@@ -745,14 +744,14 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
if
(
written
)
return
written
;
written
=
generic_file_
aio_write
(
iocb
,
iov
,
nr_segs
,
pos
);
written
=
generic_file_
write_iter
(
iocb
,
from
);
if
(
CIFS_CACHE_WRITE
(
CIFS_I
(
inode
)))
goto
out
;
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
if
(
rc
)
cifs_dbg
(
FYI
,
"cifs_file_
aio_write
: %d rc on %p inode
\n
"
,
cifs_dbg
(
FYI
,
"cifs_file_
write_iter
: %d rc on %p inode
\n
"
,
rc
,
inode
);
out:
...
...
@@ -889,9 +888,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
const
struct
file_operations
cifs_file_ops
=
{
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
generic_file_read_iter
,
.
aio_write
=
cifs_file_aio_write
,
.
write_iter
=
cifs_file_write_iter
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
lock
=
cifs_lock
,
...
...
@@ -908,9 +907,9 @@ const struct file_operations cifs_file_ops = {
const
struct
file_operations
cifs_file_strict_ops
=
{
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
cifs_strict_readv
,
.
aio_write
=
cifs_strict_writev
,
.
write_iter
=
cifs_strict_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
lock
=
cifs_lock
,
...
...
@@ -928,9 +927,9 @@ const struct file_operations cifs_file_strict_ops = {
const
struct
file_operations
cifs_file_direct_ops
=
{
/* BB reevaluate whether they can be done with directio, no cache */
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
cifs_user_readv
,
.
aio_write
=
cifs_user_writev
,
.
write_iter
=
cifs_user_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
lock
=
cifs_lock
,
...
...
@@ -947,9 +946,9 @@ const struct file_operations cifs_file_direct_ops = {
const
struct
file_operations
cifs_file_nobrl_ops
=
{
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
generic_file_read_iter
,
.
aio_write
=
cifs_file_aio_write
,
.
write_iter
=
cifs_file_write_iter
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
fsync
=
cifs_fsync
,
...
...
@@ -965,9 +964,9 @@ const struct file_operations cifs_file_nobrl_ops = {
const
struct
file_operations
cifs_file_strict_nobrl_ops
=
{
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
cifs_strict_readv
,
.
aio_write
=
cifs_strict_writev
,
.
write_iter
=
cifs_strict_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
fsync
=
cifs_strict_fsync
,
...
...
@@ -984,9 +983,9 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
const
struct
file_operations
cifs_file_direct_nobrl_ops
=
{
/* BB reevaluate whether they can be done with directio, no cache */
.
read
=
new_sync_read
,
.
write
=
do
_sync_write
,
.
write
=
new
_sync_write
,
.
read_iter
=
cifs_user_readv
,
.
aio_write
=
cifs_user_writev
,
.
write_iter
=
cifs_user_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
fsync
=
cifs_fsync
,
...
...
fs/cifs/cifsfs.h
浏览文件 @
3dae8750
...
...
@@ -87,10 +87,8 @@ extern int cifs_close(struct inode *inode, struct file *file);
extern
int
cifs_closedir
(
struct
inode
*
inode
,
struct
file
*
file
);
extern
ssize_t
cifs_user_readv
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
);
extern
ssize_t
cifs_strict_readv
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
to
);
extern
ssize_t
cifs_user_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
extern
ssize_t
cifs_strict_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
extern
ssize_t
cifs_user_writev
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
);
extern
ssize_t
cifs_strict_writev
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
);
extern
int
cifs_lock
(
struct
file
*
,
int
,
struct
file_lock
*
);
extern
int
cifs_fsync
(
struct
file
*
,
loff_t
,
loff_t
,
int
);
extern
int
cifs_strict_fsync
(
struct
file
*
,
loff_t
,
loff_t
,
int
);
...
...
fs/cifs/file.c
浏览文件 @
3dae8750
...
...
@@ -2385,14 +2385,12 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata)
}
static
ssize_t
cifs_iovec_write
(
struct
file
*
file
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
*
poffset
)
cifs_iovec_write
(
struct
file
*
file
,
struct
iov_iter
*
from
,
loff_t
*
poffset
)
{
unsigned
long
nr_pages
,
i
;
size_t
bytes
,
copied
,
len
,
cur_len
;
ssize_t
total_written
=
0
;
loff_t
offset
;
struct
iov_iter
it
;
struct
cifsFileInfo
*
open_file
;
struct
cifs_tcon
*
tcon
;
struct
cifs_sb_info
*
cifs_sb
;
...
...
@@ -2401,14 +2399,16 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
int
rc
;
pid_t
pid
;
len
=
iov_length
(
iov
,
nr_segs
);
if
(
!
len
)
return
0
;
len
=
iov_iter_count
(
from
);
rc
=
generic_write_checks
(
file
,
poffset
,
&
len
,
0
);
if
(
rc
)
return
rc
;
if
(
!
len
)
return
0
;
iov_iter_truncate
(
from
,
len
);
INIT_LIST_HEAD
(
&
wdata_list
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
open_file
=
file
->
private_data
;
...
...
@@ -2424,7 +2424,6 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
else
pid
=
current
->
tgid
;
iov_iter_init
(
&
it
,
WRITE
,
iov
,
nr_segs
,
len
);
do
{
size_t
save_len
;
...
...
@@ -2446,7 +2445,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
for
(
i
=
0
;
i
<
nr_pages
;
i
++
)
{
bytes
=
min_t
(
size_t
,
cur_len
,
PAGE_SIZE
);
copied
=
copy_page_from_iter
(
wdata
->
pages
[
i
],
0
,
bytes
,
&
it
);
from
);
cur_len
-=
copied
;
/*
* If we didn't copy as much as we expected, then that
...
...
@@ -2545,11 +2544,11 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
return
total_written
?
total_written
:
(
ssize_t
)
rc
;
}
ssize_t
cifs_user_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
ssize_t
cifs_user_writev
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
ssize_t
written
;
struct
inode
*
inode
;
loff_t
pos
=
iocb
->
ki_pos
;
inode
=
file_inode
(
iocb
->
ki_filp
);
...
...
@@ -2559,7 +2558,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
* write request.
*/
written
=
cifs_iovec_write
(
iocb
->
ki_filp
,
iov
,
nr_segs
,
&
pos
);
written
=
cifs_iovec_write
(
iocb
->
ki_filp
,
from
,
&
pos
);
if
(
written
>
0
)
{
CIFS_I
(
inode
)
->
invalid_mapping
=
true
;
iocb
->
ki_pos
=
pos
;
...
...
@@ -2569,8 +2568,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
}
static
ssize_t
cifs_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
cifs_writev
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
cifsFileInfo
*
cfile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
...
...
@@ -2588,10 +2586,10 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov,
mutex_lock
(
&
inode
->
i_mutex
);
if
(
file
->
f_flags
&
O_APPEND
)
lock_pos
=
i_size_read
(
inode
);
if
(
!
cifs_find_lock_conflict
(
cfile
,
lock_pos
,
iov_
length
(
iov
,
nr_segs
),
if
(
!
cifs_find_lock_conflict
(
cfile
,
lock_pos
,
iov_
iter_count
(
from
),
server
->
vals
->
exclusive_lock_type
,
NULL
,
CIFS_WRITE_OP
))
{
rc
=
__generic_file_
aio_write
(
iocb
,
iov
,
nr_segs
);
rc
=
__generic_file_
write_iter
(
iocb
,
from
);
mutex_unlock
(
&
inode
->
i_mutex
);
if
(
rc
>
0
)
{
...
...
@@ -2609,8 +2607,7 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov,
}
ssize_t
cifs_strict_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
cifs_strict_writev
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
struct
inode
*
inode
=
file_inode
(
iocb
->
ki_filp
);
struct
cifsInodeInfo
*
cinode
=
CIFS_I
(
inode
);
...
...
@@ -2628,11 +2625,10 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
if
(
cap_unix
(
tcon
->
ses
)
&&
(
CIFS_UNIX_FCNTL_CAP
&
le64_to_cpu
(
tcon
->
fsUnixInfo
.
Capability
))
&&
((
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NOPOSIXBRL
)
==
0
))
{
written
=
generic_file_aio_write
(
iocb
,
iov
,
nr_segs
,
pos
);
written
=
generic_file_write_iter
(
iocb
,
from
);
goto
out
;
}
written
=
cifs_writev
(
iocb
,
iov
,
nr_segs
,
pos
);
written
=
cifs_writev
(
iocb
,
from
);
goto
out
;
}
/*
...
...
@@ -2641,7 +2637,7 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
* affected pages because it may cause a error with mandatory locks on
* these pages but not on the region from pos to ppos+len-1.
*/
written
=
cifs_user_writev
(
iocb
,
iov
,
nr_segs
,
pos
);
written
=
cifs_user_writev
(
iocb
,
from
);
if
(
written
>
0
&&
CIFS_CACHE_READ
(
cinode
))
{
/*
* Windows 7 server can delay breaking level2 oplock if a write
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录