Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
fbca779a
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看板
提交
fbca779a
编写于
4月 16, 2010
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Reduce the stack footprint of nfs_create_server
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
a4d7f168
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
12 deletion
+39
-12
fs/nfs/client.c
fs/nfs/client.c
+39
-12
未找到文件。
fs/nfs/client.c
浏览文件 @
fbca779a
...
@@ -934,7 +934,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
...
@@ -934,7 +934,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
}
}
fsinfo
.
fattr
=
fattr
;
fsinfo
.
fattr
=
fattr
;
nfs_fattr_init
(
fattr
);
error
=
clp
->
rpc_ops
->
fsinfo
(
server
,
mntfh
,
&
fsinfo
);
error
=
clp
->
rpc_ops
->
fsinfo
(
server
,
mntfh
,
&
fsinfo
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
out_error
;
goto
out_error
;
...
@@ -1047,13 +1046,18 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1047,13 +1046,18 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
struct
nfs_fh
*
mntfh
)
struct
nfs_fh
*
mntfh
)
{
{
struct
nfs_server
*
server
;
struct
nfs_server
*
server
;
struct
nfs_fattr
fattr
;
struct
nfs_fattr
*
fattr
;
int
error
;
int
error
;
server
=
nfs_alloc_server
();
server
=
nfs_alloc_server
();
if
(
!
server
)
if
(
!
server
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
-
ENOMEM
;
fattr
=
nfs_alloc_fattr
();
if
(
fattr
==
NULL
)
goto
error
;
/* Get a client representation */
/* Get a client representation */
error
=
nfs_init_server
(
server
,
data
);
error
=
nfs_init_server
(
server
,
data
);
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -1064,7 +1068,7 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1064,7 +1068,7 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
BUG_ON
(
!
server
->
nfs_client
->
rpc_ops
->
file_inode_ops
);
BUG_ON
(
!
server
->
nfs_client
->
rpc_ops
->
file_inode_ops
);
/* Probe the root fh to retrieve its FSID */
/* Probe the root fh to retrieve its FSID */
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
&
fattr
);
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
fattr
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
error
;
goto
error
;
if
(
server
->
nfs_client
->
rpc_ops
->
version
==
3
)
{
if
(
server
->
nfs_client
->
rpc_ops
->
version
==
3
)
{
...
@@ -1077,14 +1081,14 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1077,14 +1081,14 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
server
->
namelen
=
NFS2_MAXNAMLEN
;
server
->
namelen
=
NFS2_MAXNAMLEN
;
}
}
if
(
!
(
fattr
.
valid
&
NFS_ATTR_FATTR
))
{
if
(
!
(
fattr
->
valid
&
NFS_ATTR_FATTR
))
{
error
=
server
->
nfs_client
->
rpc_ops
->
getattr
(
server
,
mntfh
,
&
fattr
);
error
=
server
->
nfs_client
->
rpc_ops
->
getattr
(
server
,
mntfh
,
fattr
);
if
(
error
<
0
)
{
if
(
error
<
0
)
{
dprintk
(
"nfs_create_server: getattr error = %d
\n
"
,
-
error
);
dprintk
(
"nfs_create_server: getattr error = %d
\n
"
,
-
error
);
goto
error
;
goto
error
;
}
}
}
}
memcpy
(
&
server
->
fsid
,
&
fattr
.
fsid
,
sizeof
(
server
->
fsid
));
memcpy
(
&
server
->
fsid
,
&
fattr
->
fsid
,
sizeof
(
server
->
fsid
));
dprintk
(
"Server FSID: %llx:%llx
\n
"
,
dprintk
(
"Server FSID: %llx:%llx
\n
"
,
(
unsigned
long
long
)
server
->
fsid
.
major
,
(
unsigned
long
long
)
server
->
fsid
.
major
,
...
@@ -1096,9 +1100,11 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1096,9 +1100,11 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
spin_unlock
(
&
nfs_client_lock
);
spin_unlock
(
&
nfs_client_lock
);
server
->
mount_time
=
jiffies
;
server
->
mount_time
=
jiffies
;
nfs_free_fattr
(
fattr
);
return
server
;
return
server
;
error:
error:
nfs_free_fattr
(
fattr
);
nfs_free_server
(
server
);
nfs_free_server
(
server
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
}
}
...
@@ -1340,7 +1346,7 @@ static int nfs4_init_server(struct nfs_server *server,
...
@@ -1340,7 +1346,7 @@ static int nfs4_init_server(struct nfs_server *server,
struct
nfs_server
*
nfs4_create_server
(
const
struct
nfs_parsed_mount_data
*
data
,
struct
nfs_server
*
nfs4_create_server
(
const
struct
nfs_parsed_mount_data
*
data
,
struct
nfs_fh
*
mntfh
)
struct
nfs_fh
*
mntfh
)
{
{
struct
nfs_fattr
fattr
;
struct
nfs_fattr
*
fattr
;
struct
nfs_server
*
server
;
struct
nfs_server
*
server
;
int
error
;
int
error
;
...
@@ -1350,6 +1356,11 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1350,6 +1356,11 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
if
(
!
server
)
if
(
!
server
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
-
ENOMEM
;
fattr
=
nfs_alloc_fattr
();
if
(
fattr
==
NULL
)
goto
error
;
/* set up the general RPC client */
/* set up the general RPC client */
error
=
nfs4_init_server
(
server
,
data
);
error
=
nfs4_init_server
(
server
,
data
);
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -1375,7 +1386,7 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1375,7 +1386,7 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
nfs4_session_set_rwsize
(
server
);
nfs4_session_set_rwsize
(
server
);
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
&
fattr
);
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
fattr
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
error
;
goto
error
;
...
@@ -1389,9 +1400,11 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
...
@@ -1389,9 +1400,11 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
server
->
mount_time
=
jiffies
;
server
->
mount_time
=
jiffies
;
dprintk
(
"<-- nfs4_create_server() = %p
\n
"
,
server
);
dprintk
(
"<-- nfs4_create_server() = %p
\n
"
,
server
);
nfs_free_fattr
(
fattr
);
return
server
;
return
server
;
error:
error:
nfs_free_fattr
(
fattr
);
nfs_free_server
(
server
);
nfs_free_server
(
server
);
dprintk
(
"<-- nfs4_create_server() = error %d
\n
"
,
error
);
dprintk
(
"<-- nfs4_create_server() = error %d
\n
"
,
error
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
...
@@ -1405,7 +1418,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
...
@@ -1405,7 +1418,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
{
{
struct
nfs_client
*
parent_client
;
struct
nfs_client
*
parent_client
;
struct
nfs_server
*
server
,
*
parent_server
;
struct
nfs_server
*
server
,
*
parent_server
;
struct
nfs_fattr
fattr
;
struct
nfs_fattr
*
fattr
;
int
error
;
int
error
;
dprintk
(
"--> nfs4_create_referral_server()
\n
"
);
dprintk
(
"--> nfs4_create_referral_server()
\n
"
);
...
@@ -1414,6 +1427,11 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
...
@@ -1414,6 +1427,11 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
if
(
!
server
)
if
(
!
server
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
-
ENOMEM
;
fattr
=
nfs_alloc_fattr
();
if
(
fattr
==
NULL
)
goto
error
;
parent_server
=
NFS_SB
(
data
->
sb
);
parent_server
=
NFS_SB
(
data
->
sb
);
parent_client
=
parent_server
->
nfs_client
;
parent_client
=
parent_server
->
nfs_client
;
...
@@ -1448,7 +1466,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
...
@@ -1448,7 +1466,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
goto
error
;
goto
error
;
/* probe the filesystem info for this server filesystem */
/* probe the filesystem info for this server filesystem */
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
&
fattr
);
error
=
nfs_probe_fsinfo
(
server
,
mntfh
,
fattr
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
error
;
goto
error
;
...
@@ -1466,10 +1484,12 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
...
@@ -1466,10 +1484,12 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
server
->
mount_time
=
jiffies
;
server
->
mount_time
=
jiffies
;
nfs_free_fattr
(
fattr
);
dprintk
(
"<-- nfs_create_referral_server() = %p
\n
"
,
server
);
dprintk
(
"<-- nfs_create_referral_server() = %p
\n
"
,
server
);
return
server
;
return
server
;
error:
error:
nfs_free_fattr
(
fattr
);
nfs_free_server
(
server
);
nfs_free_server
(
server
);
dprintk
(
"<-- nfs4_create_referral_server() = error %d
\n
"
,
error
);
dprintk
(
"<-- nfs4_create_referral_server() = error %d
\n
"
,
error
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
...
@@ -1485,7 +1505,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
...
@@ -1485,7 +1505,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
struct
nfs_fattr
*
fattr
)
struct
nfs_fattr
*
fattr
)
{
{
struct
nfs_server
*
server
;
struct
nfs_server
*
server
;
struct
nfs_fattr
fattr_fsinfo
;
struct
nfs_fattr
*
fattr_fsinfo
;
int
error
;
int
error
;
dprintk
(
"--> nfs_clone_server(,%llx:%llx,)
\n
"
,
dprintk
(
"--> nfs_clone_server(,%llx:%llx,)
\n
"
,
...
@@ -1496,6 +1516,11 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
...
@@ -1496,6 +1516,11 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
if
(
!
server
)
if
(
!
server
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
-
ENOMEM
;
fattr_fsinfo
=
nfs_alloc_fattr
();
if
(
fattr_fsinfo
==
NULL
)
goto
out_free_server
;
/* Copy data from the source */
/* Copy data from the source */
server
->
nfs_client
=
source
->
nfs_client
;
server
->
nfs_client
=
source
->
nfs_client
;
atomic_inc
(
&
server
->
nfs_client
->
cl_count
);
atomic_inc
(
&
server
->
nfs_client
->
cl_count
);
...
@@ -1512,7 +1537,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
...
@@ -1512,7 +1537,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
nfs_init_server_aclclient
(
server
);
nfs_init_server_aclclient
(
server
);
/* probe the filesystem info for this server filesystem */
/* probe the filesystem info for this server filesystem */
error
=
nfs_probe_fsinfo
(
server
,
fh
,
&
fattr_fsinfo
);
error
=
nfs_probe_fsinfo
(
server
,
fh
,
fattr_fsinfo
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
out_free_server
;
goto
out_free_server
;
...
@@ -1534,10 +1559,12 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
...
@@ -1534,10 +1559,12 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
server
->
mount_time
=
jiffies
;
server
->
mount_time
=
jiffies
;
nfs_free_fattr
(
fattr_fsinfo
);
dprintk
(
"<-- nfs_clone_server() = %p
\n
"
,
server
);
dprintk
(
"<-- nfs_clone_server() = %p
\n
"
,
server
);
return
server
;
return
server
;
out_free_server:
out_free_server:
nfs_free_fattr
(
fattr_fsinfo
);
nfs_free_server
(
server
);
nfs_free_server
(
server
);
dprintk
(
"<-- nfs_clone_server() = error %d
\n
"
,
error
);
dprintk
(
"<-- nfs_clone_server() = error %d
\n
"
,
error
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录