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
78e1f386
Commit
78e1f386
authored
Nov 25, 2018
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iov_iter: teach csum_and_copy_to_iter() to handle pipe-backed ones
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
2084ac6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
lib/iov_iter.c
lib/iov_iter.c
+37
-1
No files found.
lib/iov_iter.c
View file @
78e1f386
...
...
@@ -560,6 +560,38 @@ static size_t copy_pipe_to_iter(const void *addr, size_t bytes,
return
bytes
;
}
static
size_t
csum_and_copy_to_pipe_iter
(
const
void
*
addr
,
size_t
bytes
,
__wsum
*
csum
,
struct
iov_iter
*
i
)
{
struct
pipe_inode_info
*
pipe
=
i
->
pipe
;
size_t
n
,
r
;
size_t
off
=
0
;
__wsum
sum
=
*
csum
,
next
;
int
idx
;
if
(
!
sanity
(
i
))
return
0
;
bytes
=
n
=
push_pipe
(
i
,
bytes
,
&
idx
,
&
r
);
if
(
unlikely
(
!
n
))
return
0
;
for
(
;
n
;
idx
=
next_idx
(
idx
,
pipe
),
r
=
0
)
{
size_t
chunk
=
min_t
(
size_t
,
n
,
PAGE_SIZE
-
r
);
char
*
p
=
kmap_atomic
(
pipe
->
bufs
[
idx
].
page
);
next
=
csum_partial_copy_nocheck
(
addr
,
p
+
r
,
chunk
,
0
);
sum
=
csum_block_add
(
sum
,
next
,
off
);
kunmap_atomic
(
p
);
i
->
idx
=
idx
;
i
->
iov_offset
=
r
+
chunk
;
n
-=
chunk
;
off
+=
chunk
;
addr
+=
chunk
;
}
i
->
count
-=
bytes
;
*
csum
=
sum
;
return
bytes
;
}
size_t
_copy_to_iter
(
const
void
*
addr
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
const
char
*
from
=
addr
;
...
...
@@ -1438,8 +1470,12 @@ size_t csum_and_copy_to_iter(const void *addr, size_t bytes, __wsum *csum,
const
char
*
from
=
addr
;
__wsum
sum
,
next
;
size_t
off
=
0
;
if
(
unlikely
(
iov_iter_is_pipe
(
i
)))
return
csum_and_copy_to_pipe_iter
(
addr
,
bytes
,
csum
,
i
);
sum
=
*
csum
;
if
(
unlikely
(
iov_iter_is_
pipe
(
i
)
||
iov_iter_is_
discard
(
i
)))
{
if
(
unlikely
(
iov_iter_is_discard
(
i
)))
{
WARN_ON
(
1
);
/* for now */
return
0
;
}
...
...
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