From 0c1c972866bb5522093f6693e212c517c98e7369 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Wed, 22 Sep 2021 15:43:23 +0800 Subject: [PATCH] crimson/onode-staged-tree: consolidate laddr hint calculation Signed-off-by: Yingxin Cheng --- .../staged-fltree/stages/key_layout.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h index 82dec5c0634..be138ae84e3 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h @@ -42,14 +42,13 @@ template<> struct _full_key_type { using type = key_hobj_t; }; template using full_key_t = typename _full_key_type::type; -static laddr_t get_lba_hint(shard_t shard, pool_t pool, crush_hash_t crush) -{ - if (shard == shard_id_t::NO_SHARD) { - return (uint64_t)(pool & 0xFF)<<56 | (uint64_t)(crush)<<24; - } else { - return (uint64_t)(shard & 0X7F)<<56 | (uint64_t)(pool& 0xFF)<<48 | - (uint64_t)(crush)<<16; - } +static laddr_t get_lba_hint(shard_t shard, pool_t pool, crush_hash_t crush) { + // FIXME: It is possible that PGs from different pools share the same prefix + // if the mask 0xFF is not long enough, result in unexpected transaction + // conflicts. + return ((uint64_t)(shard & 0XFF)<<56 | + (uint64_t)(pool & 0xFF)<<48 | + (uint64_t)(crush )<<16); } struct node_offset_packed_t { -- 2.39.5