Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
linux
Commits
53ad8626
Commit
53ad8626
authored
4 years ago
by
Christoph Hellwig
Browse files
Options
Download
Email Patches
Plain Diff
fs: remove __vfs_write
Fold it into the two callers. Signed-off-by:
Christoph Hellwig
<
hch@lst.de
>
parent
81238b2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
fs/read_write.c
fs/read_write.c
+22
-24
No files found.
fs/read_write.c
View file @
53ad8626
...
@@ -488,17 +488,6 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
...
@@ -488,17 +488,6 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
return
ret
;
return
ret
;
}
}
static
ssize_t
__vfs_write
(
struct
file
*
file
,
const
char
__user
*
p
,
size_t
count
,
loff_t
*
pos
)
{
if
(
file
->
f_op
->
write
)
return
file
->
f_op
->
write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
return
new_sync_write
(
file
,
p
,
count
,
pos
);
else
return
-
EINVAL
;
}
/* caller is responsible for file_start_write/file_end_write */
/* caller is responsible for file_start_write/file_end_write */
ssize_t
__kernel_write
(
struct
file
*
file
,
const
void
*
buf
,
size_t
count
,
loff_t
*
pos
)
ssize_t
__kernel_write
(
struct
file
*
file
,
const
void
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
{
...
@@ -516,7 +505,12 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
...
@@ -516,7 +505,12 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
p
=
(
__force
const
char
__user
*
)
buf
;
p
=
(
__force
const
char
__user
*
)
buf
;
if
(
count
>
MAX_RW_COUNT
)
if
(
count
>
MAX_RW_COUNT
)
count
=
MAX_RW_COUNT
;
count
=
MAX_RW_COUNT
;
ret
=
__vfs_write
(
file
,
p
,
count
,
pos
);
if
(
file
->
f_op
->
write
)
ret
=
file
->
f_op
->
write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
ret
=
new_sync_write
(
file
,
p
,
count
,
pos
);
else
ret
=
-
EINVAL
;
set_fs
(
old_fs
);
set_fs
(
old_fs
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
fsnotify_modify
(
file
);
...
@@ -554,19 +548,23 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
...
@@ -554,19 +548,23 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
return
-
EFAULT
;
return
-
EFAULT
;
ret
=
rw_verify_area
(
WRITE
,
file
,
pos
,
count
);
ret
=
rw_verify_area
(
WRITE
,
file
,
pos
,
count
);
if
(
!
ret
)
{
if
(
ret
)
if
(
count
>
MAX_RW_COUNT
)
return
ret
;
count
=
MAX_RW_COUNT
;
if
(
count
>
MAX_RW_COUNT
)
file_start_write
(
file
);
count
=
MAX_RW_COUNT
;
ret
=
__vfs_write
(
file
,
buf
,
count
,
pos
);
file_start_write
(
file
);
if
(
ret
>
0
)
{
if
(
file
->
f_op
->
write
)
fsnotify_modify
(
file
);
ret
=
file
->
f_op
->
write
(
file
,
buf
,
count
,
pos
);
add_wchar
(
current
,
ret
);
else
if
(
file
->
f_op
->
write_iter
)
}
ret
=
new_sync_write
(
file
,
buf
,
count
,
pos
);
inc_syscw
(
current
);
else
file_end_write
(
file
);
ret
=
-
EINVAL
;
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
add_wchar
(
current
,
ret
);
}
}
inc_syscw
(
current
);
file_end_write
(
file
);
return
ret
;
return
ret
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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