Skip to content

Commit c6e5724

Browse files
authored
Merge pull request ceph#46335 from cyx1231st/wip-seastore-onode-fix-unaligned-access
crimson/onode-staged-tree: fix unaligned reference to shard_pool_t::pool Reviewed-by: Samuel Just <[email protected]>
2 parents b5901f9 + 74c8530 commit c6e5724

File tree

1 file changed

+8
-6
lines changed
  • src/crimson/os/seastore/onode_manager/staged-fltree/stages

1 file changed

+8
-6
lines changed

src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,26 @@ struct node_offset_packed_t {
5858
// TODO: consider alignments
5959
struct shard_pool_t {
6060
bool operator==(const shard_pool_t& x) const {
61-
return (shard == x.shard && pool == x.pool);
61+
return (shard == x.shard && pool() == x.pool());
6262
}
6363
bool operator!=(const shard_pool_t& x) const { return !(*this == x); }
6464

65+
pool_t pool() const { return _pool; }
66+
6567
template <KeyT KT>
6668
static shard_pool_t from_key(const full_key_t<KT>& key);
6769

6870
shard_t shard;
69-
pool_t pool;
71+
pool_t _pool;
7072
} __attribute__((packed));
7173
inline std::ostream& operator<<(std::ostream& os, const shard_pool_t& sp) {
72-
return os << (int)sp.shard << "," << sp.pool;
74+
return os << (int)sp.shard << "," << sp.pool();
7375
}
7476
inline MatchKindCMP compare_to(const shard_pool_t& l, const shard_pool_t& r) {
7577
auto ret = toMatchKindCMP(l.shard, r.shard);
7678
if (ret != MatchKindCMP::EQ)
7779
return ret;
78-
return toMatchKindCMP(l.pool, r.pool);
80+
return toMatchKindCMP(l.pool(), r.pool());
7981
}
8082

8183
// Note: this is the reversed version of the object hash
@@ -621,7 +623,7 @@ class key_view_t {
621623
return shard_pool_packed().shard;
622624
}
623625
pool_t pool() const {
624-
return shard_pool_packed().pool;
626+
return shard_pool_packed().pool();
625627
}
626628
crush_hash_t crush() const {
627629
return crush_packed().crush;
@@ -841,7 +843,7 @@ MatchKindCMP compare_to(const full_key_t<Type>& key, const shard_pool_t& target)
841843
auto ret = toMatchKindCMP(key.shard(), target.shard);
842844
if (ret != MatchKindCMP::EQ)
843845
return ret;
844-
return toMatchKindCMP(key.pool(), target.pool);
846+
return toMatchKindCMP(key.pool(), target.pool());
845847
}
846848

847849
template <KeyT Type>

0 commit comments

Comments
 (0)