Whamcloud - gitweb
LU-12137 osd-ldiskfs: shared common code for osd lookup 81/35581/4
authorJames Simmons <jsimmons@infradead.org>
Sat, 3 Aug 2019 19:25:33 +0000 (15:25 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 Aug 2019 07:54:53 +0000 (07:54 +0000)
For osd_lookup_one_len_unlocked() the only time we don't return
the found dentry is if is_bad_inode() is true. The test for
is_bad_inode() can only be run when d_inode is not NULL so
we can move the d_inode test. The other change is the drop of
the debug message which will just fill the logs with too much
chatter so remove it.

Change-Id: I82cf73ca842a45d906ffc21c9c5397a61c2679d8
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/35581
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_compat.c

index cab030a..fed4238 100644 (file)
@@ -85,10 +85,10 @@ struct dentry *osd_lookup_one_len_unlocked(const char *name,
        dchild = lookup_one_len(name, base, len);
        inode_unlock(base->d_inode);
 
-       if (IS_ERR(dchild) || dchild->d_inode == NULL)
+       if (IS_ERR(dchild))
                return dchild;
 
-       if (is_bad_inode(dchild->d_inode)) {
+       if (dchild->d_inode && unlikely(is_bad_inode(dchild->d_inode))) {
                CERROR("bad inode returned %lu/%u\n",
                       dchild->d_inode->i_ino, dchild->d_inode->i_generation);
                dput(dchild);
@@ -108,22 +108,7 @@ struct dentry *osd_lookup_one_len_unlocked(const char *name,
 struct dentry *osd_ios_lookup_one_len(const char *name, struct dentry *base,
                                      int len)
 {
-       struct dentry *dentry;
-
-       dentry = osd_lookup_one_len_unlocked(name, base, len);
-       if (IS_ERR(dentry)) {
-               int rc = PTR_ERR(dentry);
-
-               if (rc != -ENOENT)
-                       CERROR("Fail to find %.*s in %.*s (%lu/%u): rc = %d\n",
-                              len, name, base->d_name.len,
-                              base->d_name.name, base->d_inode->i_ino,
-                              base->d_inode->i_generation, rc);
-
-               return dentry;
-       }
-
-       return dentry;
+       return osd_lookup_one_len_unlocked(name, base, len);
 }
 
 /* utility to make a directory */