From 360683edfd5401e3ceb84fe1cc1691780f665061 Mon Sep 17 00:00:00 2001 From: carlosm Date: Fri, 6 May 2005 18:58:52 +0000 Subject: [PATCH] Modified Files: client/Client.h partial for Client::lookup() -- UNTESTED (still doesn't work) git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@210 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/client/Client.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ceph/client/Client.h b/ceph/client/Client.h index 7f0bd5cc8187f..4bc75c7271ab0 100644 --- a/ceph/client/Client.h +++ b/ceph/client/Client.h @@ -121,22 +121,8 @@ class Client : public Dispatcher { // global semaphore/mutex protecting cache+fh structures // ?? - // -- metadata cache stuff - // find dentry based on filepath - Dentry *lookup(filepath* path) { - Inode *cur = root; - Dentry *dn; - for (int i=0; ibits.size(); i++) { - if (cur->dir.dentries.count(path->bits[i])) - dn = cur->dir.dentries[path->bits[i]]; - else - return NULL; - cur = dn->inode; - } - return dn; - } - + // decrease inode ref. delete if dangling. void put_inode(Inode *in) { in->put(); @@ -211,6 +197,21 @@ class Client : public Dispatcher { } } + // find dentry based on filepath + Dentry *lookup(filepath* path) { + Inode *cur = root; + Dentry *dn; + for (int i=0; idepth(); i++) { + Dir *dir = open_dir(cur); + if (dir->dentries.count(path[i])) + dn = dir->dentries[path[i]]; + else + return NULL; + cur = dn->inode; + } + return dn; + } + public: Client(MDCluster *mdc, int id, Messenger *m); ~Client(); -- 2.39.5