]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 8 Jul 2005 03:57:33 +0000 (03:57 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 8 Jul 2005 03:57:33 +0000 (03:57 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@421 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/client/Client.cc
ceph/client/Client.h
ceph/messages/MClientReply.h

index aa6e1acc055cfce7d03097585b25aa0ca231e9d2..607a4edc79dc63f035779856a1a6d4918b4cda79 100644 (file)
@@ -207,7 +207,7 @@ Inode* Client::insert_inode_info(Dir *dir, c_inode_info *in_info)
        dout(12) << " new dentry+node with ino " << in_info->inode.ino << endl;
   }
 
-  // OK!
+  // OK, we found it!
   assert(dn && dn->inode);
 
   // actually update info
@@ -222,7 +222,7 @@ Inode* Client::insert_inode_info(Dir *dir, c_inode_info *in_info)
 
   // take note of latest distribution on mds's
   dn->inode->mds_contacts = in_info->dist;
-  dn->inode->mds_auth = in_info->auth;
+  dn->inode->mds_dir_auth = in_info->dir_auth;
 
   return dn->inode;
 }
@@ -319,8 +319,8 @@ MClientReply *Client::make_request(MClientRequest *req, bool auth_best)
   }
   
   if (cur) {
-       if (auth_best) {
-         mds = cur->mds_auth;
+       if (auth_best) {  // hack fixme 
+         mds = cur->authority();
        } else {
          if (cur->mds_contacts.size()) {
                dout(9) << "contacting mds from deepest inode " << cur->inode.ino << " " << req->get_filepath() << ": " << cur->mds_contacts << endl;
@@ -333,7 +333,7 @@ MClientReply *Client::make_request(MClientRequest *req, bool auth_best)
                  mds = *it;
                }
          } else {
-               mds = cur->mds_auth;
+               mds = cur->authority();
          }
        }
   } else {
index eb0f931c904fe3aa27ce4a0e09a9f53260cb9e02..5a62c732a208f793a94cb27b0e7da79175beb2e9 100644 (file)
@@ -77,7 +77,7 @@ class Dir {
 class Inode {
  public:
   inode_t   inode;    // the actual inode
-  int       mds_auth;
+  int       mds_dir_auth;
   set<int>     mds_contacts;
   time_t    last_updated;
 
@@ -94,11 +94,19 @@ class Inode {
   void get() { ref++; }
   void put() { ref--; assert(ref >= 0); }
 
-  Inode() : ref(0), dir(0), dn(0), symlink(0), mds_auth(0) { }
+  Inode() : ref(0), dir(0), dn(0), symlink(0), mds_dir_auth(-1), last_updated(0) { }
   ~Inode() {
        if (symlink) { delete symlink; symlink = 0; }
   }
 
+  int authority() {
+       if (mds_dir_auth >= 0) 
+         return mds_dir_auth;
+       if (dn && dn->dir && dn->dir->parent_inode)
+         return dn->dir->parent_inode->authority();
+       return 0;  // who knows!
+  }
+
   // open Dir for an inode.  if it's not open, allocated it (and pin dentry in memory).
   Dir *open_dir() {
        if (!dir) {
index 316d8b9c6875e3b0261523290871384ac736999e..c30bb323e0120c926c94a174e3c33e4337bf88ac 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "msg/Message.h"
 #include "mds/CInode.h"
+#include "mds/CDir.h"
 #include "mds/CDentry.h"
 
 #include <vector>
@@ -41,7 +42,7 @@ class c_inode_info {
   bool inode_soft_valid;  // true if inode info is valid (ie was readable on mds at the time)
   bool inode_hard_valid;  // true if inode info is valid (ie was readable on mds at the time)
 
-  int      auth;
+  int      dir_auth;
   set<int> dist;    // where am i replicated?
 
 
@@ -60,7 +61,10 @@ class c_inode_info {
        this->ref_dn = ref_dn;
        
        // replicated where?
-       auth = in->authority();
+       if (in->dir) 
+         dir_auth = in->dir->get_dir_auth();
+       else 
+         dir_auth -1;
        in->get_dist_spec(this->dist, whoami, now);
   }
   
@@ -68,7 +72,7 @@ class c_inode_info {
        bl.append((char*)&inode, sizeof(inode));
        bl.append((char*)&inode_soft_valid, sizeof(inode_soft_valid));
        bl.append((char*)&inode_hard_valid, sizeof(inode_hard_valid));
-       bl.append((char*)&auth, sizeof(auth));
+       bl.append((char*)&dir_auth, sizeof(dir_auth));
 
        ::_encode(ref_dn, bl);
        ::_encode(symlink, bl);
@@ -82,8 +86,8 @@ class c_inode_info {
        off += sizeof(inode_soft_valid);
        bl.copy(off, sizeof(inode_hard_valid), (char*)&inode_hard_valid);
        off += sizeof(inode_hard_valid);
-       bl.copy(off, sizeof(auth), (char*)&auth);
-       off += sizeof(auth);
+       bl.copy(off, sizeof(dir_auth), (char*)&dir_auth);
+       off += sizeof(dir_auth);
 
        ::_decode(ref_dn, bl, off);
        ::_decode(symlink, bl, off);