]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: stop doing unnecessary work in ll_lookup_inode
authorJeff Layton <jlayton@redhat.com>
Wed, 3 Feb 2021 13:12:41 +0000 (08:12 -0500)
committerNathan Cutler <ncutler@suse.com>
Wed, 26 May 2021 12:20:20 +0000 (14:20 +0200)
It's not clear to me why we're looking up the parent and name of the
inode in ll_lookup_inode, as we don't actually do anything with them.
Just return once we get an inode reference.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit 2b0b895e888c0f3dece3c1e717ca6e1552e588d8)

src/client/Client.cc

index c6d5b0c558563b0d15f5c2edb7707ad1c89ba2da..04f3a3d0547a3bb64378e7ffe80fa3fb36166f5e 100755 (executable)
@@ -10909,43 +10909,7 @@ int Client::ll_lookup_inode(
     return -ENOTCONN;
 
   // Num1: get inode and *inode
-  int r = _lookup_ino(ino, perms, inode);
-  if (r)
-    return r;
-
-  ceph_assert(*inode != NULL);
-
-  if (!(*inode)->dentries.empty()) {
-    ldout(cct, 8) << __func__ << " dentry already present" << dendl;
-    return 0;
-  }
-
-  if ((*inode)->is_root()) {
-    ldout(cct, 8) << "ino is root, no parent" << dendl;
-    return 0;
-  }
-
-  // Num2: Request the parent inode, so that we can look up the name
-  Inode *parent;
-  r = _lookup_parent(*inode, perms, &parent);
-  if (r) {
-    _ll_forget(*inode, 1);  
-    return r;
-  }
-
-  ceph_assert(parent != NULL);
-
-  // Num3: Finally, get the name (dentry) of the requested inode
-  r = _lookup_name(*inode, parent, perms);
-  if (r) {
-    // Unexpected error
-    _ll_forget(parent, 1);
-    _ll_forget(*inode, 1);
-    return r;
-  }
-
-  _ll_forget(parent, 1);
-  return 0;
+  return _lookup_ino(ino, perms, inode);
 }
 
 int Client::ll_lookupx(Inode *parent, const char *name, Inode **out,