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
2ff3e9b6
Commit
2ff3e9b6
authored
Oct 29, 2007
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add O_SYNC support to btrfs_file_write
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
b56baf5b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
fs/btrfs/file.c
fs/btrfs/file.c
+13
-2
No files found.
fs/btrfs/file.c
View file @
2ff3e9b6
...
...
@@ -635,8 +635,9 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
size_t
count
,
loff_t
*
ppos
)
{
loff_t
pos
;
size_t
num_written
=
0
;
int
err
=
0
;
loff_t
start_pos
;
ssize_t
num_written
=
0
;
ssize_t
err
=
0
;
int
ret
=
0
;
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
...
...
@@ -652,7 +653,10 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
pinned
[
1
]
=
NULL
;
if
(
file
->
f_flags
&
O_DIRECT
)
return
-
EINVAL
;
pos
=
*
ppos
;
start_pos
=
pos
;
vfs_check_frozen
(
inode
->
i_sb
,
SB_FREEZE_WRITE
);
current
->
backing_dev_info
=
inode
->
i_mapping
->
backing_dev_info
;
err
=
generic_write_checks
(
file
,
&
pos
,
&
count
,
S_ISBLK
(
inode
->
i_mode
));
...
...
@@ -743,6 +747,13 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
if
(
pinned
[
1
])
page_cache_release
(
pinned
[
1
]);
*
ppos
=
pos
;
if
(
num_written
>
0
&&
((
file
->
f_flags
&
O_SYNC
)
||
IS_SYNC
(
inode
)))
{
err
=
sync_page_range
(
inode
,
inode
->
i_mapping
,
start_pos
,
num_written
);
if
(
err
<
0
)
num_written
=
err
;
}
current
->
backing_dev_info
=
NULL
;
return
num_written
?
num_written
:
err
;
}
...
...
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