Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3dae8750
Commit
3dae8750
authored
Apr 03, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cifs: switch to ->write_iter()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
d4637bc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
42 deletions
+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
No files found.
fs/cifs/cifsfs.c
View file @
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
View file @
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
View file @
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment