Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
3feb2d49
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,发现更多精彩内容 >>
提交
3feb2d49
编写于
3月 20, 2006
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Uninline nfs_writedata_(alloc|free) and nfs_readdata_(alloc|free)
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
5db3a7b2
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
66 addition
and
65 deletion
+66
-65
fs/nfs/read.c
fs/nfs/read.c
+31
-1
fs/nfs/write.c
fs/nfs/write.c
+31
-1
include/linux/nfs_fs.h
include/linux/nfs_fs.h
+4
-63
未找到文件。
fs/nfs/read.c
浏览文件 @
3feb2d49
...
...
@@ -40,10 +40,40 @@ static const struct rpc_call_ops nfs_read_partial_ops;
static
const
struct
rpc_call_ops
nfs_read_full_ops
;
static
kmem_cache_t
*
nfs_rdata_cachep
;
mempool_t
*
nfs_rdata_mempool
;
static
mempool_t
*
nfs_rdata_mempool
;
#define MIN_POOL_READ (32)
struct
nfs_read_data
*
nfs_readdata_alloc
(
unsigned
int
pagecount
)
{
struct
nfs_read_data
*
p
=
mempool_alloc
(
nfs_rdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
if
(
pagecount
<
NFS_PAGEVEC_SIZE
)
p
->
pagevec
=
&
p
->
page_array
[
0
];
else
{
size_t
size
=
++
pagecount
*
sizeof
(
struct
page
*
);
p
->
pagevec
=
kmalloc
(
size
,
GFP_NOFS
);
if
(
p
->
pagevec
)
{
memset
(
p
->
pagevec
,
0
,
size
);
}
else
{
mempool_free
(
p
,
nfs_rdata_mempool
);
p
=
NULL
;
}
}
}
return
p
;
}
void
nfs_readdata_free
(
struct
nfs_read_data
*
p
)
{
if
(
p
&&
(
p
->
pagevec
!=
&
p
->
page_array
[
0
]))
kfree
(
p
->
pagevec
);
mempool_free
(
p
,
nfs_rdata_mempool
);
}
void
nfs_readdata_release
(
void
*
data
)
{
nfs_readdata_free
(
data
);
...
...
fs/nfs/write.c
浏览文件 @
3feb2d49
...
...
@@ -86,7 +86,7 @@ static const struct rpc_call_ops nfs_write_full_ops;
static
const
struct
rpc_call_ops
nfs_commit_ops
;
static
kmem_cache_t
*
nfs_wdata_cachep
;
mempool_t
*
nfs_wdata_mempool
;
static
mempool_t
*
nfs_wdata_mempool
;
static
mempool_t
*
nfs_commit_mempool
;
static
DECLARE_WAIT_QUEUE_HEAD
(
nfs_write_congestion
);
...
...
@@ -119,6 +119,36 @@ void nfs_commit_free(struct nfs_write_data *p)
mempool_free
(
p
,
nfs_commit_mempool
);
}
struct
nfs_write_data
*
nfs_writedata_alloc
(
unsigned
int
pagecount
)
{
struct
nfs_write_data
*
p
=
mempool_alloc
(
nfs_wdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
if
(
pagecount
<
NFS_PAGEVEC_SIZE
)
p
->
pagevec
=
&
p
->
page_array
[
0
];
else
{
size_t
size
=
++
pagecount
*
sizeof
(
struct
page
*
);
p
->
pagevec
=
kmalloc
(
size
,
GFP_NOFS
);
if
(
p
->
pagevec
)
{
memset
(
p
->
pagevec
,
0
,
size
);
}
else
{
mempool_free
(
p
,
nfs_wdata_mempool
);
p
=
NULL
;
}
}
}
return
p
;
}
void
nfs_writedata_free
(
struct
nfs_write_data
*
p
)
{
if
(
p
&&
(
p
->
pagevec
!=
&
p
->
page_array
[
0
]))
kfree
(
p
->
pagevec
);
mempool_free
(
p
,
nfs_wdata_mempool
);
}
void
nfs_writedata_release
(
void
*
wdata
)
{
nfs_writedata_free
(
wdata
);
...
...
include/linux/nfs_fs.h
浏览文件 @
3feb2d49
...
...
@@ -462,37 +462,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
/*
* Allocate and free nfs_write_data structures
*/
extern
mempool_t
*
nfs_wdata_mempool
;
static
inline
struct
nfs_write_data
*
nfs_writedata_alloc
(
unsigned
int
pagecount
)
{
struct
nfs_write_data
*
p
=
mempool_alloc
(
nfs_wdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
if
(
pagecount
<
NFS_PAGEVEC_SIZE
)
p
->
pagevec
=
&
p
->
page_array
[
0
];
else
{
size_t
size
=
++
pagecount
*
sizeof
(
struct
page
*
);
p
->
pagevec
=
kmalloc
(
size
,
GFP_NOFS
);
if
(
p
->
pagevec
)
{
memset
(
p
->
pagevec
,
0
,
size
);
}
else
{
mempool_free
(
p
,
nfs_wdata_mempool
);
p
=
NULL
;
}
}
}
return
p
;
}
static
inline
void
nfs_writedata_free
(
struct
nfs_write_data
*
p
)
{
if
(
p
&&
(
p
->
pagevec
!=
&
p
->
page_array
[
0
]))
kfree
(
p
->
pagevec
);
mempool_free
(
p
,
nfs_wdata_mempool
);
}
extern
struct
nfs_write_data
*
nfs_writedata_alloc
(
unsigned
int
pagecount
);
extern
void
nfs_writedata_free
(
struct
nfs_write_data
*
p
);
/*
* linux/fs/nfs/read.c
...
...
@@ -503,41 +474,11 @@ extern int nfs_readpages(struct file *, struct address_space *,
extern
int
nfs_readpage_result
(
struct
rpc_task
*
,
struct
nfs_read_data
*
);
extern
void
nfs_readdata_release
(
void
*
data
);
/*
* Allocate and free nfs_read_data structures
*/
extern
mempool_t
*
nfs_rdata_mempool
;
static
inline
struct
nfs_read_data
*
nfs_readdata_alloc
(
unsigned
int
pagecount
)
{
struct
nfs_read_data
*
p
=
mempool_alloc
(
nfs_rdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
if
(
pagecount
<
NFS_PAGEVEC_SIZE
)
p
->
pagevec
=
&
p
->
page_array
[
0
];
else
{
size_t
size
=
++
pagecount
*
sizeof
(
struct
page
*
);
p
->
pagevec
=
kmalloc
(
size
,
GFP_NOFS
);
if
(
p
->
pagevec
)
{
memset
(
p
->
pagevec
,
0
,
size
);
}
else
{
mempool_free
(
p
,
nfs_rdata_mempool
);
p
=
NULL
;
}
}
}
return
p
;
}
static
inline
void
nfs_readdata_free
(
struct
nfs_read_data
*
p
)
{
if
(
p
&&
(
p
->
pagevec
!=
&
p
->
page_array
[
0
]))
kfree
(
p
->
pagevec
);
mempool_free
(
p
,
nfs_rdata_mempool
);
}
extern
struct
nfs_read_data
*
nfs_readdata_alloc
(
unsigned
int
pagecount
);
extern
void
nfs_readdata_free
(
struct
nfs_read_data
*
p
);
/*
* linux/fs/nfs3proc.c
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录