]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/.../client_request: don't pass Ref<PG> by reference
authorSamuel Just <sjust@redhat.com>
Tue, 6 Feb 2024 04:46:57 +0000 (20:46 -0800)
committerSamuel Just <sjust@redhat.com>
Mon, 1 Apr 2024 23:11:32 +0000 (16:11 -0700)
If we only need a reference to the PG, pass a PG&.  Passing Ref<PG>&
makes it easy to inadvertently std::move() the passed value from
a caller.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/osd_operations/client_request.cc
src/crimson/osd/osd_operations/client_request.h

index 0e5dfac130277d48976293ad6068b6f3b8f22e82..00ed92adf650a803e31e5314baac1619afeef475 100644 (file)
@@ -193,7 +193,7 @@ seastar::future<> ClientRequest::with_pg(
 
 ClientRequest::interruptible_future<>
 ClientRequest::process_pg_op(
-  Ref<PG> &pg)
+  Ref<PG> pg)
 {
   return pg->do_pg_ops(
     m
@@ -219,7 +219,7 @@ auto ClientRequest::reply_op_error(const Ref<PG>& pg, int err)
 
 ClientRequest::interruptible_future<>
 ClientRequest::process_op(
-  instance_handle_t &ihref, Ref<PG> &pg, unsigned this_instance_id)
+  instance_handle_t &ihref, Ref<PG> pg, unsigned this_instance_id)
 {
   LOG_PREFIX(ClientRequest::process_op);
   return ihref.enter_stage<interruptor>(
@@ -295,7 +295,7 @@ ClientRequest::process_op(
 ClientRequest::interruptible_future<>
 ClientRequest::do_process(
   instance_handle_t &ihref,
-  Ref<PG>& pg, crimson::osd::ObjectContextRef obc,
+  Ref<PG> pg, crimson::osd::ObjectContextRef obc,
   unsigned this_instance_id)
 {
   LOG_PREFIX(ClientRequest::do_process);
@@ -340,7 +340,7 @@ ClientRequest::do_process(
     return reply_op_error(pg, -ENOENT);
   }
 
-  SnapContext snapc = get_snapc(pg,obc);
+  SnapContext snapc = get_snapc(*pg,obc);
 
   if ((m->has_flag(CEPH_OSD_FLAG_ORDERSNAP)) &&
        snapc.seq < obc->ssc->snapset.seq) {
@@ -431,24 +431,24 @@ void ClientRequest::put_historic() const
 }
 
 const SnapContext ClientRequest::get_snapc(
-  Ref<PG>& pg,
+  PG &pg,
   crimson::osd::ObjectContextRef obc) const
 {
   LOG_PREFIX(ClientRequest::get_snapc);
   SnapContext snapc;
   if (op_info.may_write() || op_info.may_cache()) {
     // snap
-    if (pg->get_pgpool().info.is_pool_snaps_mode()) {
+    if (pg.get_pgpool().info.is_pool_snaps_mode()) {
       // use pool's snapc
-      snapc = pg->get_pgpool().snapc;
+      snapc = pg.get_pgpool().snapc;
       DEBUGDPP("{} using pool's snapc snaps={}",
-              *pg, *this, snapc.snaps);
+              pg, *this, snapc.snaps);
     } else {
       // client specified snapc
       snapc.seq = m->get_snap_seq();
       snapc.snaps = m->get_snaps();
       DEBUGDPP("{}: client specified snapc seq={} snaps={}",
-              *pg, *this, snapc.seq, snapc.snaps);
+              pg, *this, snapc.seq, snapc.snaps);
     }
   }
   return snapc;
index 48fac7f910366c7f8d52cc8641c3d3cb4936c074..3bc81fd4d44410ad98523de5b2830182f45266df 100644 (file)
@@ -266,16 +266,16 @@ private:
 
   interruptible_future<> do_process(
     instance_handle_t &ihref,
-    Ref<PG>& pg,
+    Ref<PG> pg,
     crimson::osd::ObjectContextRef obc,
     unsigned this_instance_id);
   ::crimson::interruptible::interruptible_future<
     ::crimson::osd::IOInterruptCondition> process_pg_op(
-    Ref<PG> &pg);
+    Ref<PG> pg);
   ::crimson::interruptible::interruptible_future<
     ::crimson::osd::IOInterruptCondition> process_op(
       instance_handle_t &ihref,
-      Ref<PG> &pg,
+      Ref<PG> pg,
       unsigned this_instance_id);
   bool is_pg_op() const;
 
@@ -290,7 +290,7 @@ private:
   bool is_misdirected(const PG& pg) const;
 
   const SnapContext get_snapc(
-    Ref<PG>& pg,
+    PG &pg,
     crimson::osd::ObjectContextRef obc) const;
 
 public: