fs: dcache reduce branches in lookup path
[deliverable/linux.git] / drivers / staging / smbfs / dir.c
index f088ea2f6ac9f27991d605b4093666d1a3d0843c..78f09412740c0b1b2400bd54fd3de8c2dce8bf3b 100644 (file)
@@ -274,9 +274,13 @@ smb_dir_open(struct inode *dir, struct file *file)
  * Dentry operations routines
  */
 static int smb_lookup_validate(struct dentry *, struct nameidata *);
-static int smb_hash_dentry(struct dentry *, struct qstr *);
-static int smb_compare_dentry(struct dentry *, struct qstr *, struct qstr *);
-static int smb_delete_dentry(struct dentry *);
+static int smb_hash_dentry(const struct dentry *, const struct inode *,
+               struct qstr *);
+static int smb_compare_dentry(const struct dentry *,
+               const struct inode *,
+               const struct dentry *, const struct inode *,
+               unsigned int, const char *, const struct qstr *);
+static int smb_delete_dentry(const struct dentry *);
 
 static const struct dentry_operations smbfs_dentry_operations =
 {
@@ -333,7 +337,8 @@ smb_lookup_validate(struct dentry * dentry, struct nameidata *nd)
 }
 
 static int 
-smb_hash_dentry(struct dentry *dir, struct qstr *this)
+smb_hash_dentry(const struct dentry *dir, const struct inode *inode,
+               struct qstr *this)
 {
        unsigned long hash;
        int i;
@@ -347,14 +352,17 @@ smb_hash_dentry(struct dentry *dir, struct qstr *this)
 }
 
 static int
-smb_compare_dentry(struct dentry *dir, struct qstr *a, struct qstr *b)
+smb_compare_dentry(const struct dentry *parent,
+               const struct inode *pinode,
+               const struct dentry *dentry, const struct inode *inode,
+               unsigned int len, const char *str, const struct qstr *name)
 {
        int i, result = 1;
 
-       if (a->len != b->len)
+       if (len != name->len)
                goto out;
-       for (i=0; i < a->len; i++) {
-               if (tolower(a->name[i]) != tolower(b->name[i]))
+       for (i=0; i < len; i++) {
+               if (tolower(str[i]) != tolower(name->name[i]))
                        goto out;
        }
        result = 0;
@@ -367,7 +375,7 @@ out:
  * We use this to unhash dentries with bad inodes.
  */
 static int
-smb_delete_dentry(struct dentry * dentry)
+smb_delete_dentry(const struct dentry *dentry)
 {
        if (dentry->d_inode) {
                if (is_bad_inode(dentry->d_inode)) {
@@ -390,9 +398,9 @@ smb_new_dentry(struct dentry *dentry)
        struct smb_sb_info *server = server_from_dentry(dentry);
 
        if (server->mnt->flags & SMB_MOUNT_CASE)
-               dentry->d_op = &smbfs_dentry_operations_case;
+               d_set_d_op(dentry, &smbfs_dentry_operations_case);
        else
-               dentry->d_op = &smbfs_dentry_operations;
+               d_set_d_op(dentry, &smbfs_dentry_operations);
        dentry->d_time = jiffies;
 }
 
@@ -454,9 +462,9 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
        add_entry:
                        server = server_from_dentry(dentry);
                        if (server->mnt->flags & SMB_MOUNT_CASE)
-                               dentry->d_op = &smbfs_dentry_operations_case;
+                               d_set_d_op(dentry, &smbfs_dentry_operations_case);
                        else
-                               dentry->d_op = &smbfs_dentry_operations;
+                               d_set_d_op(dentry, &smbfs_dentry_operations);
 
                        d_add(dentry, inode);
                        smb_renew_times(dentry);
This page took 0.029486 seconds and 5 git commands to generate.