[PATCH 1/2] mds: use "open-by-ino" helper to handle LOOKUPINO request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Yan, Zheng" <zheng.z.yan@xxxxxxxxx>

Fixes #3541
Signed-off-by: Yan, Zheng <zheng.z.yan@xxxxxxxxx>
---
 src/mds/Server.cc | 38 ++++++++------------------------------
 src/mds/Server.h  |  1 -
 2 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 1d16d04..e84626b 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -2483,41 +2483,19 @@ void Server::handle_client_lookup_ino(MDRequest *mdr)
 void Server::_lookup_ino(MDRequest *mdr)
 {
   inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino " << mdr << " checking peers for ino " << ino << dendl;
-  mdcache->find_ino_peers(ino,
-			  new C_MDS_LookupIno2(this, mdr), -1);
+  dout(10) << "_lookup_ino " << mdr << " opening ino " << ino << dendl;
+  mdcache->open_ino(ino, (int64_t)-1, new C_MDS_LookupIno2(this, mdr), false);
 }
 
-struct C_MDS_LookupIno3 : public Context {
-  Server *server;
-  MDRequest *mdr;
-  C_MDS_LookupIno3(Server *s, MDRequest *r) : server(s), mdr(r) {}
-  void finish(int r) {
-    server->_lookup_ino_3(mdr, r);
-  }
-};
-
 void Server::_lookup_ino_2(MDRequest *mdr, int r)
 {
   inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino_2 " << mdr << " checked peers for ino " << ino
-	   << " and got r=" << r << dendl;
-  if (r == 0) {
-    dispatch_client_request(mdr);
-    return;
-  }
-
-  // okay fine, maybe it's a directory though...
-  mdcache->find_ino_dir(ino, new C_MDS_LookupIno3(this, mdr));
-}
-
-void Server::_lookup_ino_3(MDRequest *mdr, int r)
-{
-  inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino_3 " << mdr << " checked dir obj for ino " << ino
-	   << " and got r=" << r << dendl;
-  if (r == 0) {
-    dispatch_client_request(mdr);
+  dout(10) << "_lookup_ino_2 " << mdr << " ino " << ino << " r=" << r << dendl;
+  if (r >= 0) {
+    if (r == mds->get_nodeid())
+      dispatch_client_request(mdr);
+    else
+      mdcache->request_forward(mdr, r);
     return;
   }
 
diff --git a/src/mds/Server.h b/src/mds/Server.h
index 269b286..2da4055 100644
--- a/src/mds/Server.h
+++ b/src/mds/Server.h
@@ -146,7 +146,6 @@ public:
   void handle_client_lookup_ino(MDRequest *mdr);
   void _lookup_ino(MDRequest *mdr);
   void _lookup_ino_2(MDRequest *mdr, int r);
-  void _lookup_ino_3(MDRequest *mdr, int r);
   void handle_client_readdir(MDRequest *mdr);
   void handle_client_file_setlock(MDRequest *mdr);
   void handle_client_file_readlock(MDRequest *mdr);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux