Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
09aab880
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
09aab880
编写于
11月 13, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cifs: no need to wank with copying and advancing iovec on recvmsg side either
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
3ab3f2a1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
69 deletion
+5
-69
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+0
-2
fs/cifs/connect.c
fs/cifs/connect.c
+5
-67
未找到文件。
fs/cifs/cifsglob.h
浏览文件 @
09aab880
...
...
@@ -615,8 +615,6 @@ struct TCP_Server_Info {
bool
sec_mskerberos
;
/* supports legacy MS Kerberos */
bool
large_buf
;
/* is current buffer large? */
struct
delayed_work
echo
;
/* echo ping workqueue job */
struct
kvec
*
iov
;
/* reusable kvec array for receives */
unsigned
int
nr_iov
;
/* number of kvecs in array */
char
*
smallbuf
;
/* pointer to current "small" buffer */
char
*
bigbuf
;
/* pointer to current "big" buffer */
unsigned
int
total_read
;
/* total amount of data read in this pass */
...
...
fs/cifs/connect.c
浏览文件 @
09aab880
...
...
@@ -501,77 +501,20 @@ server_unresponsive(struct TCP_Server_Info *server)
return
false
;
}
/*
* kvec_array_init - clone a kvec array, and advance into it
* @new: pointer to memory for cloned array
* @iov: pointer to original array
* @nr_segs: number of members in original array
* @bytes: number of bytes to advance into the cloned array
*
* This function will copy the array provided in iov to a section of memory
* and advance the specified number of bytes into the new array. It returns
* the number of segments in the new array. "new" must be at least as big as
* the original iov array.
*/
static
unsigned
int
kvec_array_init
(
struct
kvec
*
new
,
struct
kvec
*
iov
,
unsigned
int
nr_segs
,
size_t
bytes
)
{
size_t
base
=
0
;
while
(
bytes
||
!
iov
->
iov_len
)
{
int
copy
=
min
(
bytes
,
iov
->
iov_len
);
bytes
-=
copy
;
base
+=
copy
;
if
(
iov
->
iov_len
==
base
)
{
iov
++
;
nr_segs
--
;
base
=
0
;
}
}
memcpy
(
new
,
iov
,
sizeof
(
*
iov
)
*
nr_segs
);
new
->
iov_base
+=
base
;
new
->
iov_len
-=
base
;
return
nr_segs
;
}
static
struct
kvec
*
get_server_iovec
(
struct
TCP_Server_Info
*
server
,
unsigned
int
nr_segs
)
{
struct
kvec
*
new_iov
;
if
(
server
->
iov
&&
nr_segs
<=
server
->
nr_iov
)
return
server
->
iov
;
/* not big enough -- allocate a new one and release the old */
new_iov
=
kmalloc
(
sizeof
(
*
new_iov
)
*
nr_segs
,
GFP_NOFS
);
if
(
new_iov
)
{
kfree
(
server
->
iov
);
server
->
iov
=
new_iov
;
server
->
nr_iov
=
nr_segs
;
}
return
new_iov
;
}
int
cifs_readv_from_socket
(
struct
TCP_Server_Info
*
server
,
struct
kvec
*
iov_orig
,
unsigned
int
nr_segs
,
unsigned
int
to_read
)
{
int
length
=
0
;
int
total_read
;
unsigned
int
segs
;
struct
msghdr
smb_msg
;
struct
kvec
*
iov
;
iov
=
get_server_iovec
(
server
,
nr_segs
);
if
(
!
iov
)
return
-
ENOMEM
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_controllen
=
0
;
iov_iter_kvec
(
&
smb_msg
.
msg_iter
,
READ
|
ITER_KVEC
,
iov_orig
,
nr_segs
,
to_read
);
for
(
total_read
=
0
;
to_read
;
total_read
+=
length
,
to_read
-
=
length
)
{
for
(
total_read
=
0
;
msg_data_left
(
&
smb_msg
);
total_read
+
=
length
)
{
try_to_freeze
();
if
(
server_unresponsive
(
server
))
{
...
...
@@ -579,10 +522,7 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig,
break
;
}
segs
=
kvec_array_init
(
iov
,
iov_orig
,
nr_segs
,
total_read
);
length
=
kernel_recvmsg
(
server
->
ssocket
,
&
smb_msg
,
iov
,
segs
,
to_read
,
0
);
length
=
sock_recvmsg
(
server
->
ssocket
,
&
smb_msg
,
0
);
if
(
server
->
tcpStatus
==
CifsExiting
)
{
total_read
=
-
ESHUTDOWN
;
...
...
@@ -603,8 +543,7 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig,
length
=
0
;
continue
;
}
else
if
(
length
<=
0
)
{
cifs_dbg
(
FYI
,
"Received no data or error: expecting %d
\n
"
"got %d"
,
to_read
,
length
);
cifs_dbg
(
FYI
,
"Received no data or error: %d
\n
"
,
length
);
cifs_reconnect
(
server
);
total_read
=
-
ECONNABORTED
;
break
;
...
...
@@ -783,7 +722,6 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
}
kfree
(
server
->
hostname
);
kfree
(
server
->
iov
);
kfree
(
server
);
length
=
atomic_dec_return
(
&
tcpSesAllocCount
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录