]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MDS: MDRequestImpl: provide filepath/filepath2 substitute for MClientRequest
authorGreg Farnum <greg@inktank.com>
Tue, 15 Jul 2014 17:42:29 +0000 (10:42 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 7 Nov 2014 19:48:43 +0000 (11:48 -0800)
Use this passthru in the Server path locking functions so that we can get
locks or auth pins without an associated MClientRequest.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/include/filepath.h
src/mds/Mutation.cc
src/mds/Mutation.h
src/mds/Server.cc

index ec1519d5464e4cf80fbcffd907ab7e676cea0d00..6d2128b22aeb1994a9801127d4e9f30e1a76f6aa 100644 (file)
@@ -30,6 +30,7 @@ using namespace std;
 
 #include "buffer.h"
 #include "encoding.h"
+#include "include/types.h"
 
 #include "common/Formatter.h"
 
index 2570f278f8ce8ed93ead7be6947bd90d73e2e982..3fb54e9b2a6ef057a80718b48186904b3bbb44ae 100644 (file)
@@ -278,6 +278,31 @@ void MDRequestImpl::drop_local_auth_pins()
   MutationImpl::drop_local_auth_pins();
 }
 
+const filepath& MDRequestImpl::get_filepath()
+{
+  if (client_request)
+    return client_request->get_filepath();
+  return more()->filepath1;
+}
+
+const filepath& MDRequestImpl::get_filepath2()
+{
+  if (client_request)
+    return client_request->get_filepath2();
+  return more()->filepath2;
+}
+
+void MDRequestImpl::set_filepath(const filepath& fp)
+{
+  assert(!client_request);
+  more()->filepath1 = fp;
+}
+void MDRequestImpl::set_filepath2(const filepath& fp)
+{
+  assert(!client_request);
+  more()->filepath2 = fp;
+}
+
 void MDRequestImpl::print(ostream &out)
 {
   out << "request(" << reqid;
index bcc1efe300bb0ef5db60dc4f670957e24fadf4e6..a7d8de98621270a8728567227f4dc65b06c52636 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "include/interval_set.h"
 #include "include/elist.h"
+#include "include/filepath.h"
 
 #include "mdstypes.h"
 
@@ -263,6 +264,10 @@ struct MDRequestImpl : public MutationImpl, public TrackedOp {
     CDir* export_dir;
     dirfrag_t fragment_base;
 
+    // for internal ops doing lookup
+    filepath filepath1;
+    filepath filepath2;
+
     More() : 
       has_journaled_slaves(false), slave_update_journaled(false),
       srcdn_auth_mds(-1), inode_import_v(0), rename_inode(0),
@@ -317,6 +322,10 @@ struct MDRequestImpl : public MutationImpl, public TrackedOp {
   void drop_local_auth_pins();
   void set_ambiguous_auth(CInode *inode);
   void clear_ambiguous_auth();
+  const filepath& get_filepath();
+  const filepath& get_filepath2();
+  void set_filepath(const filepath& fp);
+  void set_filepath2(const filepath& fp);
 
   void print(ostream &out);
 
index 22b00d7447569da84b91b3b6928aec4b1a2e50ce..9caea1102bd071f1eb8cbe70bb83b36ccdbbb916 100644 (file)
@@ -2169,8 +2169,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequestRef& mdr, int n,
                                    ceph_file_layout **layout,
                                    bool no_lookup)    // true if we cannot return a null dentry lease
 {
-  MClientRequest *req = mdr->client_request;
-  const filepath& refpath = n ? req->get_filepath2() : req->get_filepath();
+  const filepath& refpath = n ? mdr->get_filepath2() : mdr->get_filepath();
   dout(10) << "rdlock_path_pin_ref " << *mdr << " " << refpath << dendl;
 
   if (mdr->done_locking)
@@ -2262,8 +2261,7 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequestRef& mdr, int n,
                                          bool okexist, bool mustexist, bool alwaysxlock,
                                          ceph_file_layout **layout)
 {
-  MClientRequest *req = mdr->client_request;
-  const filepath& refpath = n ? req->get_filepath2() : req->get_filepath();
+  const filepath& refpath = n ? mdr->get_filepath2() : mdr->get_filepath();
 
   dout(10) << "rdlock_path_xlock_dentry " << *mdr << " " << refpath << dendl;