From 0ff35731e9b5df0965cf204c8d0aab1623f3615e Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Thu, 12 May 2022 14:24:37 +0900 Subject: [PATCH] seastore: do assert if paddr type is not SEGMENT in add_relative Signed-off-by: Myoungwon Oh --- src/crimson/os/seastore/seastore_types.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index a7ff94ac49450..3bc0b0d923e8f 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -684,14 +684,11 @@ struct blk_paddr_t : public paddr_t { paddr_t add_relative(paddr_t o) const { seastore_off_t off; - if (o.get_addr_type() == addr_types_t::SEGMENT) { - // segment addr is allocated when alloc_new_extent is called. - // But, if random block device is used, - // this eventually can be converted to blk addr after submit_record(). - off = o.as_seg_paddr().get_segment_off(); - } else { - off = o.as_blk_paddr().get_block_off(); - } + ceph_assert(o.get_addr_type() == addr_types_t::SEGMENT); + // segment addr is allocated when alloc_new_extent is called. + // But, if random block device is used, + // segment-based relative addr needs to be added to block addr + off = o.as_seg_paddr().get_segment_off(); return add_offset(off); } -- 2.39.5