Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
24c5684b
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
24c5684b
编写于
10月 17, 2006
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Clean up xs_send_pages()
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
bee57c99
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
75 deletion
+65
-75
net/sunrpc/xprtsock.c
net/sunrpc/xprtsock.c
+65
-75
未找到文件。
net/sunrpc/xprtsock.c
浏览文件 @
24c5684b
...
...
@@ -168,37 +168,52 @@ static void xs_free_peer_addresses(struct rpc_xprt *xprt)
#define XS_SENDMSG_FLAGS (MSG_DONTWAIT | MSG_NOSIGNAL)
static
in
line
int
xs_send_head
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
addrlen
,
struct
xdr_buf
*
xdr
,
unsigned
int
base
,
unsigned
int
len
)
static
in
t
xs_send_kvec
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
addrlen
,
struct
kvec
*
vec
,
unsigned
int
base
,
int
more
)
{
struct
kvec
iov
=
{
.
iov_base
=
xdr
->
head
[
0
].
iov_base
+
base
,
.
iov_len
=
len
-
base
,
};
struct
msghdr
msg
=
{
.
msg_name
=
addr
,
.
msg_namelen
=
addrlen
,
.
msg_flags
=
XS_SENDMSG_FLAGS
,
.
msg_flags
=
XS_SENDMSG_FLAGS
|
(
more
?
MSG_MORE
:
0
),
};
struct
kvec
iov
=
{
.
iov_base
=
vec
->
iov_base
+
base
,
.
iov_len
=
vec
->
iov_len
-
base
,
};
if
(
xdr
->
len
>
len
)
msg
.
msg_flags
|=
MSG_MORE
;
if
(
likely
(
iov
.
iov_len
))
if
(
iov
.
iov_len
!=
0
)
return
kernel_sendmsg
(
sock
,
&
msg
,
&
iov
,
1
,
iov
.
iov_len
);
return
kernel_sendmsg
(
sock
,
&
msg
,
NULL
,
0
,
0
);
}
static
int
xs_send_
tail
(
struct
socket
*
sock
,
struct
xdr_buf
*
xdr
,
unsigned
int
base
,
unsigned
int
len
)
static
int
xs_send_
pagedata
(
struct
socket
*
sock
,
struct
xdr_buf
*
xdr
,
unsigned
int
base
,
int
more
)
{
struct
kvec
iov
=
{
.
iov_base
=
xdr
->
tail
[
0
].
iov_base
+
base
,
.
iov_len
=
len
-
base
,
};
struct
msghdr
msg
=
{
.
msg_flags
=
XS_SENDMSG_FLAGS
,
};
struct
page
**
ppage
;
unsigned
int
remainder
;
int
err
,
sent
=
0
;
remainder
=
xdr
->
page_len
-
base
;
base
+=
xdr
->
page_base
;
ppage
=
xdr
->
pages
+
(
base
>>
PAGE_SHIFT
);
base
&=
~
PAGE_MASK
;
for
(;;)
{
unsigned
int
len
=
min_t
(
unsigned
int
,
PAGE_SIZE
-
base
,
remainder
);
int
flags
=
XS_SENDMSG_FLAGS
;
return
kernel_sendmsg
(
sock
,
&
msg
,
&
iov
,
1
,
iov
.
iov_len
);
remainder
-=
len
;
if
(
remainder
!=
0
||
more
)
flags
|=
MSG_MORE
;
err
=
sock
->
ops
->
sendpage
(
sock
,
*
ppage
,
base
,
len
,
flags
);
if
(
remainder
==
0
||
err
!=
len
)
break
;
sent
+=
err
;
ppage
++
;
base
=
0
;
}
if
(
sent
==
0
)
return
err
;
if
(
err
>
0
)
sent
+=
err
;
return
sent
;
}
/**
...
...
@@ -210,76 +225,51 @@ static int xs_send_tail(struct socket *sock, struct xdr_buf *xdr, unsigned int b
* @base: starting position in the buffer
*
*/
static
in
line
in
t
xs_sendpages
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
addrlen
,
struct
xdr_buf
*
xdr
,
unsigned
int
base
)
static
int
xs_sendpages
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
addrlen
,
struct
xdr_buf
*
xdr
,
unsigned
int
base
)
{
struct
page
**
ppage
=
xdr
->
pages
;
unsigned
int
len
,
pglen
=
xdr
->
page_len
;
int
err
,
ret
=
0
;
unsigned
int
remainder
=
xdr
->
len
-
base
;
int
err
,
sent
=
0
;
if
(
unlikely
(
!
sock
))
return
-
ENOTCONN
;
clear_bit
(
SOCK_ASYNC_NOSPACE
,
&
sock
->
flags
);
if
(
base
!=
0
)
{
addr
=
NULL
;
addrlen
=
0
;
}
len
=
xdr
->
head
[
0
].
iov_len
;
if
(
base
<
len
||
(
addr
!=
NULL
&&
base
==
0
))
{
err
=
xs_send_head
(
sock
,
addr
,
addrlen
,
xdr
,
base
,
len
);
if
(
ret
==
0
)
ret
=
err
;
else
if
(
err
>
0
)
ret
+=
err
;
if
(
err
!=
(
len
-
base
))
if
(
base
<
xdr
->
head
[
0
].
iov_len
||
addr
!=
NULL
)
{
unsigned
int
len
=
xdr
->
head
[
0
].
iov_len
-
base
;
remainder
-=
len
;
err
=
xs_send_kvec
(
sock
,
addr
,
addrlen
,
&
xdr
->
head
[
0
],
base
,
remainder
!=
0
);
if
(
remainder
==
0
||
err
!=
len
)
goto
out
;
sent
+=
err
;
base
=
0
;
}
else
base
-=
len
;
if
(
unlikely
(
pglen
==
0
))
goto
copy_tail
;
if
(
unlikely
(
base
>=
pglen
))
{
base
-=
pglen
;
goto
copy_tail
;
}
if
(
base
||
xdr
->
page_base
)
{
pglen
-=
base
;
base
+=
xdr
->
page_base
;
ppage
+=
base
>>
PAGE_CACHE_SHIFT
;
base
&=
~
PAGE_CACHE_MASK
;
}
do
{
int
flags
=
XS_SENDMSG_FLAGS
;
base
-=
xdr
->
head
[
0
].
iov_len
;
len
=
PAGE_CACHE_SIZE
;
if
(
base
)
len
-=
base
;
if
(
pglen
<
len
)
len
=
pglen
;
if
(
pglen
!=
len
||
xdr
->
tail
[
0
].
iov_len
!=
0
)
flags
|=
MSG_MORE
;
err
=
kernel_sendpage
(
sock
,
*
ppage
,
base
,
len
,
flags
);
if
(
ret
==
0
)
ret
=
err
;
else
if
(
err
>
0
)
ret
+=
err
;
if
(
err
!=
len
)
if
(
base
<
xdr
->
page_len
)
{
unsigned
int
len
=
xdr
->
page_len
-
base
;
remainder
-=
len
;
err
=
xs_send_pagedata
(
sock
,
xdr
,
base
,
remainder
!=
0
);
if
(
remainder
==
0
||
err
!=
len
)
goto
out
;
sent
+=
err
;
base
=
0
;
ppage
++
;
}
while
((
pglen
-=
len
)
!=
0
);
copy_tail:
len
=
xdr
->
tail
[
0
].
iov_len
;
if
(
base
<
len
)
{
err
=
xs_send_tail
(
sock
,
xdr
,
base
,
len
);
if
(
ret
==
0
)
ret
=
err
;
else
if
(
err
>
0
)
ret
+=
err
;
}
}
else
base
-=
xdr
->
page_len
;
if
(
base
>=
xdr
->
tail
[
0
].
iov_len
)
return
sent
;
err
=
xs_send_kvec
(
sock
,
NULL
,
0
,
&
xdr
->
tail
[
0
],
base
,
0
);
out:
return
ret
;
if
(
sent
==
0
)
return
err
;
if
(
err
>
0
)
sent
+=
err
;
return
sent
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录