Ocfs2: handle hole punching via fallocate properly
[deliverable/linux.git] / fs / dcache.c
index 9e6e6db76869b7770a8c8110698b40eae27a2d0d..0c6d5c549d840008b4dfff4e45e1aa6cbdcb88f8 100644 (file)
@@ -1320,6 +1320,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
                __dget_dlock(parent);
                dentry->d_parent = parent;
                dentry->d_sb = parent->d_sb;
+               d_set_d_op(dentry, dentry->d_sb->s_d_op);
                list_add(&dentry->d_u.d_child, &parent->d_subdirs);
                spin_unlock(&parent->d_lock);
        }
@@ -1335,6 +1336,7 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
        struct dentry *dentry = d_alloc(NULL, name);
        if (dentry) {
                dentry->d_sb = sb;
+               d_set_d_op(dentry, dentry->d_sb->s_d_op);
                dentry->d_parent = dentry;
                dentry->d_flags |= DCACHE_DISCONNECTED;
        }
@@ -1454,9 +1456,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
                        continue;
                if (alias->d_parent != entry->d_parent)
                        continue;
-               if (qstr->len != len)
-                       continue;
-               if (memcmp(qstr->name, name, len))
+               if (dentry_cmp(qstr->name, qstr->len, name, len))
                        continue;
                __dget(alias);
                return alias;
@@ -1509,6 +1509,7 @@ struct dentry * d_alloc_root(struct inode * root_inode)
                res = d_alloc(NULL, &name);
                if (res) {
                        res->d_sb = root_inode->i_sb;
+                       d_set_d_op(res, res->d_sb->s_d_op);
                        res->d_parent = res;
                        d_instantiate(res, root_inode);
                }
@@ -1569,6 +1570,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
        /* attach a disconnected dentry */
        spin_lock(&tmp->d_lock);
        tmp->d_sb = inode->i_sb;
+       d_set_d_op(tmp, tmp->d_sb->s_d_op);
        tmp->d_inode = inode;
        tmp->d_flags |= DCACHE_DISCONNECTED;
        list_add(&tmp->d_alias, &inode->i_dentry);
@@ -1793,6 +1795,9 @@ seqretry:
                tlen = dentry->d_name.len;
                tname = dentry->d_name.name;
                i = dentry->d_inode;
+               prefetch(tname);
+               if (i)
+                       prefetch(i);
                /*
                 * This seqcount check is required to ensure name and
                 * len are loaded atomically, so as not to walk off the
@@ -1807,9 +1812,7 @@ seqretry:
                                                tlen, tname, name))
                                continue;
                } else {
-                       if (tlen != len)
-                               continue;
-                       if (memcmp(tname, str, tlen))
+                       if (dentry_cmp(tname, tlen, str, len))
                                continue;
                }
                /*
@@ -1922,9 +1925,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
                                                tlen, tname, name))
                                goto next;
                } else {
-                       if (tlen != len)
-                               goto next;
-                       if (memcmp(tname, str, tlen))
+                       if (dentry_cmp(tname, tlen, str, len))
                                goto next;
                }
 
@@ -1969,7 +1970,7 @@ out:
 /**
  * d_validate - verify dentry provided from insecure source (deprecated)
  * @dentry: The dentry alleged to be valid child of @dparent
- * @dparent: The parent dentry (known to be valid)
+ * @parent: The parent dentry (known to be valid)
  *
  * An insecure source has sent us a dentry, here we verify it and dget() it.
  * This is used by ncpfs in its readdir implementation.
@@ -2452,8 +2453,7 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name)
 }
 
 /**
- * Prepend path string to a buffer
- *
+ * prepend_path - Prepend path string to a buffer
  * @path: the dentry/vfsmount to report
  * @root: root vfsmnt/dentry (may be modified by this function)
  * @buffer: pointer to the end of the buffer
This page took 0.025084 seconds and 5 git commands to generate.