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
99733fa3
Commit
99733fa3
authored
Apr 07, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xfs_file_aio_write_checks: switch to iocb/iov_iter
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
0fa6b005
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
fs/xfs/xfs_file.c
fs/xfs/xfs_file.c
+16
-15
No files found.
fs/xfs/xfs_file.c
View file @
99733fa3
...
@@ -544,17 +544,18 @@ xfs_zero_eof(
...
@@ -544,17 +544,18 @@ xfs_zero_eof(
*/
*/
STATIC
ssize_t
STATIC
ssize_t
xfs_file_aio_write_checks
(
xfs_file_aio_write_checks
(
struct
file
*
file
,
struct
kiocb
*
iocb
,
loff_t
*
pos
,
struct
iov_iter
*
from
,
size_t
*
count
,
int
*
iolock
)
int
*
iolock
)
{
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
inode
*
inode
=
file
->
f_mapping
->
host
;
struct
inode
*
inode
=
file
->
f_mapping
->
host
;
struct
xfs_inode
*
ip
=
XFS_I
(
inode
);
struct
xfs_inode
*
ip
=
XFS_I
(
inode
);
int
error
=
0
;
int
error
=
0
;
size_t
count
=
iov_iter_count
(
from
);
restart:
restart:
error
=
generic_write_checks
(
file
,
pos
,
count
);
error
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
@@ -569,7 +570,7 @@ xfs_file_aio_write_checks(
...
@@ -569,7 +570,7 @@ xfs_file_aio_write_checks(
* iolock shared, we need to update it to exclusive which implies
* iolock shared, we need to update it to exclusive which implies
* having to redo all checks before.
* having to redo all checks before.
*/
*/
if
(
*
pos
>
i_size_read
(
inode
))
{
if
(
iocb
->
ki_
pos
>
i_size_read
(
inode
))
{
bool
zero
=
false
;
bool
zero
=
false
;
if
(
*
iolock
==
XFS_IOLOCK_SHARED
)
{
if
(
*
iolock
==
XFS_IOLOCK_SHARED
)
{
...
@@ -578,10 +579,11 @@ xfs_file_aio_write_checks(
...
@@ -578,10 +579,11 @@ xfs_file_aio_write_checks(
xfs_rw_ilock
(
ip
,
*
iolock
);
xfs_rw_ilock
(
ip
,
*
iolock
);
goto
restart
;
goto
restart
;
}
}
error
=
xfs_zero_eof
(
ip
,
*
pos
,
i_size_read
(
inode
),
&
zero
);
error
=
xfs_zero_eof
(
ip
,
iocb
->
ki_
pos
,
i_size_read
(
inode
),
&
zero
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
}
}
iov_iter_truncate
(
from
,
count
);
/*
/*
* Updating the timestamps will grab the ilock again from
* Updating the timestamps will grab the ilock again from
...
@@ -678,10 +680,11 @@ xfs_file_dio_aio_write(
...
@@ -678,10 +680,11 @@ xfs_file_dio_aio_write(
xfs_rw_ilock
(
ip
,
iolock
);
xfs_rw_ilock
(
ip
,
iolock
);
}
}
ret
=
xfs_file_aio_write_checks
(
file
,
&
pos
,
&
count
,
&
iolock
);
ret
=
xfs_file_aio_write_checks
(
iocb
,
from
,
&
iolock
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
out
;
iov_iter_truncate
(
from
,
count
);
count
=
iov_iter_count
(
from
);
pos
=
iocb
->
ki_pos
;
if
(
mapping
->
nrpages
)
{
if
(
mapping
->
nrpages
)
{
ret
=
filemap_write_and_wait_range
(
VFS_I
(
ip
)
->
i_mapping
,
ret
=
filemap_write_and_wait_range
(
VFS_I
(
ip
)
->
i_mapping
,
...
@@ -734,24 +737,22 @@ xfs_file_buffered_aio_write(
...
@@ -734,24 +737,22 @@ xfs_file_buffered_aio_write(
ssize_t
ret
;
ssize_t
ret
;
int
enospc
=
0
;
int
enospc
=
0
;
int
iolock
=
XFS_IOLOCK_EXCL
;
int
iolock
=
XFS_IOLOCK_EXCL
;
loff_t
pos
=
iocb
->
ki_pos
;
size_t
count
=
iov_iter_count
(
from
);
xfs_rw_ilock
(
ip
,
iolock
);
xfs_rw_ilock
(
ip
,
iolock
);
ret
=
xfs_file_aio_write_checks
(
file
,
&
pos
,
&
count
,
&
iolock
);
ret
=
xfs_file_aio_write_checks
(
iocb
,
from
,
&
iolock
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
out
;
iov_iter_truncate
(
from
,
count
);
/* We can write back this queue in page reclaim */
/* We can write back this queue in page reclaim */
current
->
backing_dev_info
=
inode_to_bdi
(
inode
);
current
->
backing_dev_info
=
inode_to_bdi
(
inode
);
write_retry:
write_retry:
trace_xfs_file_buffered_write
(
ip
,
count
,
iocb
->
ki_pos
,
0
);
trace_xfs_file_buffered_write
(
ip
,
iov_iter_count
(
from
),
ret
=
generic_perform_write
(
file
,
from
,
pos
);
iocb
->
ki_pos
,
0
);
ret
=
generic_perform_write
(
file
,
from
,
iocb
->
ki_pos
);
if
(
likely
(
ret
>=
0
))
if
(
likely
(
ret
>=
0
))
iocb
->
ki_pos
=
pos
+
ret
;
iocb
->
ki_pos
+=
ret
;
/*
/*
* If we hit a space limit, try to free up some lingering preallocated
* If we hit a space limit, try to free up some lingering preallocated
...
...
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