]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
uclient: Move the MetaRequest to MClientRequest into its own code, and
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 15 Sep 2009 20:08:25 +0000 (13:08 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 18 Sep 2009 01:29:24 +0000 (18:29 -0700)
cut out the payload encode/decode since MClientRequests are now made
from MetaRequests.

Oh, and there are no issues with rebuilding messages -- false alarm!

src/client/Client.cc
src/client/Client.h

index 6f7e20e426a148b5608f81cb0b2a52fefd67bc79..70f302b0ed7280ee24adb78a41498ac7b41f47a0 100644 (file)
@@ -790,16 +790,8 @@ int Client::make_request(MetaRequest *request,
     request->set_oldest_client_tid(tid); // this one is the oldest.
 
   // -- make request --
-  MClientRequest *req = new MClientRequest(request->get_op());
-  memcpy(&req->head, &request->head, sizeof(ceph_mds_request_head));
-  req->set_filepath(request->get_filepath());
-  req->set_filepath2(request->get_filepath2());
-  req->set_data(request->data);
-
-  // encode payload now, in case we have to resend(in case of mds failure)
+  MClientRequest *req = make_request_from_Meta(request);
   request->request = req;
-  req->encode_payload();
-  request->request_payload = req->get_payload();
 
   // hack target mds?
   if (use_mds >= 0)
@@ -906,6 +898,17 @@ int Client::make_request(MetaRequest *request,
   return r;
 }
 
+inline MClientRequest* Client::make_request_from_Meta(MetaRequest *request)
+{
+  MClientRequest *req = new MClientRequest(request->get_op());
+  memcpy(&req->head, &request->head, sizeof(ceph_mds_request_head));
+  req->set_filepath(request->get_filepath());
+  req->set_filepath2(request->get_filepath2());
+  req->set_data(request->data);
+  req->set_retry_attempt(request->retry_attempt);
+  return req;
+}
+
 /*
 //call me from something that has client_lock held, I think
 void encode_cap_release(MetaRequest *req, int remove_cap,
@@ -979,14 +982,10 @@ void Client::send_request(MetaRequest *request, int mds)
     // make a new one
     dout(10) << "send_request rebuilding request " << request->get_tid()
             << " for mds" << mds << dendl;
-    r = new MClientRequest;
-    r->copy_payload(request->request_payload);
-    r->decode_payload();
-    r->set_retry_attempt(request->retry_attempt);
+    r = make_request_from_Meta(request);
     r->set_dentry_wanted();
     if (request->got_unsafe)
       r->set_replayed_op();
-    r->clear_payload();  // reencode with changes
   }
   else
     request->retry_attempt++;
index 75ecc4c4c0f4fac2dce4404916eb4930d1c1a4f0..38677434690f472d178923bc60b26102094b7de3 100644 (file)
@@ -93,9 +93,7 @@ struct InodeCap;
 struct Inode;
 
 struct MetaRequest {
-  tid_t tid;
   MClientRequest *request;    // the actual request to send out
-  bufferlist request_payload;  // in case i have to retry
   //used in constructing MClientRequests
   ceph_mds_request_head head;
   filepath path, path2;
@@ -121,10 +119,11 @@ struct MetaRequest {
   Cond  *caller_cond;          // who to take up
   Cond  *dispatch_cond;        // who to kick back
 
+  Inode *source;
   Inode *target;
 
   MetaRequest(MClientRequest *req, tid_t t) : 
-    tid(t), request(req), 
+    request(req), 
     resend_mds(-1), num_fwd(0), retry_attempt(0),
     ref(1), reply(0), 
     kick(false), got_safe(false), got_unsafe(false), unsafe_item(this),
@@ -134,7 +133,7 @@ struct MetaRequest {
   }
 
   MetaRequest(int op) : 
-    tid(-1), request(NULL),
+    request(NULL),
     resend_mds(-1), num_fwd(0), retry_attempt(0),
     ref(1), reply(0), 
     kick(false), got_safe(false), got_unsafe(false), unsafe_item(this),
@@ -1152,7 +1151,7 @@ private:
   int _fsync(Fh *fh, bool syncdataonly);
   int _sync_fs();
 
-
+  MClientRequest* make_request_from_Meta(MetaRequest * request);
 
 public:
   int mount();