Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
linux
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martyn Welch
linux
Commits
faa97c48
Commit
faa97c48
authored
Jan 26, 2021
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
take the guts of file-to-pipe splice into a helper function
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
313d64a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/splice.c
+18
-7
18 additions, 7 deletions
fs/splice.c
with
18 additions
and
7 deletions
fs/splice.c
+
18
−
7
View file @
faa97c48
...
@@ -1002,6 +1002,23 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
...
@@ -1002,6 +1002,23 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
struct
pipe_inode_info
*
opipe
,
struct
pipe_inode_info
*
opipe
,
size_t
len
,
unsigned
int
flags
);
size_t
len
,
unsigned
int
flags
);
static
long
splice_file_to_pipe
(
struct
file
*
in
,
struct
pipe_inode_info
*
opipe
,
loff_t
*
offset
,
size_t
len
,
unsigned
int
flags
)
{
long
ret
;
pipe_lock
(
opipe
);
ret
=
wait_for_space
(
opipe
,
flags
);
if
(
!
ret
)
ret
=
do_splice_to
(
in
,
offset
,
opipe
,
len
,
flags
);
pipe_unlock
(
opipe
);
if
(
ret
>
0
)
wakeup_pipe_readers
(
opipe
);
return
ret
;
}
/*
/*
* Determine where to splice to/from.
* Determine where to splice to/from.
*/
*/
...
@@ -1081,13 +1098,7 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
...
@@ -1081,13 +1098,7 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
if
(
out
->
f_flags
&
O_NONBLOCK
)
if
(
out
->
f_flags
&
O_NONBLOCK
)
flags
|=
SPLICE_F_NONBLOCK
;
flags
|=
SPLICE_F_NONBLOCK
;
pipe_lock
(
opipe
);
ret
=
splice_file_to_pipe
(
in
,
opipe
,
&
offset
,
len
,
flags
);
ret
=
wait_for_space
(
opipe
,
flags
);
if
(
!
ret
)
ret
=
do_splice_to
(
in
,
&
offset
,
opipe
,
len
,
flags
);
pipe_unlock
(
opipe
);
if
(
ret
>
0
)
wakeup_pipe_readers
(
opipe
);
if
(
!
off_in
)
if
(
!
off_in
)
in
->
f_pos
=
offset
;
in
->
f_pos
=
offset
;
else
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment