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
c9c37e2e
Commit
c9c37e2e
authored
Mar 16, 2014
by
Al Viro
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: switch to iov_iter_get_pages()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
d22a943f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
fs/fuse/file.c
fs/fuse/file.c
+12
-21
No files found.
fs/fuse/file.c
View file @
c9c37e2e
...
@@ -1294,7 +1294,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
...
@@ -1294,7 +1294,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
size_t
nbytes
=
0
;
/* # bytes already packed in req */
size_t
nbytes
=
0
;
/* # bytes already packed in req */
/* Special case for kernel I/O: can copy directly into the buffer */
/* Special case for kernel I/O: can copy directly into the buffer */
if
(
segment_eq
(
get_fs
(),
KERNEL_DS
)
)
{
if
(
ii
->
type
&
REQ_KERNEL
)
{
unsigned
long
user_addr
=
fuse_get_user_addr
(
ii
);
unsigned
long
user_addr
=
fuse_get_user_addr
(
ii
);
size_t
frag_size
=
fuse_get_frag_size
(
ii
,
*
nbytesp
);
size_t
frag_size
=
fuse_get_frag_size
(
ii
,
*
nbytesp
);
...
@@ -1310,35 +1310,26 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
...
@@ -1310,35 +1310,26 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
while
(
nbytes
<
*
nbytesp
&&
req
->
num_pages
<
req
->
max_pages
)
{
while
(
nbytes
<
*
nbytesp
&&
req
->
num_pages
<
req
->
max_pages
)
{
unsigned
npages
;
unsigned
npages
;
unsigned
long
user_addr
=
fuse_get_user_addr
(
ii
);
size_t
start
,
end
,
frag_size
;
unsigned
offset
=
user_addr
&
~
PAGE_MASK
;
size_t
frag_size
=
fuse_get_frag_size
(
ii
,
*
nbytesp
-
nbytes
);
int
ret
;
unsigned
n
=
req
->
max_pages
-
req
->
num_pages
;
unsigned
n
=
req
->
max_pages
-
req
->
num_pages
;
frag_size
=
min_t
(
size_t
,
frag_size
,
n
<<
PAGE_SHIFT
);
ssize_t
ret
=
iov_iter_get_pages
(
ii
,
&
req
->
pages
[
req
->
num_pages
],
npages
=
(
frag_size
+
offset
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
n
*
PAGE_SIZE
,
&
start
);
npages
=
clamp
(
npages
,
1U
,
n
);
ret
=
get_user_pages_fast
(
user_addr
,
npages
,
!
write
,
&
req
->
pages
[
req
->
num_pages
]);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
npages
=
ret
;
iov_iter_advance
(
ii
,
ret
);
frag_size
=
min_t
(
size_t
,
frag_size
,
nbytes
+=
ret
;
(
npages
<<
PAGE_SHIFT
)
-
offset
);
iov_iter_advance
(
ii
,
frag_size
);
req
->
page_descs
[
req
->
num_pages
].
offset
=
offset
;
ret
+=
start
;
npages
=
(
ret
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
;
req
->
page_descs
[
req
->
num_pages
].
offset
=
start
;
fuse_page_descs_length_init
(
req
,
req
->
num_pages
,
npages
);
fuse_page_descs_length_init
(
req
,
req
->
num_pages
,
npages
);
req
->
num_pages
+=
npages
;
req
->
num_pages
+=
npages
;
req
->
page_descs
[
req
->
num_pages
-
1
].
length
-=
req
->
page_descs
[
req
->
num_pages
-
1
].
length
-=
(
npages
<<
PAGE_SHIFT
)
-
offset
-
frag_size
;
(
PAGE_SIZE
-
ret
)
&
(
PAGE_SIZE
-
1
);
nbytes
+=
frag_size
;
}
}
if
(
write
)
if
(
write
)
...
...
Kirill Smelkov
@kirr
mentioned in commit
ad0f3236
·
Jun 08, 2016
mentioned in commit
ad0f3236
mentioned in commit ad0f3236b95c392787cb8555aea5ee1c4d84f01e
Toggle commit list
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