From: Kefu Chai Date: Mon, 14 Jul 2025 10:50:48 +0000 (+0800) Subject: os/Transaction: change get_num_ops() return type to uint64_t X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=98f3454f0c1eeadecaffa237e575132675f9afff;p=ceph.git os/Transaction: change get_num_ops() return type to uint64_t Change Transaction::get_num_ops() to return uint64_t instead of int to match the underlying data.ops type (ceph_le<__u64>) and eliminate compiler warnings about signed/unsigned comparison. Fixes warning in ECTransaction.cc: ``` /home/kefu/dev/ceph/src/osd/ECTransaction.cc: In constructor ‘ECTransaction::Generate::Generate(PGTransaction&, ceph::ErasureCodeInterfaceRef&, pg_t&, const ECUtil::stripe_info_t&, const std::map&, std::map*, shard_id_map&, const OSDMapRef&, const hobject_t&, PGTransaction::ObjectOperation&, ECTransaction::WritePlanObj&, DoutPrefixProvider*, pg_log_entry_t*)’: /home/kefu/dev/ceph/src/osd/ECTransaction.cc:589:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘__gnu_cxx::__alloc_traits, unsigned int>::value_type’ {aka ‘unsigned int’} [-Wsign-compare] 589 | if (t.get_num_ops() > old_transaction_counts[int(shard)] && ``` Signed-off-by: Kefu Chai --- diff --git a/src/os/Transaction.h b/src/os/Transaction.h index b8124df7d25..ef1fb5913b7 100644 --- a/src/os/Transaction.h +++ b/src/os/Transaction.h @@ -626,7 +626,7 @@ public: return !data.ops; } /// Number of operations in the transaction - int get_num_ops() { + uint64_t get_num_ops() { return data.ops; }