Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
df28152d
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看板
提交
df28152d
编写于
6月 15, 2017
作者:
I
Ilya Dryomov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libceph: avoid unnecessary pi lookups in calc_target()
Signed-off-by:
N
Ilya Dryomov
<
idryomov@gmail.com
>
上级
6d637a54
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
30 deletion
+42
-30
include/linux/ceph/osdmap.h
include/linux/ceph/osdmap.h
+8
-2
net/ceph/osd_client.c
net/ceph/osd_client.c
+4
-4
net/ceph/osdmap.c
net/ceph/osdmap.c
+30
-24
未找到文件。
include/linux/ceph/osdmap.h
浏览文件 @
df28152d
...
...
@@ -273,16 +273,22 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
u64
off
,
u64
len
,
u64
*
bno
,
u64
*
oxoff
,
u64
*
oxlen
);
int
__ceph_object_locator_to_pg
(
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_object_id
*
oid
,
const
struct
ceph_object_locator
*
oloc
,
struct
ceph_pg
*
raw_pgid
);
int
ceph_object_locator_to_pg
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_object_id
*
oid
,
struct
ceph_object_locator
*
oloc
,
const
struct
ceph_object_id
*
oid
,
const
struct
ceph_object_locator
*
oloc
,
struct
ceph_pg
*
raw_pgid
);
void
ceph_pg_to_up_acting_osds
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_pg
*
raw_pgid
,
struct
ceph_osds
*
up
,
struct
ceph_osds
*
acting
);
bool
ceph_pg_to_primary_shard
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_pg
*
raw_pgid
,
struct
ceph_spg
*
spgid
);
int
ceph_pg_to_acting_primary
(
struct
ceph_osdmap
*
osdmap
,
...
...
net/ceph/osd_client.c
浏览文件 @
df28152d
...
...
@@ -1368,8 +1368,8 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
}
}
ret
=
ceph_object_locator_to_pg
(
osdc
->
osdmap
,
&
t
->
target_oid
,
&
t
->
target_oloc
,
&
pgid
);
ret
=
__ceph_object_locator_to_pg
(
pi
,
&
t
->
target_oid
,
&
t
->
target_oloc
,
&
pgid
);
if
(
ret
)
{
WARN_ON
(
ret
!=
-
ENOENT
);
t
->
osd
=
CEPH_HOMELESS_OSD
;
...
...
@@ -1379,7 +1379,7 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
last_pgid
.
pool
=
pgid
.
pool
;
last_pgid
.
seed
=
ceph_stable_mod
(
pgid
.
seed
,
t
->
pg_num
,
t
->
pg_num_mask
);
ceph_pg_to_up_acting_osds
(
osdc
->
osdmap
,
&
pgid
,
&
up
,
&
acting
);
ceph_pg_to_up_acting_osds
(
osdc
->
osdmap
,
pi
,
&
pgid
,
&
up
,
&
acting
);
if
(
any_change
&&
ceph_is_new_interval
(
&
t
->
acting
,
&
acting
,
...
...
@@ -1407,7 +1407,7 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
if
(
legacy_change
||
force_resend
||
split
)
{
t
->
pgid
=
pgid
;
/* struct */
ceph_pg_to_primary_shard
(
osdc
->
osdmap
,
&
pgid
,
&
t
->
spgid
);
ceph_pg_to_primary_shard
(
osdc
->
osdmap
,
pi
,
&
pgid
,
&
t
->
spgid
);
ceph_osds_copy
(
&
t
->
acting
,
&
acting
);
ceph_osds_copy
(
&
t
->
up
,
&
up
);
t
->
size
=
pi
->
size
;
...
...
net/ceph/osdmap.c
浏览文件 @
df28152d
...
...
@@ -1923,16 +1923,12 @@ EXPORT_SYMBOL(ceph_calc_file_object_mapping);
* Should only be called with target_oid and target_oloc (as opposed to
* base_oid and base_oloc), since tiering isn't taken into account.
*/
int
ceph_object_locator_to_pg
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_object_id
*
oid
,
struct
ceph_object_locator
*
oloc
,
struct
ceph_pg
*
raw_pgid
)
int
__ceph_object_locator_to_pg
(
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_object_id
*
oid
,
const
struct
ceph_object_locator
*
oloc
,
struct
ceph_pg
*
raw_pgid
)
{
struct
ceph_pg_pool_info
*
pi
;
pi
=
ceph_pg_pool_by_id
(
osdmap
,
oloc
->
pool
);
if
(
!
pi
)
return
-
ENOENT
;
WARN_ON
(
pi
->
id
!=
oloc
->
pool
);
if
(
!
oloc
->
pool_ns
)
{
raw_pgid
->
pool
=
oloc
->
pool
;
...
...
@@ -1964,6 +1960,20 @@ int ceph_object_locator_to_pg(struct ceph_osdmap *osdmap,
}
return
0
;
}
int
ceph_object_locator_to_pg
(
struct
ceph_osdmap
*
osdmap
,
const
struct
ceph_object_id
*
oid
,
const
struct
ceph_object_locator
*
oloc
,
struct
ceph_pg
*
raw_pgid
)
{
struct
ceph_pg_pool_info
*
pi
;
pi
=
ceph_pg_pool_by_id
(
osdmap
,
oloc
->
pool
);
if
(
!
pi
)
return
-
ENOENT
;
return
__ceph_object_locator_to_pg
(
pi
,
oid
,
oloc
,
raw_pgid
);
}
EXPORT_SYMBOL
(
ceph_object_locator_to_pg
);
/*
...
...
@@ -2236,19 +2246,14 @@ static void get_temp_osds(struct ceph_osdmap *osdmap,
* resend a request.
*/
void
ceph_pg_to_up_acting_osds
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_pg
*
raw_pgid
,
struct
ceph_osds
*
up
,
struct
ceph_osds
*
acting
)
{
struct
ceph_pg_pool_info
*
pi
;
u32
pps
;
pi
=
ceph_pg_pool_by_id
(
osdmap
,
raw_pgid
->
pool
);
if
(
!
pi
)
{
ceph_osds_init
(
up
);
ceph_osds_init
(
acting
);
goto
out
;
}
WARN_ON
(
pi
->
id
!=
raw_pgid
->
pool
);
pg_to_raw_osds
(
osdmap
,
pi
,
raw_pgid
,
up
,
&
pps
);
raw_to_up_osds
(
osdmap
,
pi
,
up
);
...
...
@@ -2260,23 +2265,19 @@ void ceph_pg_to_up_acting_osds(struct ceph_osdmap *osdmap,
if
(
acting
->
primary
==
-
1
)
acting
->
primary
=
up
->
primary
;
}
out:
WARN_ON
(
!
osds_valid
(
up
)
||
!
osds_valid
(
acting
));
}
bool
ceph_pg_to_primary_shard
(
struct
ceph_osdmap
*
osdmap
,
struct
ceph_pg_pool_info
*
pi
,
const
struct
ceph_pg
*
raw_pgid
,
struct
ceph_spg
*
spgid
)
{
struct
ceph_pg_pool_info
*
pi
;
struct
ceph_pg
pgid
;
struct
ceph_osds
up
,
acting
;
int
i
;
pi
=
ceph_pg_pool_by_id
(
osdmap
,
raw_pgid
->
pool
);
if
(
!
pi
)
return
false
;
WARN_ON
(
pi
->
id
!=
raw_pgid
->
pool
);
raw_pg_to_pg
(
pi
,
raw_pgid
,
&
pgid
);
if
(
ceph_can_shift_osds
(
pi
))
{
...
...
@@ -2285,7 +2286,7 @@ bool ceph_pg_to_primary_shard(struct ceph_osdmap *osdmap,
return
true
;
}
ceph_pg_to_up_acting_osds
(
osdmap
,
&
pgid
,
&
up
,
&
acting
);
ceph_pg_to_up_acting_osds
(
osdmap
,
pi
,
&
pgid
,
&
up
,
&
acting
);
for
(
i
=
0
;
i
<
acting
.
size
;
i
++
)
{
if
(
acting
.
osds
[
i
]
==
acting
.
primary
)
{
spgid
->
pgid
=
pgid
;
/* struct */
...
...
@@ -2303,9 +2304,14 @@ bool ceph_pg_to_primary_shard(struct ceph_osdmap *osdmap,
int
ceph_pg_to_acting_primary
(
struct
ceph_osdmap
*
osdmap
,
const
struct
ceph_pg
*
raw_pgid
)
{
struct
ceph_pg_pool_info
*
pi
;
struct
ceph_osds
up
,
acting
;
ceph_pg_to_up_acting_osds
(
osdmap
,
raw_pgid
,
&
up
,
&
acting
);
pi
=
ceph_pg_pool_by_id
(
osdmap
,
raw_pgid
->
pool
);
if
(
!
pi
)
return
-
1
;
ceph_pg_to_up_acting_osds
(
osdmap
,
pi
,
raw_pgid
,
&
up
,
&
acting
);
return
acting
.
primary
;
}
EXPORT_SYMBOL
(
ceph_pg_to_acting_primary
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录