From 350f3a7a7a8511899adb52b499bc537e178acb0e Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Thu, 24 Apr 2025 13:57:45 +0100 Subject: [PATCH] osd: Make projected_size in ECTransaction const This does not need to change once set, so adapt constructor to allow it to be const. Signed-off-by: Alex Ainscow --- src/osd/ECTransaction.cc | 10 ++-------- src/osd/ECTransaction.h | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index 0284ccb0eb7f5..e931e6cfbd61a 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -132,16 +132,10 @@ ECTransaction::WritePlanObj::WritePlanObj( will_write(sinfo.get_k_plus_m()), hinfo(hinfo), shinfo(shinfo), - orig_size(orig_size) // On-disk object sizes are rounded up to the next page. + orig_size(orig_size), // On-disk object sizes are rounded up to the next page. + projected_size(soi?soi->size:(oi?oi->size:0)) { extent_set unaligned_ro_writes; - - projected_size = oi ? oi->size : 0; - - if (soi) { - projected_size = soi->size; - } - hobject_t source; invalidates_cache = op.has_source(&source) || op.is_delete(); diff --git a/src/osd/ECTransaction.h b/src/osd/ECTransaction.h index b2f6157d17e51..4f4059e414c13 100644 --- a/src/osd/ECTransaction.h +++ b/src/osd/ECTransaction.h @@ -29,7 +29,7 @@ class WritePlanObj { const ECUtil::HashInfoRef hinfo; const ECUtil::HashInfoRef shinfo; const uint64_t orig_size; - uint64_t projected_size; + const uint64_t projected_size; bool invalidates_cache; bool do_parity_delta_write = false; @@ -74,7 +74,7 @@ struct WritePlan { } else { os << ", "; } - os << p; + os << "{" << p << "}"; } os << "]"; } -- 2.39.5