From: Suyash Dongre Date: Thu, 13 Jun 2024 14:59:25 +0000 (+0530) Subject: Annotated Striper.cc and PrimaryLogPG.cc X-Git-Tag: testing/wip-rishabh-testing-20240628.135345-debug~19^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=562e13df0e2a2679e53cd3aeed35cd40ff36f1c9;p=ceph-ci.git Annotated Striper.cc and PrimaryLogPG.cc 1. src/osd/PrimaryLogPG.cc: It's safe to use clear() on operand that has been moved. reference: https://github.com/ceph/ceph/pull/48839/files 2. src/osdc/Striper.cc: This is a false-positive because in the loop the bufferlist is only being moved when the size of the buffer_extents is equal to 1 otherwise it will not move reference: https://github.com/ceph/ceph/blob/e879ce83c084f1a96e5dd0ab2b57bf909cfa423d/src/osdc/Striper.cc#L411-L415 Signed-off-by: Suyash Dongre --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 1dc991ea8ce..5be9b8be62f 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4904,7 +4904,7 @@ int PrimaryLogPG::trim_object( encode(snapset, bl); attrs[SS_ATTR] = std::move(bl); - bl.clear(); + bl.clear(); //NOLINT(bugprone-use-after-move) encode(head_obc->obs.oi, bl, get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr)); attrs[OI_ATTR] = std::move(bl); diff --git a/src/osdc/Striper.cc b/src/osdc/Striper.cc index 69bdda06f84..d45828d15c5 100644 --- a/src/osdc/Striper.cc +++ b/src/osdc/Striper.cc @@ -407,7 +407,7 @@ void Striper::StripedReadResult::add_partial_result( << " to " << buffer_extents << dendl; for (auto& be : buffer_extents) { auto& r = partial[be.first]; - size_t actual = std::min(bl.length(), be.second); + size_t actual = std::min(bl.length(), be.second); //NOLINT(bugprone-use-after-move) if (buffer_extents.size() == 1) { r.first = std::move(bl); } else {