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
bb7462b6
Commit
bb7462b6
authored
Feb 20, 2017
by
Miklos Szeredi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vfs: use helpers for calling f_op->{read,write}_iter()
Signed-off-by:
Miklos Szeredi
<
mszeredi@redhat.com
>
parent
0f78d06a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
11 deletions
+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
No files found.
drivers/block/loop.c
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
,
...
...
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