Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
c711a6b1
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
c711a6b1
编写于
4月 01, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
9p: fold v9fs_file_write_internal() into the caller
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
371098c6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
49 deletion
+30
-49
fs/9p/v9fs_vfs.h
fs/9p/v9fs_vfs.h
+0
-2
fs/9p/vfs_file.c
fs/9p/vfs_file.c
+30
-47
未找到文件。
fs/9p/v9fs_vfs.h
浏览文件 @
c711a6b1
...
...
@@ -74,8 +74,6 @@ void v9fs_blank_wstat(struct p9_wstat *wstat);
int
v9fs_vfs_setattr_dotl
(
struct
dentry
*
,
struct
iattr
*
);
int
v9fs_file_fsync_dotl
(
struct
file
*
filp
,
loff_t
start
,
loff_t
end
,
int
datasync
);
ssize_t
v9fs_file_write_internal
(
struct
inode
*
,
struct
p9_fid
*
,
const
char
__user
*
,
size_t
,
loff_t
*
,
int
);
int
v9fs_refresh_inode
(
struct
p9_fid
*
fid
,
struct
inode
*
inode
);
int
v9fs_refresh_inode_dotl
(
struct
p9_fid
*
fid
,
struct
inode
*
inode
);
static
inline
void
v9fs_invalidate_inode_attr
(
struct
inode
*
inode
)
...
...
fs/9p/vfs_file.c
浏览文件 @
c711a6b1
...
...
@@ -453,40 +453,6 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
return
ret
;
}
ssize_t
v9fs_file_write_internal
(
struct
inode
*
inode
,
struct
p9_fid
*
fid
,
const
char
__user
*
data
,
size_t
count
,
loff_t
*
offset
,
int
invalidate
)
{
loff_t
origin
=
*
offset
;
struct
iovec
iov
=
{.
iov_base
=
(
void
__user
*
)
data
,
.
iov_len
=
count
};
struct
iov_iter
from
;
int
total
,
err
=
0
;
p9_debug
(
P9_DEBUG_VFS
,
"data %p count %d offset %x
\n
"
,
data
,
(
int
)
count
,
(
int
)
*
offset
);
iov_iter_init
(
&
from
,
WRITE
,
&
iov
,
1
,
count
);
total
=
p9_client_write
(
fid
,
origin
,
&
from
,
&
err
);
if
(
invalidate
&&
(
total
>
0
))
{
loff_t
i_size
;
unsigned
long
pg_start
,
pg_end
;
pg_start
=
origin
>>
PAGE_CACHE_SHIFT
;
pg_end
=
(
origin
+
total
-
1
)
>>
PAGE_CACHE_SHIFT
;
if
(
inode
->
i_mapping
&&
inode
->
i_mapping
->
nrpages
)
invalidate_inode_pages2_range
(
inode
->
i_mapping
,
pg_start
,
pg_end
);
*
offset
+=
total
;
i_size
=
i_size_read
(
inode
);
if
(
*
offset
>
i_size
)
{
inode_add_bytes
(
inode
,
*
offset
-
i_size
);
i_size_write
(
inode
,
*
offset
);
}
}
return
total
?
total
:
err
;
}
/**
* v9fs_file_write - write to a file
* @filp: file pointer to write
...
...
@@ -501,27 +467,44 @@ v9fs_file_write(struct file *filp, const char __user * data,
{
ssize_t
retval
=
0
;
loff_t
origin
=
*
offset
;
struct
iovec
iov
=
{.
iov_base
=
(
void
__user
*
)
data
,
.
iov_len
=
count
};
struct
iov_iter
from
;
int
err
=
0
;
iov_iter_init
(
&
from
,
WRITE
,
&
iov
,
1
,
count
);
retval
=
generic_write_checks
(
filp
,
&
origin
,
&
count
,
0
);
if
(
retval
)
goto
out
;
return
retval
;
iov_iter_truncate
(
&
from
,
count
);
p9_debug
(
P9_DEBUG_VFS
,
"data %p count %d offset %x
\n
"
,
data
,
(
int
)
count
,
(
int
)
*
offset
);
retval
=
-
EINVAL
;
if
((
ssize_t
)
count
<
0
)
goto
out
;
retval
=
0
;
if
(
!
count
)
goto
out
;
return
0
;
retval
=
v9fs_file_write_internal
(
file_inode
(
filp
),
filp
->
private_data
,
data
,
count
,
&
origin
,
1
);
/* update offset on successful write */
if
(
retval
>
0
)
*
offset
=
origin
;
out:
return
retval
;
retval
=
p9_client_write
(
filp
->
private_data
,
origin
,
&
from
,
&
err
);
if
(
retval
>
0
)
{
struct
inode
*
inode
=
file_inode
(
filp
);
loff_t
i_size
;
unsigned
long
pg_start
,
pg_end
;
pg_start
=
origin
>>
PAGE_CACHE_SHIFT
;
pg_end
=
(
origin
+
retval
-
1
)
>>
PAGE_CACHE_SHIFT
;
if
(
inode
->
i_mapping
&&
inode
->
i_mapping
->
nrpages
)
invalidate_inode_pages2_range
(
inode
->
i_mapping
,
pg_start
,
pg_end
);
*
offset
+=
retval
;
i_size
=
i_size_read
(
inode
);
if
(
*
offset
>
i_size
)
{
inode_add_bytes
(
inode
,
*
offset
-
i_size
);
i_size_write
(
inode
,
*
offset
);
}
return
retval
;
}
return
err
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录