Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
df28152d
Commit
df28152d
authored
Jun 15, 2017
by
Ilya Dryomov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libceph: avoid unnecessary pi lookups in calc_target()
Signed-off-by:
Ilya Dryomov
<
idryomov@gmail.com
>
parent
6d637a54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
30 deletions
+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
No files found.
include/linux/ceph/osdmap.h
View file @
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
View file @
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
View file @
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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment