Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
21de0a95
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,发现更多精彩内容 >>
提交
21de0a95
编写于
7月 17, 2011
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Clean up the slot table allocation
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
8d9266ff
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
29 deletion
+37
-29
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprt.h
+0
-2
net/sunrpc/xprt.c
net/sunrpc/xprt.c
+37
-27
未找到文件。
include/linux/sunrpc/xprt.h
浏览文件 @
21de0a95
...
...
@@ -168,7 +168,6 @@ struct rpc_xprt {
struct
rpc_wait_queue
pending
;
/* requests in flight */
struct
rpc_wait_queue
backlog
;
/* waiting for slot */
struct
list_head
free
;
/* free slots */
struct
rpc_rqst
*
slot
;
/* slot table storage */
unsigned
int
max_reqs
;
/* total slots */
unsigned
long
state
;
/* transport state */
unsigned
char
shutdown
:
1
,
/* being shut down */
...
...
@@ -321,7 +320,6 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
#define XPRT_CLOSING (6)
#define XPRT_CONNECTION_ABORT (7)
#define XPRT_CONNECTION_CLOSE (8)
#define XPRT_INITIALIZED (9)
static
inline
void
xprt_set_connected
(
struct
rpc_xprt
*
xprt
)
{
...
...
net/sunrpc/xprt.c
浏览文件 @
21de0a95
...
...
@@ -62,6 +62,7 @@
/*
* Local functions
*/
static
void
xprt_init
(
struct
rpc_xprt
*
xprt
,
struct
net
*
net
);
static
void
xprt_request_init
(
struct
rpc_task
*
,
struct
rpc_xprt
*
);
static
void
xprt_connect_status
(
struct
rpc_task
*
task
);
static
int
__xprt_get_cong
(
struct
rpc_xprt
*
,
struct
rpc_task
*
);
...
...
@@ -961,25 +962,42 @@ static void xprt_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *req)
spin_unlock
(
&
xprt
->
reserve_lock
);
}
struct
rpc_xprt
*
xprt_alloc
(
struct
net
*
net
,
int
size
,
int
max_req
)
static
void
xprt_free_all_slots
(
struct
rpc_xprt
*
xprt
)
{
struct
rpc_rqst
*
req
;
while
(
!
list_empty
(
&
xprt
->
free
))
{
req
=
list_first_entry
(
&
xprt
->
free
,
struct
rpc_rqst
,
rq_list
);
list_del
(
&
req
->
rq_list
);
kfree
(
req
);
}
}
struct
rpc_xprt
*
xprt_alloc
(
struct
net
*
net
,
int
size
,
int
num_prealloc
)
{
struct
rpc_xprt
*
xprt
;
struct
rpc_rqst
*
req
;
int
i
;
xprt
=
kzalloc
(
size
,
GFP_KERNEL
);
if
(
xprt
==
NULL
)
goto
out
;
atomic_set
(
&
xprt
->
count
,
1
);
xprt
->
max_reqs
=
max_req
;
xprt
->
slot
=
kcalloc
(
max_req
,
sizeof
(
struct
rpc_rqst
),
GFP_KERNEL
);
if
(
xprt
->
slot
==
NULL
)
xprt_init
(
xprt
,
net
);
for
(
i
=
0
;
i
<
num_prealloc
;
i
++
)
{
req
=
kzalloc
(
sizeof
(
struct
rpc_rqst
),
GFP_KERNEL
);
if
(
!
req
)
break
;
list_add
(
&
req
->
rq_list
,
&
xprt
->
free
);
}
if
(
i
<
num_prealloc
)
goto
out_free
;
xprt
->
max_reqs
=
num_prealloc
;
xprt
->
xprt_net
=
get_net
(
net
);
return
xprt
;
out_free:
k
free
(
xprt
);
xprt_
free
(
xprt
);
out:
return
NULL
;
}
...
...
@@ -988,7 +1006,7 @@ EXPORT_SYMBOL_GPL(xprt_alloc);
void
xprt_free
(
struct
rpc_xprt
*
xprt
)
{
put_net
(
xprt
->
xprt_net
);
kfree
(
xprt
->
slo
t
);
xprt_free_all_slots
(
xpr
t
);
kfree
(
xprt
);
}
EXPORT_SYMBOL_GPL
(
xprt_free
);
...
...
@@ -1091,9 +1109,9 @@ void xprt_release(struct rpc_task *task)
xprt_free_bc_request
(
req
);
}
static
void
xprt_init
(
struct
rpc_xprt
*
xprt
)
static
void
xprt_init
(
struct
rpc_xprt
*
xprt
,
struct
net
*
net
)
{
struct
rpc_rqst
*
req
;
atomic_set
(
&
xprt
->
count
,
1
)
;
spin_lock_init
(
&
xprt
->
transport_lock
);
spin_lock_init
(
&
xprt
->
reserve_lock
);
...
...
@@ -1105,12 +1123,6 @@ static void xprt_init(struct rpc_xprt *xprt)
INIT_LIST_HEAD
(
&
xprt
->
bc_pa_list
);
#endif
/* CONFIG_SUNRPC_BACKCHANNEL */
INIT_WORK
(
&
xprt
->
task_cleanup
,
xprt_autoclose
);
if
(
xprt_has_timer
(
xprt
))
setup_timer
(
&
xprt
->
timer
,
xprt_init_autodisconnect
,
(
unsigned
long
)
xprt
);
else
init_timer
(
&
xprt
->
timer
);
xprt
->
last_used
=
jiffies
;
xprt
->
cwnd
=
RPC_INITCWND
;
xprt
->
bind_index
=
0
;
...
...
@@ -1121,12 +1133,9 @@ static void xprt_init(struct rpc_xprt *xprt)
rpc_init_wait_queue
(
&
xprt
->
resend
,
"xprt_resend"
);
rpc_init_priority_wait_queue
(
&
xprt
->
backlog
,
"xprt_backlog"
);
/* initialize free list */
for
(
req
=
&
xprt
->
slot
[
xprt
->
max_reqs
-
1
];
req
>=
&
xprt
->
slot
[
0
];
req
--
)
list_add
(
&
req
->
rq_list
,
&
xprt
->
free
);
xprt_init_xid
(
xprt
);
xprt
->
xprt_net
=
get_net
(
net
);
}
/**
...
...
@@ -1155,16 +1164,17 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
if
(
IS_ERR
(
xprt
))
{
dprintk
(
"RPC: xprt_create_transport: failed, %ld
\n
"
,
-
PTR_ERR
(
xprt
));
return
xpr
t
;
goto
ou
t
;
}
if
(
test_and_set_bit
(
XPRT_INITIALIZED
,
&
xprt
->
state
))
/* ->setup returned a pre-initialized xprt: */
return
xprt
;
xprt_init
(
xprt
);
INIT_WORK
(
&
xprt
->
task_cleanup
,
xprt_autoclose
);
if
(
xprt_has_timer
(
xprt
))
setup_timer
(
&
xprt
->
timer
,
xprt_init_autodisconnect
,
(
unsigned
long
)
xprt
);
else
init_timer
(
&
xprt
->
timer
);
dprintk
(
"RPC: created transport %p with %u slots
\n
"
,
xprt
,
xprt
->
max_reqs
);
out:
return
xprt
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录