Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
70220ac8
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
70220ac8
编写于
7月 06, 2016
作者:
Y
Yan, Zheng
提交者:
Ilya Dryomov
7月 28, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ceph: introduce an inode flag to indicates if snapflush is needed
Signed-off-by:
N
Yan, Zheng
<
zyan@redhat.com
>
上级
13c2b57d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
15 deletion
+36
-15
fs/ceph/caps.c
fs/ceph/caps.c
+33
-15
fs/ceph/snap.c
fs/ceph/snap.c
+2
-0
fs/ceph/super.h
fs/ceph/super.h
+1
-0
未找到文件。
fs/ceph/caps.c
浏览文件 @
70220ac8
...
@@ -1368,6 +1368,7 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci)
...
@@ -1368,6 +1368,7 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci)
{
{
spin_lock
(
&
ci
->
i_ceph_lock
);
spin_lock
(
&
ci
->
i_ceph_lock
);
__ceph_flush_snaps
(
ci
,
NULL
);
__ceph_flush_snaps
(
ci
,
NULL
);
ci
->
i_ceph_flags
&=
~
CEPH_I_FLUSH_SNAPS
;
spin_unlock
(
&
ci
->
i_ceph_lock
);
spin_unlock
(
&
ci
->
i_ceph_lock
);
}
}
...
@@ -1563,8 +1564,10 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
...
@@ -1563,8 +1564,10 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
flags
|=
CHECK_CAPS_FLUSH
;
flags
|=
CHECK_CAPS_FLUSH
;
/* flush snaps first time around only */
/* flush snaps first time around only */
if
(
!
list_empty
(
&
ci
->
i_cap_snaps
))
if
(
ci
->
i_ceph_flags
&
CEPH_I_FLUSH_SNAPS
)
{
__ceph_flush_snaps
(
ci
,
&
session
);
__ceph_flush_snaps
(
ci
,
&
session
);
ci
->
i_ceph_flags
&=
~
CEPH_I_FLUSH_SNAPS
;
}
goto
retry_locked
;
goto
retry_locked
;
retry:
retry:
spin_lock
(
&
ci
->
i_ceph_lock
);
spin_lock
(
&
ci
->
i_ceph_lock
);
...
@@ -2498,7 +2501,8 @@ void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps)
...
@@ -2498,7 +2501,8 @@ void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps)
* drop cap_snap that is not associated with any snapshot.
* drop cap_snap that is not associated with any snapshot.
* we don't need to send FLUSHSNAP message for it.
* we don't need to send FLUSHSNAP message for it.
*/
*/
static
int
ceph_try_drop_cap_snap
(
struct
ceph_cap_snap
*
capsnap
)
static
int
ceph_try_drop_cap_snap
(
struct
ceph_inode_info
*
ci
,
struct
ceph_cap_snap
*
capsnap
)
{
{
if
(
!
capsnap
->
need_flush
&&
if
(
!
capsnap
->
need_flush
&&
!
capsnap
->
writing
&&
!
capsnap
->
dirty_pages
)
{
!
capsnap
->
writing
&&
!
capsnap
->
dirty_pages
)
{
...
@@ -2506,6 +2510,9 @@ static int ceph_try_drop_cap_snap(struct ceph_cap_snap *capsnap)
...
@@ -2506,6 +2510,9 @@ static int ceph_try_drop_cap_snap(struct ceph_cap_snap *capsnap)
capsnap
,
capsnap
->
follows
);
capsnap
,
capsnap
->
follows
);
BUG_ON
(
capsnap
->
cap_flush
.
tid
>
0
);
BUG_ON
(
capsnap
->
cap_flush
.
tid
>
0
);
ceph_put_snap_context
(
capsnap
->
context
);
ceph_put_snap_context
(
capsnap
->
context
);
if
(
!
list_is_last
(
&
capsnap
->
ci_item
,
&
ci
->
i_cap_snaps
))
ci
->
i_ceph_flags
|=
CEPH_I_FLUSH_SNAPS
;
list_del
(
&
capsnap
->
ci_item
);
list_del
(
&
capsnap
->
ci_item
);
ceph_put_cap_snap
(
capsnap
);
ceph_put_cap_snap
(
capsnap
);
return
1
;
return
1
;
...
@@ -2553,7 +2560,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had)
...
@@ -2553,7 +2560,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had)
struct
ceph_cap_snap
,
struct
ceph_cap_snap
,
ci_item
);
ci_item
);
capsnap
->
writing
=
0
;
capsnap
->
writing
=
0
;
if
(
ceph_try_drop_cap_snap
(
capsnap
))
if
(
ceph_try_drop_cap_snap
(
c
i
,
c
apsnap
))
put
++
;
put
++
;
else
if
(
__ceph_finish_cap_snap
(
ci
,
capsnap
))
else
if
(
__ceph_finish_cap_snap
(
ci
,
capsnap
))
flushsnaps
=
1
;
flushsnaps
=
1
;
...
@@ -2596,15 +2603,19 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
...
@@ -2596,15 +2603,19 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
struct
ceph_snap_context
*
snapc
)
struct
ceph_snap_context
*
snapc
)
{
{
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
int
last
=
0
;
int
complete_capsnap
=
0
;
int
drop_capsnap
=
0
;
int
found
=
0
;
struct
ceph_cap_snap
*
capsnap
=
NULL
;
struct
ceph_cap_snap
*
capsnap
=
NULL
;
int
put
=
0
;
bool
last
=
false
;
bool
found
=
false
;
bool
flush_snaps
=
false
;
bool
complete_capsnap
=
false
;
spin_lock
(
&
ci
->
i_ceph_lock
);
spin_lock
(
&
ci
->
i_ceph_lock
);
ci
->
i_wrbuffer_ref
-=
nr
;
ci
->
i_wrbuffer_ref
-=
nr
;
last
=
!
ci
->
i_wrbuffer_ref
;
if
(
ci
->
i_wrbuffer_ref
==
0
)
{
last
=
true
;
put
++
;
}
if
(
ci
->
i_head_snapc
==
snapc
)
{
if
(
ci
->
i_head_snapc
==
snapc
)
{
ci
->
i_wrbuffer_ref_head
-=
nr
;
ci
->
i_wrbuffer_ref_head
-=
nr
;
...
@@ -2624,15 +2635,22 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
...
@@ -2624,15 +2635,22 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
}
else
{
}
else
{
list_for_each_entry
(
capsnap
,
&
ci
->
i_cap_snaps
,
ci_item
)
{
list_for_each_entry
(
capsnap
,
&
ci
->
i_cap_snaps
,
ci_item
)
{
if
(
capsnap
->
context
==
snapc
)
{
if
(
capsnap
->
context
==
snapc
)
{
found
=
1
;
found
=
true
;
break
;
break
;
}
}
}
}
BUG_ON
(
!
found
);
BUG_ON
(
!
found
);
capsnap
->
dirty_pages
-=
nr
;
capsnap
->
dirty_pages
-=
nr
;
if
(
capsnap
->
dirty_pages
==
0
)
{
if
(
capsnap
->
dirty_pages
==
0
)
{
complete_capsnap
=
1
;
complete_capsnap
=
true
;
drop_capsnap
=
ceph_try_drop_cap_snap
(
capsnap
);
if
(
!
capsnap
->
writing
)
{
if
(
ceph_try_drop_cap_snap
(
ci
,
capsnap
))
{
put
++
;
}
else
{
ci
->
i_ceph_flags
|=
CEPH_I_FLUSH_SNAPS
;
flush_snaps
=
true
;
}
}
}
}
dout
(
"put_wrbuffer_cap_refs on %p cap_snap %p "
dout
(
"put_wrbuffer_cap_refs on %p cap_snap %p "
" snap %lld %d/%d -> %d/%d %s%s
\n
"
,
" snap %lld %d/%d -> %d/%d %s%s
\n
"
,
...
@@ -2647,12 +2665,12 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
...
@@ -2647,12 +2665,12 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
if
(
last
)
{
if
(
last
)
{
ceph_check_caps
(
ci
,
CHECK_CAPS_AUTHONLY
,
NULL
);
ceph_check_caps
(
ci
,
CHECK_CAPS_AUTHONLY
,
NULL
);
iput
(
inode
);
}
else
if
(
flush_snaps
)
{
}
else
if
(
complete_capsnap
)
{
ceph_flush_snaps
(
ci
);
ceph_flush_snaps
(
ci
);
wake_up_all
(
&
ci
->
i_cap_wq
);
}
}
if
(
drop_capsnap
)
if
(
complete_capsnap
)
wake_up_all
(
&
ci
->
i_cap_wq
);
while
(
put
--
>
0
)
iput
(
inode
);
iput
(
inode
);
}
}
...
...
fs/ceph/snap.c
浏览文件 @
70220ac8
...
@@ -601,6 +601,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
...
@@ -601,6 +601,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
capsnap
->
dirty_pages
);
capsnap
->
dirty_pages
);
return
0
;
return
0
;
}
}
ci
->
i_ceph_flags
|=
CEPH_I_FLUSH_SNAPS
;
dout
(
"finish_cap_snap %p cap_snap %p snapc %p %llu %s s=%llu
\n
"
,
dout
(
"finish_cap_snap %p cap_snap %p snapc %p %llu %s s=%llu
\n
"
,
inode
,
capsnap
,
capsnap
->
context
,
inode
,
capsnap
,
capsnap
->
context
,
capsnap
->
context
->
seq
,
ceph_cap_string
(
capsnap
->
dirty
),
capsnap
->
context
->
seq
,
ceph_cap_string
(
capsnap
->
dirty
),
...
...
fs/ceph/super.h
浏览文件 @
70220ac8
...
@@ -469,6 +469,7 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
...
@@ -469,6 +469,7 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
#define CEPH_I_SEC_INITED (1 << 7)
/* security initialized */
#define CEPH_I_SEC_INITED (1 << 7)
/* security initialized */
#define CEPH_I_CAP_DROPPED (1 << 8)
/* caps were forcibly dropped */
#define CEPH_I_CAP_DROPPED (1 << 8)
/* caps were forcibly dropped */
#define CEPH_I_KICK_FLUSH (1 << 9)
/* kick flushing caps */
#define CEPH_I_KICK_FLUSH (1 << 9)
/* kick flushing caps */
#define CEPH_I_FLUSH_SNAPS (1 << 10)
/* need flush snapss */
static
inline
void
__ceph_dir_set_complete
(
struct
ceph_inode_info
*
ci
,
static
inline
void
__ceph_dir_set_complete
(
struct
ceph_inode_info
*
ci
,
long
long
release_count
,
long
long
release_count
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录