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
fc8699e8
Commit
fc8699e8
authored
Jan 07, 2005
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge small pipe writes into the write buffers
parent
0d8e3a15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
fs/pipe.c
fs/pipe.c
+22
-0
No files found.
fs/pipe.c
View file @
fc8699e8
...
@@ -203,6 +203,27 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
...
@@ -203,6 +203,27 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
ret
=
0
;
ret
=
0
;
down
(
PIPE_SEM
(
*
inode
));
down
(
PIPE_SEM
(
*
inode
));
info
=
inode
->
i_pipe
;
info
=
inode
->
i_pipe
;
/* We try to merge small writes */
if
(
info
->
nrbufs
&&
total_len
<
PAGE_SIZE
)
{
int
lastbuf
=
(
info
->
curbuf
+
info
->
nrbufs
-
1
)
&
(
PIPE_BUFFERS
-
1
);
struct
pipe_buffer
*
buf
=
info
->
bufs
+
lastbuf
;
int
offset
=
buf
->
offset
+
buf
->
len
;
if
(
offset
+
total_len
<=
PAGE_SIZE
)
{
struct
page
*
page
=
buf
->
page
;
int
error
=
pipe_iov_copy_from_user
(
offset
+
kmap
(
page
),
iov
,
total_len
);
kunmap
(
page
);
ret
=
error
;
do_wakeup
=
1
;
if
(
error
)
goto
out
;
buf
->
len
+=
total_len
;
ret
=
total_len
;
goto
out
;
}
}
for
(;;)
{
for
(;;)
{
int
bufs
;
int
bufs
;
if
(
!
PIPE_READERS
(
*
inode
))
{
if
(
!
PIPE_READERS
(
*
inode
))
{
...
@@ -270,6 +291,7 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
...
@@ -270,6 +291,7 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
pipe_wait
(
inode
);
pipe_wait
(
inode
);
PIPE_WAITING_WRITERS
(
*
inode
)
--
;
PIPE_WAITING_WRITERS
(
*
inode
)
--
;
}
}
out:
up
(
PIPE_SEM
(
*
inode
));
up
(
PIPE_SEM
(
*
inode
));
if
(
do_wakeup
)
{
if
(
do_wakeup
)
{
wake_up_interruptible
(
PIPE_WAIT
(
*
inode
));
wake_up_interruptible
(
PIPE_WAIT
(
*
inode
));
...
...
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