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
nexedi
linux
Commits
d82718e3
Commit
d82718e3
authored
Sep 17, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse_dev_splice_read(): switch to add_to_pipe()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
25869262
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
37 deletions
+9
-37
fs/fuse/dev.c
fs/fuse/dev.c
+9
-37
No files found.
fs/fuse/dev.c
View file @
d82718e3
...
...
@@ -1342,9 +1342,8 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
struct
pipe_inode_info
*
pipe
,
size_t
len
,
unsigned
int
flags
)
{
int
ret
;
int
total
,
ret
;
int
page_nr
=
0
;
int
do_wakeup
=
0
;
struct
pipe_buffer
*
bufs
;
struct
fuse_copy_state
cs
;
struct
fuse_dev
*
fud
=
fuse_get_dev
(
in
);
...
...
@@ -1363,50 +1362,23 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
if
(
ret
<
0
)
goto
out
;
ret
=
0
;
if
(
!
pipe
->
readers
)
{
send_sig
(
SIGPIPE
,
current
,
0
);
if
(
!
ret
)
ret
=
-
EPIPE
;
goto
out_unlock
;
}
if
(
pipe
->
nrbufs
+
cs
.
nr_segs
>
pipe
->
buffers
)
{
ret
=
-
EIO
;
goto
out
_unlock
;
goto
out
;
}
while
(
page_nr
<
cs
.
nr_segs
)
{
int
newbuf
=
(
pipe
->
curbuf
+
pipe
->
nrbufs
)
&
(
pipe
->
buffers
-
1
);
struct
pipe_buffer
*
buf
=
pipe
->
bufs
+
newbuf
;
buf
->
page
=
bufs
[
page_nr
].
page
;
buf
->
offset
=
bufs
[
page_nr
].
offset
;
buf
->
len
=
bufs
[
page_nr
].
len
;
for
(
ret
=
total
=
0
;
page_nr
<
cs
.
nr_segs
;
total
+=
ret
)
{
/*
* Need to be careful about this. Having buf->ops in module
* code can Oops if the buffer persists after module unload.
*/
buf
->
ops
=
&
nosteal_pipe_buf_ops
;
pipe
->
nrbufs
++
;
page_nr
++
;
ret
+=
buf
->
len
;
if
(
pipe
->
files
)
do_wakeup
=
1
;
}
out_unlock:
if
(
do_wakeup
)
{
smp_mb
();
if
(
waitqueue_active
(
&
pipe
->
wait
))
wake_up_interruptible
(
&
pipe
->
wait
);
kill_fasync
(
&
pipe
->
fasync_readers
,
SIGIO
,
POLL_IN
);
bufs
[
page_nr
].
ops
=
&
nosteal_pipe_buf_ops
;
ret
=
add_to_pipe
(
pipe
,
&
bufs
[
page_nr
++
]);
if
(
unlikely
(
ret
<
0
))
break
;
}
if
(
total
)
ret
=
total
;
out:
for
(;
page_nr
<
cs
.
nr_segs
;
page_nr
++
)
put_page
(
bufs
[
page_nr
].
page
);
...
...
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