Whamcloud - gitweb
LU-12635 build: Support for gcc -Wimplicit-fallthrough
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index b8fcc59..fed4238 100644 (file)
@@ -75,8 +75,6 @@ static void osd_push_ctxt(const struct osd_device *dev,
  *
  * This should be called without the parent
  * i_mutex held, and will take the i_mutex itself.
- *
- * Unlike osd_lookup_one_len dentry with NULL d_inode is valid
  */
 struct dentry *osd_lookup_one_len_unlocked(const char *name,
                                           struct dentry *base, int len)
@@ -87,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);
@@ -106,34 +104,11 @@ struct dentry *osd_lookup_one_len_unlocked(const char *name,
  * @name:      pathname component to lookup
  * @base:      base directory to lookup from
  * @len:       maximum length @len should be interpreted to
- *
- * Treat found dentry with NULL d_inode as an -ENOENT error so LFSCK
- * can repair the file.
  */
 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;
-       }
-
-       if (dentry->d_inode == NULL) {
-               dput(dentry);
-               return ERR_PTR(-ENOENT);
-       }
-
-       return dentry;
+       return osd_lookup_one_len_unlocked(name, base, len);
 }
 
 /* utility to make a directory */