Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
bb7ac03a
Commit
bb7ac03a
authored
Jun 19, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iov: Add iov_grow_page() helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
997f08ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
page-pipe.c
page-pipe.c
+15
-14
No files found.
page-pipe.c
View file @
bb7ac03a
...
...
@@ -8,6 +8,17 @@
#include "util.h"
#include "page-pipe.h"
/* can existing iov accumulate the page? */
static
inline
bool
iov_grow_page
(
struct
iovec
*
iov
,
unsigned
long
addr
)
{
if
((
unsigned
long
)
iov
->
iov_base
+
iov
->
iov_len
==
addr
)
{
iov
->
iov_len
+=
PAGE_SIZE
;
return
true
;
}
return
false
;
}
static
int
page_pipe_grow
(
struct
page_pipe
*
pp
)
{
struct
page_pipe_buf
*
ppb
;
...
...
@@ -110,8 +121,6 @@ void page_pipe_reinit(struct page_pipe *pp)
static
inline
int
try_add_page_to
(
struct
page_pipe
*
pp
,
struct
page_pipe_buf
*
ppb
,
unsigned
long
addr
)
{
struct
iovec
*
iov
;
if
(
ppb
->
pages_in
==
ppb
->
pipe_size
)
{
unsigned
long
new_size
=
ppb
->
pipe_size
<<
1
;
int
ret
;
...
...
@@ -131,12 +140,8 @@ static inline int try_add_page_to(struct page_pipe *pp, struct page_pipe_buf *pp
}
if
(
ppb
->
nr_segs
)
{
/* can existing iov accumulate the page? */
iov
=
&
ppb
->
iov
[
ppb
->
nr_segs
-
1
];
if
((
unsigned
long
)
iov
->
iov_base
+
iov
->
iov_len
==
addr
)
{
iov
->
iov_len
+=
PAGE_SIZE
;
if
(
iov_grow_page
(
&
ppb
->
iov
[
ppb
->
nr_segs
-
1
],
addr
))
goto
out
;
}
if
(
ppb
->
nr_segs
==
UIO_MAXIOV
)
/* XXX -- shrink pipe back? */
...
...
@@ -193,13 +198,9 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr)
pp
->
nr_holes
+=
PP_HOLES_BATCH
;
}
if
(
pp
->
free_hole
)
{
iov
=
&
pp
->
holes
[
pp
->
free_hole
-
1
];
if
((
unsigned
long
)
iov
->
iov_base
+
iov
->
iov_len
==
addr
)
{
iov
->
iov_len
+=
PAGE_SIZE
;
goto
out
;
}
}
if
(
pp
->
free_hole
&&
iov_grow_page
(
&
pp
->
holes
[
pp
->
free_hole
-
1
],
addr
))
goto
out
;
iov
=
&
pp
->
holes
[
pp
->
free_hole
];
iov
->
iov_base
=
(
void
*
)
addr
;
...
...
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