Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
f8579f86
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f8579f86
编写于
3月 03, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
generic_file_direct_write(): switch to iov_iter
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e7c24607
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
23 deletion
+19
-23
fs/btrfs/file.c
fs/btrfs/file.c
+2
-4
fs/fuse/file.c
fs/fuse/file.c
+2
-4
fs/ocfs2/file.c
fs/ocfs2/file.c
+3
-3
fs/xfs/xfs_file.c
fs/xfs/xfs_file.c
+3
-2
include/linux/fs.h
include/linux/fs.h
+2
-2
mm/filemap.c
mm/filemap.c
+7
-8
未找到文件。
fs/btrfs/file.c
浏览文件 @
f8579f86
...
...
@@ -1669,15 +1669,13 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
loff_t
endbyte
;
int
err
;
written
=
generic_file_direct_write
(
iocb
,
iov
,
&
nr_segs
,
pos
,
count
,
ocount
);
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
0
);
written
=
generic_file_direct_write
(
iocb
,
&
i
,
pos
,
count
,
ocount
);
if
(
written
<
0
||
written
==
count
)
return
written
;
pos
+=
written
;
count
-=
written
;
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
written
);
written_buffered
=
__btrfs_buffered_write
(
file
,
&
i
,
pos
);
if
(
written_buffered
<
0
)
{
err
=
written_buffered
;
...
...
fs/fuse/file.c
浏览文件 @
f8579f86
...
...
@@ -1235,15 +1235,13 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
goto
out
;
if
(
file
->
f_flags
&
O_DIRECT
)
{
written
=
generic_file_direct_write
(
iocb
,
iov
,
&
nr_segs
,
pos
,
count
,
ocount
);
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
0
);
written
=
generic_file_direct_write
(
iocb
,
&
i
,
pos
,
count
,
ocount
);
if
(
written
<
0
||
written
==
count
)
goto
out
;
pos
+=
written
;
count
-=
written
;
iov_iter_init
(
&
i
,
iov
,
nr_segs
,
count
,
written
);
written_buffered
=
fuse_perform_write
(
file
,
mapping
,
&
i
,
pos
);
if
(
written_buffered
<
0
)
{
err
=
written_buffered
;
...
...
fs/ocfs2/file.c
浏览文件 @
f8579f86
...
...
@@ -2251,6 +2251,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
int
full_coherency
=
!
(
osb
->
s_mount_opt
&
OCFS2_MOUNT_COHERENCY_BUFFERED
);
int
unaligned_dio
=
0
;
struct
iov_iter
from
;
trace_ocfs2_file_aio_write
(
inode
,
file
,
file
->
f_path
.
dentry
,
(
unsigned
long
long
)
OCFS2_I
(
inode
)
->
ip_blkno
,
...
...
@@ -2365,16 +2366,15 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
if
(
ret
)
goto
out_dio
;
iov_iter_init
(
&
from
,
iov
,
nr_segs
,
count
,
0
);
if
(
direct_io
)
{
written
=
generic_file_direct_write
(
iocb
,
iov
,
&
nr_segs
,
*
ppos
,
written
=
generic_file_direct_write
(
iocb
,
&
from
,
*
ppos
,
count
,
ocount
);
if
(
written
<
0
)
{
ret
=
written
;
goto
out_dio
;
}
}
else
{
struct
iov_iter
from
;
iov_iter_init
(
&
from
,
iov
,
nr_segs
,
count
,
0
);
current
->
backing_dev_info
=
file
->
f_mapping
->
backing_dev_info
;
written
=
generic_perform_write
(
file
,
&
from
,
*
ppos
);
if
(
likely
(
written
>=
0
))
...
...
fs/xfs/xfs_file.c
浏览文件 @
f8579f86
...
...
@@ -641,6 +641,7 @@ xfs_file_dio_aio_write(
int
iolock
;
struct
xfs_buftarg
*
target
=
XFS_IS_REALTIME_INODE
(
ip
)
?
mp
->
m_rtdev_targp
:
mp
->
m_ddev_targp
;
struct
iov_iter
from
;
/* DIO must be aligned to device logical sector size */
if
((
pos
|
count
)
&
target
->
bt_logical_sectormask
)
...
...
@@ -698,8 +699,8 @@ xfs_file_dio_aio_write(
}
trace_xfs_file_direct_write
(
ip
,
count
,
iocb
->
ki_pos
,
0
);
ret
=
generic_file_direct_write
(
iocb
,
iovp
,
&
nr_segs
,
pos
,
count
,
ocount
);
iov_iter_init
(
&
from
,
iovp
,
nr_segs
,
count
,
0
);
ret
=
generic_file_direct_write
(
iocb
,
&
from
,
pos
,
count
,
ocount
);
out:
xfs_rw_iunlock
(
ip
,
iolock
);
...
...
include/linux/fs.h
浏览文件 @
f8579f86
...
...
@@ -2407,8 +2407,8 @@ int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isbl
extern
ssize_t
generic_file_aio_read
(
struct
kiocb
*
,
const
struct
iovec
*
,
unsigned
long
,
loff_t
);
extern
ssize_t
__generic_file_aio_write
(
struct
kiocb
*
,
const
struct
iovec
*
,
unsigned
long
);
extern
ssize_t
generic_file_aio_write
(
struct
kiocb
*
,
const
struct
iovec
*
,
unsigned
long
,
loff_t
);
extern
ssize_t
generic_file_direct_write
(
struct
kiocb
*
,
const
struct
iovec
*
,
unsigned
long
*
,
loff_t
,
size_t
,
size_t
);
extern
ssize_t
generic_file_direct_write
(
struct
kiocb
*
,
struct
iov_iter
*
,
loff_t
,
size_t
,
size_t
);
extern
ssize_t
generic_perform_write
(
struct
file
*
,
struct
iov_iter
*
,
loff_t
);
extern
ssize_t
do_sync_read
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
len
,
loff_t
*
ppos
);
extern
ssize_t
do_sync_write
(
struct
file
*
filp
,
const
char
__user
*
buf
,
size_t
len
,
loff_t
*
ppos
);
...
...
mm/filemap.c
浏览文件 @
f8579f86
...
...
@@ -2385,9 +2385,8 @@ int pagecache_write_end(struct file *file, struct address_space *mapping,
EXPORT_SYMBOL
(
pagecache_write_end
);
ssize_t
generic_file_direct_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
*
nr_segs
,
loff_t
pos
,
size_t
count
,
size_t
ocount
)
generic_file_direct_write
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
,
loff_t
pos
,
size_t
count
,
size_t
ocount
)
{
struct
file
*
file
=
iocb
->
ki_filp
;
struct
address_space
*
mapping
=
file
->
f_mapping
;
...
...
@@ -2397,9 +2396,9 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
pgoff_t
end
;
if
(
count
!=
ocount
)
*
nr_segs
=
iov_shorten
((
struct
iovec
*
)
iov
,
*
nr_segs
,
count
);
from
->
nr_segs
=
iov_shorten
((
struct
iovec
*
)
from
->
iov
,
from
->
nr_segs
,
count
);
write_len
=
iov_length
(
iov
,
*
nr_segs
);
write_len
=
iov_length
(
from
->
iov
,
from
->
nr_segs
);
end
=
(
pos
+
write_len
-
1
)
>>
PAGE_CACHE_SHIFT
;
written
=
filemap_write_and_wait_range
(
mapping
,
pos
,
pos
+
write_len
-
1
);
...
...
@@ -2426,7 +2425,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
}
}
written
=
mapping
->
a_ops
->
direct_IO
(
WRITE
,
iocb
,
iov
,
pos
,
*
nr_segs
);
written
=
mapping
->
a_ops
->
direct_IO
(
WRITE
,
iocb
,
from
->
iov
,
pos
,
from
->
nr_segs
);
/*
* Finally, try again to invalidate clean pages which might have been
...
...
@@ -2443,6 +2442,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
if
(
written
>
0
)
{
pos
+=
written
;
iov_iter_advance
(
from
,
written
);
if
(
pos
>
i_size_read
(
inode
)
&&
!
S_ISBLK
(
inode
->
i_mode
))
{
i_size_write
(
inode
,
pos
);
mark_inode_dirty
(
inode
);
...
...
@@ -2645,11 +2645,10 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
if
(
unlikely
(
file
->
f_flags
&
O_DIRECT
))
{
loff_t
endbyte
;
written
=
generic_file_direct_write
(
iocb
,
iov
,
&
from
.
nr_segs
,
pos
,
written
=
generic_file_direct_write
(
iocb
,
&
from
,
pos
,
count
,
ocount
);
if
(
written
<
0
||
written
==
count
)
goto
out
;
iov_iter_advance
(
&
from
,
written
);
/*
* direct-io write to a hole: fall through to buffered I/O
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录