Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
57dc9a57
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
57dc9a57
编写于
6月 20, 2008
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Reduce the stack usage in NFSv4 create operations
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
f57e9168
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
97 addition
and
107 deletion
+97
-107
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+97
-107
未找到文件。
fs/nfs/nfs4proc.c
浏览文件 @
57dc9a57
...
...
@@ -2079,47 +2079,81 @@ static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *n
return
err
;
}
struct
nfs4_createdata
{
struct
rpc_message
msg
;
struct
nfs4_create_arg
arg
;
struct
nfs4_create_res
res
;
struct
nfs_fh
fh
;
struct
nfs_fattr
fattr
;
struct
nfs_fattr
dir_fattr
;
};
static
struct
nfs4_createdata
*
nfs4_alloc_createdata
(
struct
inode
*
dir
,
struct
qstr
*
name
,
struct
iattr
*
sattr
,
u32
ftype
)
{
struct
nfs4_createdata
*
data
;
data
=
kzalloc
(
sizeof
(
*
data
),
GFP_KERNEL
);
if
(
data
!=
NULL
)
{
struct
nfs_server
*
server
=
NFS_SERVER
(
dir
);
data
->
msg
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_CREATE
];
data
->
msg
.
rpc_argp
=
&
data
->
arg
;
data
->
msg
.
rpc_resp
=
&
data
->
res
;
data
->
arg
.
dir_fh
=
NFS_FH
(
dir
);
data
->
arg
.
server
=
server
;
data
->
arg
.
name
=
name
;
data
->
arg
.
attrs
=
sattr
;
data
->
arg
.
ftype
=
ftype
;
data
->
arg
.
bitmask
=
server
->
attr_bitmask
;
data
->
res
.
server
=
server
;
data
->
res
.
fh
=
&
data
->
fh
;
data
->
res
.
fattr
=
&
data
->
fattr
;
data
->
res
.
dir_fattr
=
&
data
->
dir_fattr
;
nfs_fattr_init
(
data
->
res
.
fattr
);
nfs_fattr_init
(
data
->
res
.
dir_fattr
);
}
return
data
;
}
static
int
nfs4_do_create
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
nfs4_createdata
*
data
)
{
int
status
=
rpc_call_sync
(
NFS_CLIENT
(
dir
),
&
data
->
msg
,
0
);
if
(
status
==
0
)
{
update_changeattr
(
dir
,
&
data
->
res
.
dir_cinfo
);
nfs_post_op_update_inode
(
dir
,
data
->
res
.
dir_fattr
);
status
=
nfs_instantiate
(
dentry
,
data
->
res
.
fh
,
data
->
res
.
fattr
);
}
return
status
;
}
static
void
nfs4_free_createdata
(
struct
nfs4_createdata
*
data
)
{
kfree
(
data
);
}
static
int
_nfs4_proc_symlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
page
*
page
,
unsigned
int
len
,
struct
iattr
*
sattr
)
{
struct
nfs_server
*
server
=
NFS_SERVER
(
dir
);
struct
nfs_fh
fhandle
;
struct
nfs_fattr
fattr
,
dir_fattr
;
struct
nfs4_create_arg
arg
=
{
.
dir_fh
=
NFS_FH
(
dir
),
.
server
=
server
,
.
name
=
&
dentry
->
d_name
,
.
attrs
=
sattr
,
.
ftype
=
NF4LNK
,
.
bitmask
=
server
->
attr_bitmask
,
};
struct
nfs4_create_res
res
=
{
.
server
=
server
,
.
fh
=
&
fhandle
,
.
fattr
=
&
fattr
,
.
dir_fattr
=
&
dir_fattr
,
};
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_SYMLINK
],
.
rpc_argp
=
&
arg
,
.
rpc_resp
=
&
res
,
};
int
status
;
struct
nfs4_createdata
*
data
;
int
status
=
-
ENAMETOOLONG
;
if
(
len
>
NFS4_MAXPATHLEN
)
return
-
ENAMETOOLONG
;
goto
out
;
arg
.
u
.
symlink
.
pages
=
&
page
;
arg
.
u
.
symlink
.
len
=
len
;
nfs_fattr_init
(
&
fattr
);
nfs_fattr_init
(
&
dir_fattr
);
status
=
-
ENOMEM
;
data
=
nfs4_alloc_createdata
(
dir
,
&
dentry
->
d_name
,
sattr
,
NF4LNK
);
if
(
data
==
NULL
)
goto
out
;
data
->
msg
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_SYMLINK
];
data
->
arg
.
u
.
symlink
.
pages
=
&
page
;
data
->
arg
.
u
.
symlink
.
len
=
len
;
status
=
rpc_call_sync
(
NFS_CLIENT
(
dir
),
&
msg
,
0
);
if
(
!
status
)
{
update_changeattr
(
dir
,
&
res
.
dir_cinfo
);
nfs_post_op_update_inode
(
dir
,
res
.
dir_fattr
);
status
=
nfs_instantiate
(
dentry
,
&
fhandle
,
&
fattr
);
}
status
=
nfs4_do_create
(
dir
,
dentry
,
data
);
nfs4_free_createdata
(
data
);
out:
return
status
;
}
...
...
@@ -2140,39 +2174,17 @@ static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry,
static
int
_nfs4_proc_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
iattr
*
sattr
)
{
struct
nfs_server
*
server
=
NFS_SERVER
(
dir
);
struct
nfs_fh
fhandle
;
struct
nfs_fattr
fattr
,
dir_fattr
;
struct
nfs4_create_arg
arg
=
{
.
dir_fh
=
NFS_FH
(
dir
),
.
server
=
server
,
.
name
=
&
dentry
->
d_name
,
.
attrs
=
sattr
,
.
ftype
=
NF4DIR
,
.
bitmask
=
server
->
attr_bitmask
,
};
struct
nfs4_create_res
res
=
{
.
server
=
server
,
.
fh
=
&
fhandle
,
.
fattr
=
&
fattr
,
.
dir_fattr
=
&
dir_fattr
,
};
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_CREATE
],
.
rpc_argp
=
&
arg
,
.
rpc_resp
=
&
res
,
};
int
status
;
struct
nfs4_createdata
*
data
;
int
status
=
-
ENOMEM
;
nfs_fattr_init
(
&
fattr
);
nfs_fattr_init
(
&
dir_fattr
);
status
=
rpc_call_sync
(
NFS_CLIENT
(
dir
),
&
msg
,
0
);
if
(
!
status
)
{
update_changeattr
(
dir
,
&
res
.
dir_cinfo
);
nfs_post_op_update_inode
(
dir
,
res
.
dir_fattr
);
status
=
nfs_instantiate
(
dentry
,
&
fhandle
,
&
fattr
);
}
data
=
nfs4_alloc_createdata
(
dir
,
&
dentry
->
d_name
,
sattr
,
NF4DIR
);
if
(
data
==
NULL
)
goto
out
;
status
=
nfs4_do_create
(
dir
,
dentry
,
data
);
nfs4_free_createdata
(
data
);
out:
return
status
;
}
...
...
@@ -2242,56 +2254,34 @@ static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
static
int
_nfs4_proc_mknod
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
iattr
*
sattr
,
dev_t
rdev
)
{
struct
nfs_server
*
server
=
NFS_SERVER
(
dir
);
struct
nfs_fh
fh
;
struct
nfs_fattr
fattr
,
dir_fattr
;
struct
nfs4_create_arg
arg
=
{
.
dir_fh
=
NFS_FH
(
dir
),
.
server
=
server
,
.
name
=
&
dentry
->
d_name
,
.
attrs
=
sattr
,
.
bitmask
=
server
->
attr_bitmask
,
};
struct
nfs4_create_res
res
=
{
.
server
=
server
,
.
fh
=
&
fh
,
.
fattr
=
&
fattr
,
.
dir_fattr
=
&
dir_fattr
,
};
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_CREATE
],
.
rpc_argp
=
&
arg
,
.
rpc_resp
=
&
res
,
};
int
status
;
int
mode
=
sattr
->
ia_mode
;
nfs_fattr_init
(
&
fattr
);
nfs_fattr_init
(
&
dir_fattr
);
struct
nfs4_createdata
*
data
;
int
mode
=
sattr
->
ia_mode
;
int
status
=
-
ENOMEM
;
BUG_ON
(
!
(
sattr
->
ia_valid
&
ATTR_MODE
));
BUG_ON
(
!
S_ISFIFO
(
mode
)
&&
!
S_ISBLK
(
mode
)
&&
!
S_ISCHR
(
mode
)
&&
!
S_ISSOCK
(
mode
));
data
=
nfs4_alloc_createdata
(
dir
,
&
dentry
->
d_name
,
sattr
,
NF4SOCK
);
if
(
data
==
NULL
)
goto
out
;
if
(
S_ISFIFO
(
mode
))
arg
.
ftype
=
NF4FIFO
;
data
->
arg
.
ftype
=
NF4FIFO
;
else
if
(
S_ISBLK
(
mode
))
{
arg
.
ftype
=
NF4BLK
;
arg
.
u
.
device
.
specdata1
=
MAJOR
(
rdev
);
arg
.
u
.
device
.
specdata2
=
MINOR
(
rdev
);
data
->
arg
.
ftype
=
NF4BLK
;
data
->
arg
.
u
.
device
.
specdata1
=
MAJOR
(
rdev
);
data
->
arg
.
u
.
device
.
specdata2
=
MINOR
(
rdev
);
}
else
if
(
S_ISCHR
(
mode
))
{
arg
.
ftype
=
NF4CHR
;
arg
.
u
.
device
.
specdata1
=
MAJOR
(
rdev
);
arg
.
u
.
device
.
specdata2
=
MINOR
(
rdev
);
data
->
arg
.
ftype
=
NF4CHR
;
data
->
arg
.
u
.
device
.
specdata1
=
MAJOR
(
rdev
);
data
->
arg
.
u
.
device
.
specdata2
=
MINOR
(
rdev
);
}
else
arg
.
ftype
=
NF4SOCK
;
status
=
rpc_call_sync
(
NFS_CLIENT
(
dir
),
&
msg
,
0
);
if
(
status
==
0
)
{
update_changeattr
(
dir
,
&
res
.
dir_cinfo
);
nfs_post_op_update_inode
(
dir
,
res
.
dir_fattr
);
status
=
nfs_instantiate
(
dentry
,
&
fh
,
&
fattr
);
}
status
=
nfs4_do_create
(
dir
,
dentry
,
data
);
nfs4_free_createdata
(
data
);
out:
return
status
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录