Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
c03b4024
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
c03b4024
编写于
6月 17, 2007
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Convert struct nfs_page to use krefs
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
a50f7951
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
14 deletion
+16
-14
fs/nfs/pagelist.c
fs/nfs/pagelist.c
+8
-6
fs/nfs/write.c
fs/nfs/write.c
+3
-3
include/linux/nfs_page.h
include/linux/nfs_page.h
+5
-5
未找到文件。
fs/nfs/pagelist.c
浏览文件 @
c03b4024
...
...
@@ -85,9 +85,8 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
req
->
wb_offset
=
offset
;
req
->
wb_pgbase
=
offset
;
req
->
wb_bytes
=
count
;
atomic_set
(
&
req
->
wb_count
,
1
);
req
->
wb_context
=
get_nfs_open_context
(
ctx
);
kref_init
(
&
req
->
wb_kref
);
return
req
;
}
...
...
@@ -160,11 +159,9 @@ void nfs_clear_request(struct nfs_page *req)
*
* Note: Should never be called with the spinlock held!
*/
void
nfs_release_request
(
struct
nfs_page
*
req
)
static
void
nfs_free_request
(
struct
kref
*
kref
)
{
if
(
!
atomic_dec_and_test
(
&
req
->
wb_count
))
return
;
struct
nfs_page
*
req
=
container_of
(
kref
,
struct
nfs_page
,
wb_kref
);
/* Release struct file or cached credential */
nfs_clear_request
(
req
);
...
...
@@ -172,6 +169,11 @@ nfs_release_request(struct nfs_page *req)
nfs_page_free
(
req
);
}
void
nfs_release_request
(
struct
nfs_page
*
req
)
{
kref_put
(
&
req
->
wb_kref
,
nfs_free_request
);
}
static
int
nfs_wait_bit_interruptible
(
void
*
word
)
{
int
ret
=
0
;
...
...
fs/nfs/write.c
浏览文件 @
c03b4024
...
...
@@ -117,7 +117,7 @@ static struct nfs_page *nfs_page_find_request_locked(struct page *page)
if
(
PagePrivate
(
page
))
{
req
=
(
struct
nfs_page
*
)
page_private
(
page
);
if
(
req
!=
NULL
)
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
}
return
req
;
}
...
...
@@ -398,7 +398,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
if
(
PageDirty
(
req
->
wb_page
))
set_bit
(
PG_NEED_FLUSH
,
&
req
->
wb_flags
);
nfsi
->
npages
++
;
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
return
0
;
}
...
...
@@ -531,7 +531,7 @@ static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, u
next
=
req
->
wb_index
+
1
;
BUG_ON
(
!
NFS_WBACK_BUSY
(
req
));
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
spin_unlock
(
&
nfsi
->
req_lock
);
error
=
nfs_wait_on_request
(
req
);
nfs_release_request
(
req
);
...
...
include/linux/nfs_page.h
浏览文件 @
c03b4024
...
...
@@ -16,7 +16,7 @@
#include <linux/sunrpc/auth.h>
#include <linux/nfs_xdr.h>
#include <
asm/atomic
.h>
#include <
linux/kref
.h>
/*
* Valid flags for the radix tree
...
...
@@ -42,7 +42,7 @@ struct nfs_page {
unsigned
int
wb_offset
,
/* Offset & ~PAGE_CACHE_MASK */
wb_pgbase
,
/* Start of page data */
wb_bytes
;
/* Length of request */
atomic_t
wb_count
;
/* reference count */
struct
kref
wb_kref
;
/* reference count */
unsigned
long
wb_flags
;
struct
nfs_writeverf
wb_verf
;
/* Commit cookie */
};
...
...
@@ -89,7 +89,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
/*
* Lock the page of an asynchronous request without
incrementing the wb_count
* Lock the page of an asynchronous request without
getting a new reference
*/
static
inline
int
nfs_lock_request_dontget
(
struct
nfs_page
*
req
)
...
...
@@ -98,14 +98,14 @@ nfs_lock_request_dontget(struct nfs_page *req)
}
/*
* Lock the page of an asynchronous request
* Lock the page of an asynchronous request
and take a reference
*/
static
inline
int
nfs_lock_request
(
struct
nfs_page
*
req
)
{
if
(
test_and_set_bit
(
PG_BUSY
,
&
req
->
wb_flags
))
return
0
;
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录