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
0ae5e4d3
Commit
0ae5e4d3
authored
Mar 03, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__btrfs_direct_write(): switch to iov_iter
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
f8579f86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
fs/btrfs/file.c
fs/btrfs/file.c
+8
-11
No files found.
fs/btrfs/file.c
View file @
0ae5e4d3
...
@@ -1658,25 +1658,23 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
...
@@ -1658,25 +1658,23 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
}
}
static
ssize_t
__btrfs_direct_write
(
struct
kiocb
*
iocb
,
static
ssize_t
__btrfs_direct_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
struct
iov_iter
*
from
,
unsigned
long
nr_segs
,
loff_t
pos
,
loff_t
pos
,
size_t
count
,
size_t
ocount
)
size_t
count
,
size_t
ocount
)
{
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
file
*
file
=
iocb
->
ki_filp
;
struct
iov_iter
i
;
ssize_t
written
;
ssize_t
written
;
ssize_t
written_buffered
;
ssize_t
written_buffered
;
loff_t
endbyte
;
loff_t
endbyte
;
int
err
;
int
err
;
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
0
);
written
=
generic_file_direct_write
(
iocb
,
from
,
pos
,
count
,
ocount
);
written
=
generic_file_direct_write
(
iocb
,
&
i
,
pos
,
count
,
ocount
);
if
(
written
<
0
||
written
==
count
)
if
(
written
<
0
||
written
==
count
)
return
written
;
return
written
;
pos
+=
written
;
pos
+=
written
;
written_buffered
=
__btrfs_buffered_write
(
file
,
&
i
,
pos
);
written_buffered
=
__btrfs_buffered_write
(
file
,
from
,
pos
);
if
(
written_buffered
<
0
)
{
if
(
written_buffered
<
0
)
{
err
=
written_buffered
;
err
=
written_buffered
;
goto
out
;
goto
out
;
...
@@ -1724,6 +1722,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
...
@@ -1724,6 +1722,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
ssize_t
err
=
0
;
ssize_t
err
=
0
;
size_t
count
,
ocount
;
size_t
count
,
ocount
;
bool
sync
=
(
file
->
f_flags
&
O_DSYNC
)
||
IS_SYNC
(
file
->
f_mapping
->
host
);
bool
sync
=
(
file
->
f_flags
&
O_DSYNC
)
||
IS_SYNC
(
file
->
f_mapping
->
host
);
struct
iov_iter
i
;
mutex_lock
(
&
inode
->
i_mutex
);
mutex_lock
(
&
inode
->
i_mutex
);
...
@@ -1746,6 +1745,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
...
@@ -1746,6 +1745,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
goto
out
;
goto
out
;
}
}
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
0
);
err
=
file_remove_suid
(
file
);
err
=
file_remove_suid
(
file
);
if
(
err
)
{
if
(
err
)
{
mutex_unlock
(
&
inode
->
i_mutex
);
mutex_unlock
(
&
inode
->
i_mutex
);
...
@@ -1787,13 +1788,9 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
...
@@ -1787,13 +1788,9 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
atomic_inc
(
&
BTRFS_I
(
inode
)
->
sync_writers
);
atomic_inc
(
&
BTRFS_I
(
inode
)
->
sync_writers
);
if
(
unlikely
(
file
->
f_flags
&
O_DIRECT
))
{
if
(
unlikely
(
file
->
f_flags
&
O_DIRECT
))
{
num_written
=
__btrfs_direct_write
(
iocb
,
iov
,
nr_segs
,
num_written
=
__btrfs_direct_write
(
iocb
,
&
i
,
pos
,
count
,
ocount
);
pos
,
count
,
ocount
);
}
else
{
}
else
{
struct
iov_iter
i
;
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
num_written
);
num_written
=
__btrfs_buffered_write
(
file
,
&
i
,
pos
);
num_written
=
__btrfs_buffered_write
(
file
,
&
i
,
pos
);
if
(
num_written
>
0
)
if
(
num_written
>
0
)
iocb
->
ki_pos
=
pos
+
num_written
;
iocb
->
ki_pos
=
pos
+
num_written
;
...
...
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