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
98f0bc99
Commit
98f0bc99
authored
Sep 23, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bio_map_user_iov(): move alignment check into the main loop
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
e2e115d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
block/bio.c
block/bio.c
+27
-27
No files found.
block/bio.c
View file @
98f0bc99
...
...
@@ -1344,11 +1344,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
return
ERR_PTR
(
-
EINVAL
);
nr_pages
+=
end
-
start
;
/*
* buffer must be aligned to at least logical block size for now
*/
if
(
uaddr
&
queue_dma_alignment
(
q
))
return
ERR_PTR
(
-
EINVAL
);
}
if
(
!
nr_pages
)
...
...
@@ -1373,29 +1368,34 @@ struct bio *bio_map_user_iov(struct request_queue *q,
npages
=
DIV_ROUND_UP
(
offs
+
bytes
,
PAGE_SIZE
);
for
(
j
=
0
;
j
<
npages
;
j
++
)
{
unsigned
int
n
=
PAGE_SIZE
-
offs
;
unsigned
short
prev_bi_vcnt
=
bio
->
bi_vcnt
;
if
(
n
>
bytes
)
n
=
bytes
;
if
(
!
bio_add_pc_page
(
q
,
bio
,
pages
[
j
],
n
,
offs
))
break
;
/*
* check if vector was merged with previous
* drop page reference if needed
*/
if
(
bio
->
bi_vcnt
==
prev_bi_vcnt
)
put_page
(
pages
[
j
]);
added
+=
n
;
bytes
-=
n
;
offs
=
0
;
if
(
unlikely
(
offs
&
queue_dma_alignment
(
q
)))
{
ret
=
-
EINVAL
;
j
=
0
;
}
else
{
for
(
j
=
0
;
j
<
npages
;
j
++
)
{
struct
page
*
page
=
pages
[
j
];
unsigned
int
n
=
PAGE_SIZE
-
offs
;
unsigned
short
prev_bi_vcnt
=
bio
->
bi_vcnt
;
if
(
n
>
bytes
)
n
=
bytes
;
if
(
!
bio_add_pc_page
(
q
,
bio
,
page
,
n
,
offs
))
break
;
/*
* check if vector was merged with previous
* drop page reference if needed
*/
if
(
bio
->
bi_vcnt
==
prev_bi_vcnt
)
put_page
(
page
);
added
+=
n
;
bytes
-=
n
;
offs
=
0
;
}
iov_iter_advance
(
&
i
,
added
);
}
iov_iter_advance
(
&
i
,
added
);
/*
* release the pages we didn't map into the bio, if any
*/
...
...
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