]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: Fix uses of get_[data, payload, middle] to use throttling-aware functions.
authorGreg Farnum <gregf@hq.newdream.net>
Fri, 4 Jun 2010 23:19:00 +0000 (16:19 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 4 Jun 2010 23:42:55 +0000 (16:42 -0700)
src/ceph.cc
src/msg/Message.h
src/osd/ReplicatedPG.cc
src/osdc/Objecter.cc

index 468c32ae60acab9227f9c3b3fca01b20c3295388..71769487e4a6a6d5902224117c33e26651470412 100644 (file)
@@ -293,7 +293,7 @@ void send_command()
 {
   MMonCommand *m = new MMonCommand(mc.monmap.fsid, last_seen_version);
   m->cmd = pending_cmd;
-  m->get_data() = pending_bl;
+  m->set_data(pending_bl);
 
   cout << g_clock.now() << " mon" << " <- " << pending_cmd << std::endl;
   mc.send_mon_message(m);
index cbc99c7a2b8a98c32fc7787d9d89ed8e9d0e0211..44732aad2d02429422928168301d220e5da7621b 100644 (file)
@@ -291,11 +291,23 @@ public:
   void set_footer(const ceph_msg_footer &e) { footer = e; }
   ceph_msg_footer &get_footer() { return footer; }
 
+  /*
+   * If you use get_[data, middle, payload] you shouldn't
+   * use it to change those bufferlists unless you KNOW
+   * there is no throttle being used. The other
+   * functions are throttling-aware as appropriate.
+   */
+
   void clear_payload() {
     if (throttler) throttler->put(payload.length() + middle.length());
     payload.clear();
     middle.clear();
   }
+  void clear_data() {
+    if (throttler) throttler->put(data.length());
+    data.clear();
+  }
+
   bool empty_payload() { return payload.length() == 0; }
   bufferlist& get_payload() { return payload; }
   void set_payload(bufferlist& bl) {
@@ -318,6 +330,10 @@ public:
   }
 
   bufferlist& get_data() { return data; }
+  void claim_data(bufferlist& bl) {
+    if (throttler) throttler->put(data.length());
+    bl.claim(data);
+  }
   off_t get_data_len() { return data.length(); }
 
   void set_recv_stamp(utime_t t) { recv_stamp = t; }
index c420a1399d05e2a7febd3d8e86c57ffb6739a3ef..fcb15d23319f60fb9687c5f9293b4d6ba534fda3 100644 (file)
@@ -1980,7 +1980,7 @@ void ReplicatedPG::op_applied(RepGather *repop)
 
   // discard my reference to the buffer
   if (repop->ctx->op)
-    repop->ctx->op->get_data().clear();
+    repop->ctx->op->clear_data();
   
   repop->applying = false;
   repop->applied = true;
@@ -2205,7 +2205,7 @@ void ReplicatedPG::issue_repop(RepGather *repop, utime_t now,
       wr->old_version = old_version;
       wr->snapset = repop->obc->obs.ssc->snapset;
       wr->snapc = repop->ctx->snapc;
-      wr->get_data() = repop->ctx->op->get_data();   // _copy_ bufferlist
+      wr->set_data(repop->ctx->op->get_data());   // _copy_ bufferlist
     } else {
       // ship resulting transaction, log entries, and pg_stats
       ::encode(repop->ctx->op_t, wr->get_data());
@@ -3250,7 +3250,7 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op)
   map<sobject_t, interval_set<uint64_t> > clone_subsets;
 
   bufferlist data;
-  data.claim(op->get_data());
+  op->claim_data(data);
 
   // we need this later, and it gets clobbered by t.setattrs()
   bufferlist oibl;
index cf07e6a3b1520a64de154dd3204d47794ca200e3..e1a6f6be93e3a23b84794a6de100c2545b4f11bf 100644 (file)
@@ -511,7 +511,7 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
 
   // got data?
   if (op->outbl) {
-    op->outbl->claim(m->get_data());
+    m->claim_data(*op->outbl);
     op->outbl = 0;
   }