aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kernel/perfmon.c2
-rw-r--r--drivers/staging/autofs/root.c2
-rw-r--r--drivers/staging/smbfs/dir.c8
-rw-r--r--fs/9p/vfs_inode.c26
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/adfs/super.c2
-rw-r--r--fs/affs/namei.c2
-rw-r--r--fs/affs/super.c2
-rw-r--r--fs/afs/dir.c2
-rw-r--r--fs/anon_inodes.c2
-rw-r--r--fs/autofs4/inode.c2
-rw-r--r--fs/autofs4/root.c10
-rw-r--r--fs/btrfs/export.c4
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/ceph/dir.c6
-rw-r--r--fs/cifs/dir.c16
-rw-r--r--fs/cifs/inode.c8
-rw-r--r--fs/cifs/link.c4
-rw-r--r--fs/cifs/readdir.c4
-rw-r--r--fs/coda/dir.c2
-rw-r--r--fs/configfs/dir.c8
-rw-r--r--fs/dcache.c30
-rw-r--r--fs/ecryptfs/inode.c2
-rw-r--r--fs/ecryptfs/main.c4
-rw-r--r--fs/fat/inode.c4
-rw-r--r--fs/fat/namei_msdos.c6
-rw-r--r--fs/fat/namei_vfat.c8
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--fs/gfs2/export.c4
-rw-r--r--fs/gfs2/ops_fstype.c2
-rw-r--r--fs/gfs2/ops_inode.c2
-rw-r--r--fs/hfs/dir.c2
-rw-r--r--fs/hfs/super.c2
-rw-r--r--fs/hfsplus/dir.c2
-rw-r--r--fs/hfsplus/super.c2
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hpfs/dentry.c2
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/isofs/namei.c2
-rw-r--r--fs/jfs/namei.c4
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/minix/namei.c2
-rw-r--r--fs/namei.c31
-rw-r--r--fs/ncpfs/dir.c4
-rw-r--r--fs/ncpfs/inode.c2
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/getroot.c4
-rw-r--r--fs/ocfs2/export.c4
-rw-r--r--fs/ocfs2/namei.c10
-rw-r--r--fs/pipe.c2
-rw-r--r--fs/proc/base.c12
-rw-r--r--fs/proc/generic.c2
-rw-r--r--fs/proc/proc_sysctl.c4
-rw-r--r--fs/reiserfs/xattr.c2
-rw-r--r--fs/sysfs/dir.c2
-rw-r--r--fs/sysv/namei.c2
-rw-r--r--fs/sysv/super.c2
-rw-r--r--include/linux/dcache.h6
-rw-r--r--kernel/cgroup.c2
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/rpc_pipe.c2
63 files changed, 174 insertions, 137 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index d39d8a53b579..5a24f40bb48e 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2233,7 +2233,7 @@ pfm_alloc_file(pfm_context_t *ctx)
2233 } 2233 }
2234 path.mnt = mntget(pfmfs_mnt); 2234 path.mnt = mntget(pfmfs_mnt);
2235 2235
2236 path.dentry->d_op = &pfmfs_dentry_operations; 2236 d_set_d_op(path.dentry, &pfmfs_dentry_operations);
2237 d_add(path.dentry, inode); 2237 d_add(path.dentry, inode);
2238 2238
2239 file = alloc_file(&path, FMODE_READ, &pfm_file_ops); 2239 file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
diff --git a/drivers/staging/autofs/root.c b/drivers/staging/autofs/root.c
index 0fdec4befd84..b09adb57971f 100644
--- a/drivers/staging/autofs/root.c
+++ b/drivers/staging/autofs/root.c
@@ -237,7 +237,7 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr
237 * 237 *
238 * We need to do this before we release the directory semaphore. 238 * We need to do this before we release the directory semaphore.
239 */ 239 */
240 dentry->d_op = &autofs_dentry_operations; 240 d_set_d_op(dentry, &autofs_dentry_operations);
241 dentry->d_flags |= DCACHE_AUTOFS_PENDING; 241 dentry->d_flags |= DCACHE_AUTOFS_PENDING;
242 d_add(dentry, NULL); 242 d_add(dentry, NULL);
243 243
diff --git a/drivers/staging/smbfs/dir.c b/drivers/staging/smbfs/dir.c
index 5f79799d5d4a..78f09412740c 100644
--- a/drivers/staging/smbfs/dir.c
+++ b/drivers/staging/smbfs/dir.c
@@ -398,9 +398,9 @@ smb_new_dentry(struct dentry *dentry)
398 struct smb_sb_info *server = server_from_dentry(dentry); 398 struct smb_sb_info *server = server_from_dentry(dentry);
399 399
400 if (server->mnt->flags & SMB_MOUNT_CASE) 400 if (server->mnt->flags & SMB_MOUNT_CASE)
401 dentry->d_op = &smbfs_dentry_operations_case; 401 d_set_d_op(dentry, &smbfs_dentry_operations_case);
402 else 402 else
403 dentry->d_op = &smbfs_dentry_operations; 403 d_set_d_op(dentry, &smbfs_dentry_operations);
404 dentry->d_time = jiffies; 404 dentry->d_time = jiffies;
405} 405}
406 406
@@ -462,9 +462,9 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
462 add_entry: 462 add_entry:
463 server = server_from_dentry(dentry); 463 server = server_from_dentry(dentry);
464 if (server->mnt->flags & SMB_MOUNT_CASE) 464 if (server->mnt->flags & SMB_MOUNT_CASE)
465 dentry->d_op = &smbfs_dentry_operations_case; 465 d_set_d_op(dentry, &smbfs_dentry_operations_case);
466 else 466 else
467 dentry->d_op = &smbfs_dentry_operations; 467 d_set_d_op(dentry, &smbfs_dentry_operations);
468 468
469 d_add(dentry, inode); 469 d_add(dentry, inode);
470 smb_renew_times(dentry); 470 smb_renew_times(dentry);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index f6f9081e6d2c..df8bbb358d54 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -635,9 +635,9 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
635 } 635 }
636 636
637 if (v9ses->cache) 637 if (v9ses->cache)
638 dentry->d_op = &v9fs_cached_dentry_operations; 638 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
639 else 639 else
640 dentry->d_op = &v9fs_dentry_operations; 640 d_set_d_op(dentry, &v9fs_dentry_operations);
641 641
642 d_instantiate(dentry, inode); 642 d_instantiate(dentry, inode);
643 err = v9fs_fid_add(dentry, fid); 643 err = v9fs_fid_add(dentry, fid);
@@ -749,7 +749,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
749 err); 749 err);
750 goto error; 750 goto error;
751 } 751 }
752 dentry->d_op = &v9fs_cached_dentry_operations; 752 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
753 d_instantiate(dentry, inode); 753 d_instantiate(dentry, inode);
754 err = v9fs_fid_add(dentry, fid); 754 err = v9fs_fid_add(dentry, fid);
755 if (err < 0) 755 if (err < 0)
@@ -767,7 +767,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
767 err = PTR_ERR(inode); 767 err = PTR_ERR(inode);
768 goto error; 768 goto error;
769 } 769 }
770 dentry->d_op = &v9fs_dentry_operations; 770 d_set_d_op(dentry, &v9fs_dentry_operations);
771 d_instantiate(dentry, inode); 771 d_instantiate(dentry, inode);
772 } 772 }
773 /* Now set the ACL based on the default value */ 773 /* Now set the ACL based on the default value */
@@ -956,7 +956,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
956 err); 956 err);
957 goto error; 957 goto error;
958 } 958 }
959 dentry->d_op = &v9fs_cached_dentry_operations; 959 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
960 d_instantiate(dentry, inode); 960 d_instantiate(dentry, inode);
961 err = v9fs_fid_add(dentry, fid); 961 err = v9fs_fid_add(dentry, fid);
962 if (err < 0) 962 if (err < 0)
@@ -973,7 +973,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
973 err = PTR_ERR(inode); 973 err = PTR_ERR(inode);
974 goto error; 974 goto error;
975 } 975 }
976 dentry->d_op = &v9fs_dentry_operations; 976 d_set_d_op(dentry, &v9fs_dentry_operations);
977 d_instantiate(dentry, inode); 977 d_instantiate(dentry, inode);
978 } 978 }
979 /* Now set the ACL based on the default value */ 979 /* Now set the ACL based on the default value */
@@ -1041,9 +1041,9 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
1041 1041
1042inst_out: 1042inst_out:
1043 if (v9ses->cache) 1043 if (v9ses->cache)
1044 dentry->d_op = &v9fs_cached_dentry_operations; 1044 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
1045 else 1045 else
1046 dentry->d_op = &v9fs_dentry_operations; 1046 d_set_d_op(dentry, &v9fs_dentry_operations);
1047 1047
1048 d_add(dentry, inode); 1048 d_add(dentry, inode);
1049 return NULL; 1049 return NULL;
@@ -1709,7 +1709,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
1709 err); 1709 err);
1710 goto error; 1710 goto error;
1711 } 1711 }
1712 dentry->d_op = &v9fs_cached_dentry_operations; 1712 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
1713 d_instantiate(dentry, inode); 1713 d_instantiate(dentry, inode);
1714 err = v9fs_fid_add(dentry, fid); 1714 err = v9fs_fid_add(dentry, fid);
1715 if (err < 0) 1715 if (err < 0)
@@ -1722,7 +1722,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
1722 err = PTR_ERR(inode); 1722 err = PTR_ERR(inode);
1723 goto error; 1723 goto error;
1724 } 1724 }
1725 dentry->d_op = &v9fs_dentry_operations; 1725 d_set_d_op(dentry, &v9fs_dentry_operations);
1726 d_instantiate(dentry, inode); 1726 d_instantiate(dentry, inode);
1727 } 1727 }
1728 1728
@@ -1856,7 +1856,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
1856 ihold(old_dentry->d_inode); 1856 ihold(old_dentry->d_inode);
1857 } 1857 }
1858 1858
1859 dentry->d_op = old_dentry->d_op; 1859 d_set_d_op(dentry, old_dentry->d_op);
1860 d_instantiate(dentry, old_dentry->d_inode); 1860 d_instantiate(dentry, old_dentry->d_inode);
1861 1861
1862 return err; 1862 return err;
@@ -1980,7 +1980,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
1980 err); 1980 err);
1981 goto error; 1981 goto error;
1982 } 1982 }
1983 dentry->d_op = &v9fs_cached_dentry_operations; 1983 d_set_d_op(dentry, &v9fs_cached_dentry_operations);
1984 d_instantiate(dentry, inode); 1984 d_instantiate(dentry, inode);
1985 err = v9fs_fid_add(dentry, fid); 1985 err = v9fs_fid_add(dentry, fid);
1986 if (err < 0) 1986 if (err < 0)
@@ -1996,7 +1996,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
1996 err = PTR_ERR(inode); 1996 err = PTR_ERR(inode);
1997 goto error; 1997 goto error;
1998 } 1998 }
1999 dentry->d_op = &v9fs_dentry_operations; 1999 d_set_d_op(dentry, &v9fs_dentry_operations);
2000 d_instantiate(dentry, inode); 2000 d_instantiate(dentry, inode);
2001 } 2001 }
2002 /* Now set the ACL based on the default value */ 2002 /* Now set the ACL based on the default value */
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index a11e5e102716..bf7693c384f9 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -276,7 +276,7 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
276 struct object_info obj; 276 struct object_info obj;
277 int error; 277 int error;
278 278
279 dentry->d_op = &adfs_dentry_operations; 279 d_set_d_op(dentry, &adfs_dentry_operations);
280 lock_kernel(); 280 lock_kernel();
281 error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj); 281 error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj);
282 if (error == 0) { 282 if (error == 0) {
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 47dffc513a26..a4041b52fbca 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -484,7 +484,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
484 adfs_error(sb, "get root inode failed\n"); 484 adfs_error(sb, "get root inode failed\n");
485 goto error; 485 goto error;
486 } else 486 } else
487 sb->s_root->d_op = &adfs_dentry_operations; 487 d_set_d_op(sb->s_root, &adfs_dentry_operations);
488 unlock_kernel(); 488 unlock_kernel();
489 return 0; 489 return 0;
490 490
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 5aca08c21100..944a4042fb65 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -240,7 +240,7 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
240 if (IS_ERR(inode)) 240 if (IS_ERR(inode))
241 return ERR_CAST(inode); 241 return ERR_CAST(inode);
242 } 242 }
243 dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations; 243 d_set_d_op(dentry, AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations);
244 d_add(dentry, inode); 244 d_add(dentry, inode);
245 return NULL; 245 return NULL;
246} 246}
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 4c18fcfb0a19..d39081bbe7ce 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -482,7 +482,7 @@ got_root:
482 printk(KERN_ERR "AFFS: Get root inode failed\n"); 482 printk(KERN_ERR "AFFS: Get root inode failed\n");
483 goto out_error; 483 goto out_error;
484 } 484 }
485 sb->s_root->d_op = &affs_dentry_operations; 485 d_set_d_op(sb->s_root, &affs_dentry_operations);
486 486
487 pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); 487 pr_debug("AFFS: s_flags=%lX\n",sb->s_flags);
488 return 0; 488 return 0;
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 2c18cde27000..b8bb7e7148d0 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -581,7 +581,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
581 } 581 }
582 582
583success: 583success:
584 dentry->d_op = &afs_fs_dentry_operations; 584 d_set_d_op(dentry, &afs_fs_dentry_operations);
585 585
586 d_add(dentry, inode); 586 d_add(dentry, inode);
587 _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }", 587 _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }",
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 57ce55b2564c..aca8806fa206 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -113,7 +113,7 @@ struct file *anon_inode_getfile(const char *name,
113 */ 113 */
114 ihold(anon_inode_inode); 114 ihold(anon_inode_inode);
115 115
116 path.dentry->d_op = &anon_inodefs_dentry_operations; 116 d_set_d_op(path.dentry, &anon_inodefs_dentry_operations);
117 d_instantiate(path.dentry, anon_inode_inode); 117 d_instantiate(path.dentry, anon_inode_inode);
118 118
119 error = -ENFILE; 119 error = -ENFILE;
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index ac87e49fa706..a7bdb9dcac84 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -309,7 +309,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
309 goto fail_iput; 309 goto fail_iput;
310 pipe = NULL; 310 pipe = NULL;
311 311
312 root->d_op = &autofs4_sb_dentry_operations; 312 d_set_d_op(root, &autofs4_sb_dentry_operations);
313 root->d_fsdata = ino; 313 root->d_fsdata = ino;
314 314
315 /* Can this call block? */ 315 /* Can this call block? */
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 10ca68a96dc7..bfe3f2eb684d 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -571,7 +571,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
571 * we check for the hashed dentry and return the newly 571 * we check for the hashed dentry and return the newly
572 * hashed dentry. 572 * hashed dentry.
573 */ 573 */
574 dentry->d_op = &autofs4_root_dentry_operations; 574 d_set_d_op(dentry, &autofs4_root_dentry_operations);
575 575
576 /* 576 /*
577 * And we need to ensure that the same dentry is used for 577 * And we need to ensure that the same dentry is used for
@@ -710,9 +710,9 @@ static int autofs4_dir_symlink(struct inode *dir,
710 d_add(dentry, inode); 710 d_add(dentry, inode);
711 711
712 if (dir == dir->i_sb->s_root->d_inode) 712 if (dir == dir->i_sb->s_root->d_inode)
713 dentry->d_op = &autofs4_root_dentry_operations; 713 d_set_d_op(dentry, &autofs4_root_dentry_operations);
714 else 714 else
715 dentry->d_op = &autofs4_dentry_operations; 715 d_set_d_op(dentry, &autofs4_dentry_operations);
716 716
717 dentry->d_fsdata = ino; 717 dentry->d_fsdata = ino;
718 ino->dentry = dget(dentry); 718 ino->dentry = dget(dentry);
@@ -845,9 +845,9 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
845 d_add(dentry, inode); 845 d_add(dentry, inode);
846 846
847 if (dir == dir->i_sb->s_root->d_inode) 847 if (dir == dir->i_sb->s_root->d_inode)
848 dentry->d_op = &autofs4_root_dentry_operations; 848 d_set_d_op(dentry, &autofs4_root_dentry_operations);
849 else 849 else
850 dentry->d_op = &autofs4_dentry_operations; 850 d_set_d_op(dentry, &autofs4_dentry_operations);
851 851
852 dentry->d_fsdata = ino; 852 dentry->d_fsdata = ino;
853 ino->dentry = dget(dentry); 853 ino->dentry = dget(dentry);
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 659f532d26a0..0ccf9a8afcdf 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -110,7 +110,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
110 110
111 dentry = d_obtain_alias(inode); 111 dentry = d_obtain_alias(inode);
112 if (!IS_ERR(dentry)) 112 if (!IS_ERR(dentry))
113 dentry->d_op = &btrfs_dentry_operations; 113 d_set_d_op(dentry, &btrfs_dentry_operations);
114 return dentry; 114 return dentry;
115fail: 115fail:
116 srcu_read_unlock(&fs_info->subvol_srcu, index); 116 srcu_read_unlock(&fs_info->subvol_srcu, index);
@@ -225,7 +225,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
225 key.offset = 0; 225 key.offset = 0;
226 dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL)); 226 dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
227 if (!IS_ERR(dentry)) 227 if (!IS_ERR(dentry))
228 dentry->d_op = &btrfs_dentry_operations; 228 d_set_d_op(dentry, &btrfs_dentry_operations);
229 return dentry; 229 return dentry;
230fail: 230fail:
231 btrfs_free_path(path); 231 btrfs_free_path(path);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f9d2994a42a2..63e4546b478a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4084,7 +4084,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
4084 int index; 4084 int index;
4085 int ret; 4085 int ret;
4086 4086
4087 dentry->d_op = &btrfs_dentry_operations; 4087 d_set_d_op(dentry, &btrfs_dentry_operations);
4088 4088
4089 if (dentry->d_name.len > BTRFS_NAME_LEN) 4089 if (dentry->d_name.len > BTRFS_NAME_LEN)
4090 return ERR_PTR(-ENAMETOOLONG); 4090 return ERR_PTR(-ENAMETOOLONG);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 58abc3da6111..cc01cf826769 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -42,11 +42,11 @@ int ceph_init_dentry(struct dentry *dentry)
42 42
43 if (dentry->d_parent == NULL || /* nfs fh_to_dentry */ 43 if (dentry->d_parent == NULL || /* nfs fh_to_dentry */
44 ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) 44 ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
45 dentry->d_op = &ceph_dentry_ops; 45 d_set_d_op(dentry, &ceph_dentry_ops);
46 else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) 46 else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR)
47 dentry->d_op = &ceph_snapdir_dentry_ops; 47 d_set_d_op(dentry, &ceph_snapdir_dentry_ops);
48 else 48 else
49 dentry->d_op = &ceph_snap_dentry_ops; 49 d_set_d_op(dentry, &ceph_snap_dentry_ops);
50 50
51 di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); 51 di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO);
52 if (!di) 52 if (!di)
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 88bfe686ac00..e3b10ca6d453 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -135,9 +135,9 @@ static void setup_cifs_dentry(struct cifsTconInfo *tcon,
135 struct inode *newinode) 135 struct inode *newinode)
136{ 136{
137 if (tcon->nocase) 137 if (tcon->nocase)
138 direntry->d_op = &cifs_ci_dentry_ops; 138 d_set_d_op(direntry, &cifs_ci_dentry_ops);
139 else 139 else
140 direntry->d_op = &cifs_dentry_ops; 140 d_set_d_op(direntry, &cifs_dentry_ops);
141 d_instantiate(direntry, newinode); 141 d_instantiate(direntry, newinode);
142} 142}
143 143
@@ -421,9 +421,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
421 rc = cifs_get_inode_info_unix(&newinode, full_path, 421 rc = cifs_get_inode_info_unix(&newinode, full_path,
422 inode->i_sb, xid); 422 inode->i_sb, xid);
423 if (pTcon->nocase) 423 if (pTcon->nocase)
424 direntry->d_op = &cifs_ci_dentry_ops; 424 d_set_d_op(direntry, &cifs_ci_dentry_ops);
425 else 425 else
426 direntry->d_op = &cifs_dentry_ops; 426 d_set_d_op(direntry, &cifs_dentry_ops);
427 427
428 if (rc == 0) 428 if (rc == 0)
429 d_instantiate(direntry, newinode); 429 d_instantiate(direntry, newinode);
@@ -604,9 +604,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
604 604
605 if ((rc == 0) && (newInode != NULL)) { 605 if ((rc == 0) && (newInode != NULL)) {
606 if (pTcon->nocase) 606 if (pTcon->nocase)
607 direntry->d_op = &cifs_ci_dentry_ops; 607 d_set_d_op(direntry, &cifs_ci_dentry_ops);
608 else 608 else
609 direntry->d_op = &cifs_dentry_ops; 609 d_set_d_op(direntry, &cifs_dentry_ops);
610 d_add(direntry, newInode); 610 d_add(direntry, newInode);
611 if (posix_open) { 611 if (posix_open) {
612 filp = lookup_instantiate_filp(nd, direntry, 612 filp = lookup_instantiate_filp(nd, direntry,
@@ -634,9 +634,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
634 rc = 0; 634 rc = 0;
635 direntry->d_time = jiffies; 635 direntry->d_time = jiffies;
636 if (pTcon->nocase) 636 if (pTcon->nocase)
637 direntry->d_op = &cifs_ci_dentry_ops; 637 d_set_d_op(direntry, &cifs_ci_dentry_ops);
638 else 638 else
639 direntry->d_op = &cifs_dentry_ops; 639 d_set_d_op(direntry, &cifs_dentry_ops);
640 d_add(direntry, NULL); 640 d_add(direntry, NULL);
641 /* if it was once a directory (but how can we tell?) we could do 641 /* if it was once a directory (but how can we tell?) we could do
642 shrink_dcache_parent(direntry); */ 642 shrink_dcache_parent(direntry); */
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 99b9a2cc14b7..2a239d878e85 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1319,9 +1319,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1319 to set uid/gid */ 1319 to set uid/gid */
1320 inc_nlink(inode); 1320 inc_nlink(inode);
1321 if (pTcon->nocase) 1321 if (pTcon->nocase)
1322 direntry->d_op = &cifs_ci_dentry_ops; 1322 d_set_d_op(direntry, &cifs_ci_dentry_ops);
1323 else 1323 else
1324 direntry->d_op = &cifs_dentry_ops; 1324 d_set_d_op(direntry, &cifs_dentry_ops);
1325 1325
1326 cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); 1326 cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb);
1327 cifs_fill_uniqueid(inode->i_sb, &fattr); 1327 cifs_fill_uniqueid(inode->i_sb, &fattr);
@@ -1363,9 +1363,9 @@ mkdir_get_info:
1363 inode->i_sb, xid, NULL); 1363 inode->i_sb, xid, NULL);
1364 1364
1365 if (pTcon->nocase) 1365 if (pTcon->nocase)
1366 direntry->d_op = &cifs_ci_dentry_ops; 1366 d_set_d_op(direntry, &cifs_ci_dentry_ops);
1367 else 1367 else
1368 direntry->d_op = &cifs_dentry_ops; 1368 d_set_d_op(direntry, &cifs_dentry_ops);
1369 d_instantiate(direntry, newinode); 1369 d_instantiate(direntry, newinode);
1370 /* setting nlink not necessary except in cases where we 1370 /* setting nlink not necessary except in cases where we
1371 * failed to get it from the server or was set bogus */ 1371 * failed to get it from the server or was set bogus */
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 85cdbf831e7b..fe2f6a93c49e 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -525,9 +525,9 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
525 rc); 525 rc);
526 } else { 526 } else {
527 if (pTcon->nocase) 527 if (pTcon->nocase)
528 direntry->d_op = &cifs_ci_dentry_ops; 528 d_set_d_op(direntry, &cifs_ci_dentry_ops);
529 else 529 else
530 direntry->d_op = &cifs_dentry_ops; 530 d_set_d_op(direntry, &cifs_dentry_ops);
531 d_instantiate(direntry, newinode); 531 d_instantiate(direntry, newinode);
532 } 532 }
533 } 533 }
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index ee463aeca0b0..ec5b68e3b928 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -103,9 +103,9 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
103 } 103 }
104 104
105 if (cifs_sb_master_tcon(CIFS_SB(sb))->nocase) 105 if (cifs_sb_master_tcon(CIFS_SB(sb))->nocase)
106 dentry->d_op = &cifs_ci_dentry_ops; 106 d_set_d_op(dentry, &cifs_ci_dentry_ops);
107 else 107 else
108 dentry->d_op = &cifs_dentry_ops; 108 d_set_d_op(dentry, &cifs_dentry_ops);
109 109
110 alias = d_materialise_unique(dentry, inode); 110 alias = d_materialise_unique(dentry, inode);
111 if (alias != NULL) { 111 if (alias != NULL) {
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 9e37e8bc9b89..aa40c811f8d2 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -125,7 +125,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
125 return ERR_PTR(error); 125 return ERR_PTR(error);
126 126
127exit: 127exit:
128 entry->d_op = &coda_dentry_operations; 128 d_set_d_op(entry, &coda_dentry_operations);
129 129
130 if (inode && (type & CODA_NOCACHE)) 130 if (inode && (type & CODA_NOCACHE))
131 coda_flag_inode(inode, C_VATTR | C_PURGE); 131 coda_flag_inode(inode, C_VATTR | C_PURGE);
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index e9acea440ffc..36637a8c1ed3 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -442,7 +442,7 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
442 return error; 442 return error;
443 } 443 }
444 444
445 dentry->d_op = &configfs_dentry_ops; 445 d_set_d_op(dentry, &configfs_dentry_ops);
446 d_rehash(dentry); 446 d_rehash(dentry);
447 447
448 return 0; 448 return 0;
@@ -489,7 +489,7 @@ static struct dentry * configfs_lookup(struct inode *dir,
489 */ 489 */
490 if (dentry->d_name.len > NAME_MAX) 490 if (dentry->d_name.len > NAME_MAX)
491 return ERR_PTR(-ENAMETOOLONG); 491 return ERR_PTR(-ENAMETOOLONG);
492 dentry->d_op = &configfs_dentry_ops; 492 d_set_d_op(dentry, &configfs_dentry_ops);
493 d_add(dentry, NULL); 493 d_add(dentry, NULL);
494 return NULL; 494 return NULL;
495 } 495 }
@@ -683,7 +683,7 @@ static int create_default_group(struct config_group *parent_group,
683 ret = -ENOMEM; 683 ret = -ENOMEM;
684 child = d_alloc(parent, &name); 684 child = d_alloc(parent, &name);
685 if (child) { 685 if (child) {
686 child->d_op = &configfs_dentry_ops; 686 d_set_d_op(child, &configfs_dentry_ops);
687 d_add(child, NULL); 687 d_add(child, NULL);
688 688
689 ret = configfs_attach_group(&parent_group->cg_item, 689 ret = configfs_attach_group(&parent_group->cg_item,
@@ -1681,7 +1681,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1681 err = -ENOMEM; 1681 err = -ENOMEM;
1682 dentry = d_alloc(configfs_sb->s_root, &name); 1682 dentry = d_alloc(configfs_sb->s_root, &name);
1683 if (dentry) { 1683 if (dentry) {
1684 dentry->d_op = &configfs_dentry_ops; 1684 d_set_d_op(dentry, &configfs_dentry_ops);
1685 d_add(dentry, NULL); 1685 d_add(dentry, NULL);
1686 1686
1687 err = configfs_attach_group(sd->s_element, &group->cg_item, 1687 err = configfs_attach_group(sd->s_element, &group->cg_item,
diff --git a/fs/dcache.c b/fs/dcache.c
index 1d5cf511e1c7..f9693da3efbd 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -398,7 +398,7 @@ repeat:
398 return; 398 return;
399 } 399 }
400 400
401 if (dentry->d_op && dentry->d_op->d_delete) { 401 if (dentry->d_flags & DCACHE_OP_DELETE) {
402 if (dentry->d_op->d_delete(dentry)) 402 if (dentry->d_op->d_delete(dentry))
403 goto kill_it; 403 goto kill_it;
404 } 404 }
@@ -1301,6 +1301,28 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name)
1301} 1301}
1302EXPORT_SYMBOL(d_alloc_name); 1302EXPORT_SYMBOL(d_alloc_name);
1303 1303
1304void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
1305{
1306 BUG_ON(dentry->d_op);
1307 BUG_ON(dentry->d_flags & (DCACHE_OP_HASH |
1308 DCACHE_OP_COMPARE |
1309 DCACHE_OP_REVALIDATE |
1310 DCACHE_OP_DELETE ));
1311 dentry->d_op = op;
1312 if (!op)
1313 return;
1314 if (op->d_hash)
1315 dentry->d_flags |= DCACHE_OP_HASH;
1316 if (op->d_compare)
1317 dentry->d_flags |= DCACHE_OP_COMPARE;
1318 if (op->d_revalidate)
1319 dentry->d_flags |= DCACHE_OP_REVALIDATE;
1320 if (op->d_delete)
1321 dentry->d_flags |= DCACHE_OP_DELETE;
1322
1323}
1324EXPORT_SYMBOL(d_set_d_op);
1325
1304static void __d_instantiate(struct dentry *dentry, struct inode *inode) 1326static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1305{ 1327{
1306 spin_lock(&dentry->d_lock); 1328 spin_lock(&dentry->d_lock);
@@ -1731,7 +1753,7 @@ seqretry:
1731 */ 1753 */
1732 if (read_seqcount_retry(&dentry->d_seq, *seq)) 1754 if (read_seqcount_retry(&dentry->d_seq, *seq))
1733 goto seqretry; 1755 goto seqretry;
1734 if (parent->d_op && parent->d_op->d_compare) { 1756 if (parent->d_flags & DCACHE_OP_COMPARE) {
1735 if (parent->d_op->d_compare(parent, *inode, 1757 if (parent->d_op->d_compare(parent, *inode,
1736 dentry, i, 1758 dentry, i,
1737 tlen, tname, name)) 1759 tlen, tname, name))
@@ -1846,7 +1868,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
1846 */ 1868 */
1847 tlen = dentry->d_name.len; 1869 tlen = dentry->d_name.len;
1848 tname = dentry->d_name.name; 1870 tname = dentry->d_name.name;
1849 if (parent->d_op && parent->d_op->d_compare) { 1871 if (parent->d_flags & DCACHE_OP_COMPARE) {
1850 if (parent->d_op->d_compare(parent, parent->d_inode, 1872 if (parent->d_op->d_compare(parent, parent->d_inode,
1851 dentry, dentry->d_inode, 1873 dentry, dentry->d_inode,
1852 tlen, tname, name)) 1874 tlen, tname, name))
@@ -1887,7 +1909,7 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
1887 * routine may choose to leave the hash value unchanged. 1909 * routine may choose to leave the hash value unchanged.
1888 */ 1910 */
1889 name->hash = full_name_hash(name->name, name->len); 1911 name->hash = full_name_hash(name->name, name->len);
1890 if (dir->d_op && dir->d_op->d_hash) { 1912 if (dir->d_flags & DCACHE_OP_HASH) {
1891 if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0) 1913 if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0)
1892 goto out; 1914 goto out;
1893 } 1915 }
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 5e5c7ec1fc98..f91b35db4c6e 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -441,7 +441,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
441 struct qstr lower_name; 441 struct qstr lower_name;
442 int rc = 0; 442 int rc = 0;
443 443
444 ecryptfs_dentry->d_op = &ecryptfs_dops; 444 d_set_d_op(ecryptfs_dentry, &ecryptfs_dops);
445 if ((ecryptfs_dentry->d_name.len == 1 445 if ((ecryptfs_dentry->d_name.len == 1
446 && !strcmp(ecryptfs_dentry->d_name.name, ".")) 446 && !strcmp(ecryptfs_dentry->d_name.name, "."))
447 || (ecryptfs_dentry->d_name.len == 2 447 || (ecryptfs_dentry->d_name.len == 2
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index a9dbd62518e6..351038675376 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -189,7 +189,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
189 if (special_file(lower_inode->i_mode)) 189 if (special_file(lower_inode->i_mode))
190 init_special_inode(inode, lower_inode->i_mode, 190 init_special_inode(inode, lower_inode->i_mode,
191 lower_inode->i_rdev); 191 lower_inode->i_rdev);
192 dentry->d_op = &ecryptfs_dops; 192 d_set_d_op(dentry, &ecryptfs_dops);
193 fsstack_copy_attr_all(inode, lower_inode); 193 fsstack_copy_attr_all(inode, lower_inode);
194 /* This size will be overwritten for real files w/ headers and 194 /* This size will be overwritten for real files w/ headers and
195 * other metadata */ 195 * other metadata */
@@ -594,7 +594,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
594 deactivate_locked_super(s); 594 deactivate_locked_super(s);
595 goto out; 595 goto out;
596 } 596 }
597 s->s_root->d_op = &ecryptfs_dops; 597 d_set_d_op(s->s_root, &ecryptfs_dops);
598 s->s_root->d_sb = s; 598 s->s_root->d_sb = s;
599 s->s_root->d_parent = s->s_root; 599 s->s_root->d_parent = s->s_root;
600 600
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 8cccfebee180..206351af7c58 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -750,7 +750,7 @@ static struct dentry *fat_fh_to_dentry(struct super_block *sb,
750 */ 750 */
751 result = d_obtain_alias(inode); 751 result = d_obtain_alias(inode);
752 if (!IS_ERR(result)) 752 if (!IS_ERR(result))
753 result->d_op = sb->s_root->d_op; 753 d_set_d_op(result, sb->s_root->d_op);
754 return result; 754 return result;
755} 755}
756 756
@@ -800,7 +800,7 @@ static struct dentry *fat_get_parent(struct dentry *child)
800 800
801 parent = d_obtain_alias(inode); 801 parent = d_obtain_alias(inode);
802 if (!IS_ERR(parent)) 802 if (!IS_ERR(parent))
803 parent->d_op = sb->s_root->d_op; 803 d_set_d_op(parent, sb->s_root->d_op);
804out: 804out:
805 unlock_super(sb); 805 unlock_super(sb);
806 806
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 3b3e072d8982..35ffe43afa4b 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -227,10 +227,10 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
227 } 227 }
228out: 228out:
229 unlock_super(sb); 229 unlock_super(sb);
230 dentry->d_op = &msdos_dentry_operations; 230 d_set_d_op(dentry, &msdos_dentry_operations);
231 dentry = d_splice_alias(inode, dentry); 231 dentry = d_splice_alias(inode, dentry);
232 if (dentry) 232 if (dentry)
233 dentry->d_op = &msdos_dentry_operations; 233 d_set_d_op(dentry, &msdos_dentry_operations);
234 return dentry; 234 return dentry;
235 235
236error: 236error:
@@ -673,7 +673,7 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
673 } 673 }
674 674
675 sb->s_flags |= MS_NOATIME; 675 sb->s_flags |= MS_NOATIME;
676 sb->s_root->d_op = &msdos_dentry_operations; 676 d_set_d_op(sb->s_root, &msdos_dentry_operations);
677 unlock_super(sb); 677 unlock_super(sb);
678 return 0; 678 return 0;
679} 679}
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 4fc06278db48..3be5ed7d859f 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -766,11 +766,11 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
766 766
767out: 767out:
768 unlock_super(sb); 768 unlock_super(sb);
769 dentry->d_op = sb->s_root->d_op; 769 d_set_d_op(dentry, sb->s_root->d_op);
770 dentry->d_time = dentry->d_parent->d_inode->i_version; 770 dentry->d_time = dentry->d_parent->d_inode->i_version;
771 dentry = d_splice_alias(inode, dentry); 771 dentry = d_splice_alias(inode, dentry);
772 if (dentry) { 772 if (dentry) {
773 dentry->d_op = sb->s_root->d_op; 773 d_set_d_op(dentry, sb->s_root->d_op);
774 dentry->d_time = dentry->d_parent->d_inode->i_version; 774 dentry->d_time = dentry->d_parent->d_inode->i_version;
775 } 775 }
776 return dentry; 776 return dentry;
@@ -1072,9 +1072,9 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
1072 } 1072 }
1073 1073
1074 if (MSDOS_SB(sb)->options.name_check != 's') 1074 if (MSDOS_SB(sb)->options.name_check != 's')
1075 sb->s_root->d_op = &vfat_ci_dentry_ops; 1075 d_set_d_op(sb->s_root, &vfat_ci_dentry_ops);
1076 else 1076 else
1077 sb->s_root->d_op = &vfat_dentry_ops; 1077 d_set_d_op(sb->s_root, &vfat_dentry_ops);
1078 1078
1079 unlock_super(sb); 1079 unlock_super(sb);
1080 return 0; 1080 return 0;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index c9627c95482d..c9a8a426a395 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -347,7 +347,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
347 } 347 }
348 348
349 entry = newent ? newent : entry; 349 entry = newent ? newent : entry;
350 entry->d_op = &fuse_dentry_operations; 350 d_set_d_op(entry, &fuse_dentry_operations);
351 if (outarg_valid) 351 if (outarg_valid)
352 fuse_change_entry_timeout(entry, &outarg); 352 fuse_change_entry_timeout(entry, &outarg);
353 else 353 else
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 44e0a6c57e87..a8b31da19b93 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -626,7 +626,7 @@ static struct dentry *fuse_get_dentry(struct super_block *sb,
626 626
627 entry = d_obtain_alias(inode); 627 entry = d_obtain_alias(inode);
628 if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) { 628 if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) {
629 entry->d_op = &fuse_dentry_operations; 629 d_set_d_op(entry, &fuse_dentry_operations);
630 fuse_invalidate_entry_cache(entry); 630 fuse_invalidate_entry_cache(entry);
631 } 631 }
632 632
@@ -728,7 +728,7 @@ static struct dentry *fuse_get_parent(struct dentry *child)
728 728
729 parent = d_obtain_alias(inode); 729 parent = d_obtain_alias(inode);
730 if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) { 730 if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) {
731 parent->d_op = &fuse_dentry_operations; 731 d_set_d_op(parent, &fuse_dentry_operations);
732 fuse_invalidate_entry_cache(parent); 732 fuse_invalidate_entry_cache(parent);
733 } 733 }
734 734
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c
index 5ab3839dfcb9..97012ecff560 100644
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -130,7 +130,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
130 130
131 dentry = d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1)); 131 dentry = d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1));
132 if (!IS_ERR(dentry)) 132 if (!IS_ERR(dentry))
133 dentry->d_op = &gfs2_dops; 133 d_set_d_op(dentry, &gfs2_dops);
134 return dentry; 134 return dentry;
135} 135}
136 136
@@ -158,7 +158,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
158out_inode: 158out_inode:
159 dentry = d_obtain_alias(inode); 159 dentry = d_obtain_alias(inode);
160 if (!IS_ERR(dentry)) 160 if (!IS_ERR(dentry))
161 dentry->d_op = &gfs2_dops; 161 d_set_d_op(dentry, &gfs2_dops);
162 return dentry; 162 return dentry;
163} 163}
164 164
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 3eb1393f7b81..2aeabd4218cc 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -440,7 +440,7 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr,
440 iput(inode); 440 iput(inode);
441 return -ENOMEM; 441 return -ENOMEM;
442 } 442 }
443 dentry->d_op = &gfs2_dops; 443 d_set_d_op(dentry, &gfs2_dops);
444 *dptr = dentry; 444 *dptr = dentry;
445 return 0; 445 return 0;
446} 446}
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 12cbea7502c2..f28f89796f4d 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -106,7 +106,7 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
106{ 106{
107 struct inode *inode = NULL; 107 struct inode *inode = NULL;
108 108
109 dentry->d_op = &gfs2_dops; 109 d_set_d_op(dentry, &gfs2_dops);
110 110
111 inode = gfs2_lookupi(dir, &dentry->d_name, 0); 111 inode = gfs2_lookupi(dir, &dentry->d_name, 0);
112 if (inode && IS_ERR(inode)) 112 if (inode && IS_ERR(inode))
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 2b3b8611b41b..ea4aefe7c652 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -25,7 +25,7 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
25 struct inode *inode = NULL; 25 struct inode *inode = NULL;
26 int res; 26 int res;
27 27
28 dentry->d_op = &hfs_dentry_operations; 28 d_set_d_op(dentry, &hfs_dentry_operations);
29 29
30 hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); 30 hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
31 hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); 31 hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name);
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index ef4ee5716abe..0bef62aa4f42 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -434,7 +434,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
434 if (!sb->s_root) 434 if (!sb->s_root)
435 goto bail_iput; 435 goto bail_iput;
436 436
437 sb->s_root->d_op = &hfs_dentry_operations; 437 d_set_d_op(sb->s_root, &hfs_dentry_operations);
438 438
439 /* everything's okay */ 439 /* everything's okay */
440 return 0; 440 return 0;
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 9d59c0571f59..ccab87145f7a 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -37,7 +37,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
37 37
38 sb = dir->i_sb; 38 sb = dir->i_sb;
39 39
40 dentry->d_op = &hfsplus_dentry_operations; 40 d_set_d_op(dentry, &hfsplus_dentry_operations);
41 dentry->d_fsdata = NULL; 41 dentry->d_fsdata = NULL;
42 hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); 42 hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
43 hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name); 43 hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name);
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 182e83a9079e..ddf712e4700e 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -419,7 +419,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
419 err = -ENOMEM; 419 err = -ENOMEM;
420 goto cleanup; 420 goto cleanup;
421 } 421 }
422 sb->s_root->d_op = &hfsplus_dentry_operations; 422 d_set_d_op(sb->s_root, &hfsplus_dentry_operations);
423 423
424 str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1; 424 str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1;
425 str.name = HFSP_HIDDENDIR_NAME; 425 str.name = HFSP_HIDDENDIR_NAME;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 861113fcfc88..0bc81cf256b8 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -612,7 +612,7 @@ struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry,
612 goto out_put; 612 goto out_put;
613 613
614 d_add(dentry, inode); 614 d_add(dentry, inode);
615 dentry->d_op = &hostfs_dentry_ops; 615 d_set_d_op(dentry, &hostfs_dentry_ops);
616 return NULL; 616 return NULL;
617 617
618 out_put: 618 out_put:
diff --git a/fs/hpfs/dentry.c b/fs/hpfs/dentry.c
index 35526df1fd32..32c13a94e1e9 100644
--- a/fs/hpfs/dentry.c
+++ b/fs/hpfs/dentry.c
@@ -65,5 +65,5 @@ static const struct dentry_operations hpfs_dentry_operations = {
65 65
66void hpfs_set_dentry_operations(struct dentry *dentry) 66void hpfs_set_dentry_operations(struct dentry *dentry)
67{ 67{
68 dentry->d_op = &hpfs_dentry_operations; 68 d_set_d_op(dentry, &hpfs_dentry_operations);
69} 69}
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index d8f3a652243d..844a7903c72f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -949,7 +949,7 @@ root_found:
949 table += 2; 949 table += 2;
950 if (opt.check == 'r') 950 if (opt.check == 'r')
951 table++; 951 table++;
952 s->s_root->d_op = &isofs_dentry_ops[table]; 952 d_set_d_op(s->s_root, &isofs_dentry_ops[table]);
953 953
954 kfree(opt.iocharset); 954 kfree(opt.iocharset);
955 955
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 715f7d318046..679a849c3b27 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -172,7 +172,7 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nam
172 struct inode *inode; 172 struct inode *inode;
173 struct page *page; 173 struct page *page;
174 174
175 dentry->d_op = dir->i_sb->s_root->d_op; 175 d_set_d_op(dentry, dir->i_sb->s_root->d_op);
176 176
177 page = alloc_page(GFP_USER); 177 page = alloc_page(GFP_USER);
178 if (!page) 178 if (!page)
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 57f90dad8919..a151cbdec626 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1466,7 +1466,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
1466 jfs_info("jfs_lookup: name = %s", name); 1466 jfs_info("jfs_lookup: name = %s", name);
1467 1467
1468 if (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2) 1468 if (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)
1469 dentry->d_op = &jfs_ci_dentry_operations; 1469 d_set_d_op(dentry, &jfs_ci_dentry_operations);
1470 1470
1471 if ((name[0] == '.') && (len == 1)) 1471 if ((name[0] == '.') && (len == 1))
1472 inum = dip->i_ino; 1472 inum = dip->i_ino;
@@ -1495,7 +1495,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
1495 dentry = d_splice_alias(ip, dentry); 1495 dentry = d_splice_alias(ip, dentry);
1496 1496
1497 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)) 1497 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
1498 dentry->d_op = &jfs_ci_dentry_operations; 1498 d_set_d_op(dentry, &jfs_ci_dentry_operations);
1499 1499
1500 return dentry; 1500 return dentry;
1501} 1501}
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index b715b0f7bdfd..3150d766e0d4 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -525,7 +525,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
525 goto out_no_root; 525 goto out_no_root;
526 526
527 if (sbi->mntflag & JFS_OS2) 527 if (sbi->mntflag & JFS_OS2)
528 sb->s_root->d_op = &jfs_ci_dentry_operations; 528 d_set_d_op(sb->s_root, &jfs_ci_dentry_operations);
529 529
530 /* logical blocks are represented by 40 bits in pxd_t, etc. */ 530 /* logical blocks are represented by 40 bits in pxd_t, etc. */
531 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40; 531 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
diff --git a/fs/libfs.c b/fs/libfs.c
index 28b36663c44e..889311e3d06b 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -59,7 +59,7 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct na
59 59
60 if (dentry->d_name.len > NAME_MAX) 60 if (dentry->d_name.len > NAME_MAX)
61 return ERR_PTR(-ENAMETOOLONG); 61 return ERR_PTR(-ENAMETOOLONG);
62 dentry->d_op = &simple_dentry_operations; 62 d_set_d_op(dentry, &simple_dentry_operations);
63 d_add(dentry, NULL); 63 d_add(dentry, NULL);
64 return NULL; 64 return NULL;
65} 65}
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index c0d35a3accef..1b9e07728a9f 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -23,7 +23,7 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, st
23 struct inode * inode = NULL; 23 struct inode * inode = NULL;
24 ino_t ino; 24 ino_t ino;
25 25
26 dentry->d_op = dir->i_sb->s_root->d_op; 26 d_set_d_op(dentry, dir->i_sb->s_root->d_op);
27 27
28 if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen) 28 if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen)
29 return ERR_PTR(-ENAMETOOLONG); 29 return ERR_PTR(-ENAMETOOLONG);
diff --git a/fs/namei.c b/fs/namei.c
index c731b50a6184..90bd2873e117 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -587,6 +587,17 @@ do_revalidate(struct dentry *dentry, struct nameidata *nd)
587 return dentry; 587 return dentry;
588} 588}
589 589
590static inline int need_reval_dot(struct dentry *dentry)
591{
592 if (likely(!(dentry->d_flags & DCACHE_OP_REVALIDATE)))
593 return 0;
594
595 if (likely(!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)))
596 return 0;
597
598 return 1;
599}
600
590/* 601/*
591 * force_reval_path - force revalidation of a dentry 602 * force_reval_path - force revalidation of a dentry
592 * 603 *
@@ -610,10 +621,9 @@ force_reval_path(struct path *path, struct nameidata *nd)
610 621
611 /* 622 /*
612 * only check on filesystems where it's possible for the dentry to 623 * only check on filesystems where it's possible for the dentry to
613 * become stale. It's assumed that if this flag is set then the 624 * become stale.
614 * d_revalidate op will also be defined.
615 */ 625 */
616 if (!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) 626 if (!need_reval_dot(dentry))
617 return 0; 627 return 0;
618 628
619 status = dentry->d_op->d_revalidate(dentry, nd); 629 status = dentry->d_op->d_revalidate(dentry, nd);
@@ -1003,7 +1013,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
1003 * See if the low-level filesystem might want 1013 * See if the low-level filesystem might want
1004 * to use its own hash.. 1014 * to use its own hash..
1005 */ 1015 */
1006 if (parent->d_op && parent->d_op->d_hash) { 1016 if (unlikely(parent->d_flags & DCACHE_OP_HASH)) {
1007 int err = parent->d_op->d_hash(parent, nd->inode, name); 1017 int err = parent->d_op->d_hash(parent, nd->inode, name);
1008 if (err < 0) 1018 if (err < 0)
1009 return err; 1019 return err;
@@ -1029,7 +1039,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
1029 return -ECHILD; 1039 return -ECHILD;
1030 1040
1031 nd->seq = seq; 1041 nd->seq = seq;
1032 if (dentry->d_op && dentry->d_op->d_revalidate) { 1042 if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
1033 /* We commonly drop rcu-walk here */ 1043 /* We commonly drop rcu-walk here */
1034 if (nameidata_dentry_drop_rcu(nd, dentry)) 1044 if (nameidata_dentry_drop_rcu(nd, dentry))
1035 return -ECHILD; 1045 return -ECHILD;
@@ -1043,7 +1053,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
1043 if (!dentry) 1053 if (!dentry)
1044 goto need_lookup; 1054 goto need_lookup;
1045found: 1055found:
1046 if (dentry->d_op && dentry->d_op->d_revalidate) 1056 if (dentry->d_flags & DCACHE_OP_REVALIDATE)
1047 goto need_revalidate; 1057 goto need_revalidate;
1048done: 1058done:
1049 path->mnt = mnt; 1059 path->mnt = mnt;
@@ -1281,8 +1291,7 @@ return_reval:
1281 * We bypassed the ordinary revalidation routines. 1291 * We bypassed the ordinary revalidation routines.
1282 * We may need to check the cached dentry for staleness. 1292 * We may need to check the cached dentry for staleness.
1283 */ 1293 */
1284 if (nd->path.dentry && nd->path.dentry->d_sb && 1294 if (need_reval_dot(nd->path.dentry)) {
1285 (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
1286 if (nameidata_drop_rcu_maybe(nd)) 1295 if (nameidata_drop_rcu_maybe(nd))
1287 return -ECHILD; 1296 return -ECHILD;
1288 err = -ESTALE; 1297 err = -ESTALE;
@@ -1602,7 +1611,7 @@ static struct dentry *__lookup_hash(struct qstr *name,
1602 * See if the low-level filesystem might want 1611 * See if the low-level filesystem might want
1603 * to use its own hash.. 1612 * to use its own hash..
1604 */ 1613 */
1605 if (base->d_op && base->d_op->d_hash) { 1614 if (base->d_flags & DCACHE_OP_HASH) {
1606 err = base->d_op->d_hash(base, inode, name); 1615 err = base->d_op->d_hash(base, inode, name);
1607 dentry = ERR_PTR(err); 1616 dentry = ERR_PTR(err);
1608 if (err < 0) 1617 if (err < 0)
@@ -1616,7 +1625,7 @@ static struct dentry *__lookup_hash(struct qstr *name,
1616 */ 1625 */
1617 dentry = d_lookup(base, name); 1626 dentry = d_lookup(base, name);
1618 1627
1619 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) 1628 if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE))
1620 dentry = do_revalidate(dentry, nd); 1629 dentry = do_revalidate(dentry, nd);
1621 1630
1622 if (!dentry) 1631 if (!dentry)
@@ -2070,7 +2079,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
2070 follow_dotdot(nd); 2079 follow_dotdot(nd);
2071 dir = nd->path.dentry; 2080 dir = nd->path.dentry;
2072 case LAST_DOT: 2081 case LAST_DOT:
2073 if (nd->path.mnt->mnt_sb->s_type->fs_flags & FS_REVAL_DOT) { 2082 if (need_reval_dot(dir)) {
2074 if (!dir->d_op->d_revalidate(dir, nd)) { 2083 if (!dir->d_op->d_revalidate(dir, nd)) {
2075 error = -ESTALE; 2084 error = -ESTALE;
2076 goto exit; 2085 goto exit;
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 0ba3cdc95a44..4b9cbb28d7fa 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -633,7 +633,7 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
633 entry->ino = iunique(dir->i_sb, 2); 633 entry->ino = iunique(dir->i_sb, 2);
634 inode = ncp_iget(dir->i_sb, entry); 634 inode = ncp_iget(dir->i_sb, entry);
635 if (inode) { 635 if (inode) {
636 newdent->d_op = &ncp_dentry_operations; 636 d_set_d_op(newdent, &ncp_dentry_operations);
637 d_instantiate(newdent, inode); 637 d_instantiate(newdent, inode);
638 if (!hashed) 638 if (!hashed)
639 d_rehash(newdent); 639 d_rehash(newdent);
@@ -889,7 +889,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, struc
889 if (inode) { 889 if (inode) {
890 ncp_new_dentry(dentry); 890 ncp_new_dentry(dentry);
891add_entry: 891add_entry:
892 dentry->d_op = &ncp_dentry_operations; 892 d_set_d_op(dentry, &ncp_dentry_operations);
893 d_add(dentry, inode); 893 d_add(dentry, inode);
894 error = 0; 894 error = 0;
895 } 895 }
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 60047dbeb38d..0c75a5f3cafd 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -717,7 +717,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
717 sb->s_root = d_alloc_root(root_inode); 717 sb->s_root = d_alloc_root(root_inode);
718 if (!sb->s_root) 718 if (!sb->s_root)
719 goto out_no_root; 719 goto out_no_root;
720 sb->s_root->d_op = &ncp_root_dentry_operations; 720 d_set_d_op(sb->s_root, &ncp_root_dentry_operations);
721 return 0; 721 return 0;
722 722
723out_no_root: 723out_no_root:
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index eb77471b8823..37e0a8bb077e 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -438,7 +438,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
438 if (dentry == NULL) 438 if (dentry == NULL)
439 return; 439 return;
440 440
441 dentry->d_op = NFS_PROTO(dir)->dentry_ops; 441 d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
442 inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr); 442 inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr);
443 if (IS_ERR(inode)) 443 if (IS_ERR(inode))
444 goto out; 444 goto out;
@@ -1188,7 +1188,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
1188 if (dentry->d_name.len > NFS_SERVER(dir)->namelen) 1188 if (dentry->d_name.len > NFS_SERVER(dir)->namelen)
1189 goto out; 1189 goto out;
1190 1190
1191 dentry->d_op = NFS_PROTO(dir)->dentry_ops; 1191 d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
1192 1192
1193 /* 1193 /*
1194 * If we're doing an exclusive create, optimize away the lookup 1194 * If we're doing an exclusive create, optimize away the lookup
@@ -1333,7 +1333,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1333 res = ERR_PTR(-ENAMETOOLONG); 1333 res = ERR_PTR(-ENAMETOOLONG);
1334 goto out; 1334 goto out;
1335 } 1335 }
1336 dentry->d_op = NFS_PROTO(dir)->dentry_ops; 1336 d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
1337 1337
1338 /* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash 1338 /* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash
1339 * the dentry. */ 1339 * the dentry. */
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index b3e36c3430de..c3a5a1126833 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -121,7 +121,7 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
121 security_d_instantiate(ret, inode); 121 security_d_instantiate(ret, inode);
122 122
123 if (ret->d_op == NULL) 123 if (ret->d_op == NULL)
124 ret->d_op = server->nfs_client->rpc_ops->dentry_ops; 124 d_set_d_op(ret, server->nfs_client->rpc_ops->dentry_ops);
125out: 125out:
126 nfs_free_fattr(fsinfo.fattr); 126 nfs_free_fattr(fsinfo.fattr);
127 return ret; 127 return ret;
@@ -228,7 +228,7 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
228 security_d_instantiate(ret, inode); 228 security_d_instantiate(ret, inode);
229 229
230 if (ret->d_op == NULL) 230 if (ret->d_op == NULL)
231 ret->d_op = server->nfs_client->rpc_ops->dentry_ops; 231 d_set_d_op(ret, server->nfs_client->rpc_ops->dentry_ops);
232 232
233out: 233out:
234 nfs_free_fattr(fattr); 234 nfs_free_fattr(fattr);
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
index 19ad145d2af3..6adafa576065 100644
--- a/fs/ocfs2/export.c
+++ b/fs/ocfs2/export.c
@@ -138,7 +138,7 @@ check_gen:
138 138
139 result = d_obtain_alias(inode); 139 result = d_obtain_alias(inode);
140 if (!IS_ERR(result)) 140 if (!IS_ERR(result))
141 result->d_op = &ocfs2_dentry_ops; 141 d_set_d_op(result, &ocfs2_dentry_ops);
142 else 142 else
143 mlog_errno(PTR_ERR(result)); 143 mlog_errno(PTR_ERR(result));
144 144
@@ -176,7 +176,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
176 176
177 parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); 177 parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0));
178 if (!IS_ERR(parent)) 178 if (!IS_ERR(parent))
179 parent->d_op = &ocfs2_dentry_ops; 179 d_set_d_op(parent, &ocfs2_dentry_ops);
180 180
181bail_unlock: 181bail_unlock:
182 ocfs2_inode_unlock(dir, 0); 182 ocfs2_inode_unlock(dir, 0);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index ff5744e1e36f..d14cad6e2e41 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -147,7 +147,7 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry,
147 spin_unlock(&oi->ip_lock); 147 spin_unlock(&oi->ip_lock);
148 148
149bail_add: 149bail_add:
150 dentry->d_op = &ocfs2_dentry_ops; 150 d_set_d_op(dentry, &ocfs2_dentry_ops);
151 ret = d_splice_alias(inode, dentry); 151 ret = d_splice_alias(inode, dentry);
152 152
153 if (inode) { 153 if (inode) {
@@ -415,7 +415,7 @@ static int ocfs2_mknod(struct inode *dir,
415 mlog_errno(status); 415 mlog_errno(status);
416 goto leave; 416 goto leave;
417 } 417 }
418 dentry->d_op = &ocfs2_dentry_ops; 418 d_set_d_op(dentry, &ocfs2_dentry_ops);
419 419
420 status = ocfs2_add_entry(handle, dentry, inode, 420 status = ocfs2_add_entry(handle, dentry, inode,
421 OCFS2_I(inode)->ip_blkno, parent_fe_bh, 421 OCFS2_I(inode)->ip_blkno, parent_fe_bh,
@@ -743,7 +743,7 @@ static int ocfs2_link(struct dentry *old_dentry,
743 } 743 }
744 744
745 ihold(inode); 745 ihold(inode);
746 dentry->d_op = &ocfs2_dentry_ops; 746 d_set_d_op(dentry, &ocfs2_dentry_ops);
747 d_instantiate(dentry, inode); 747 d_instantiate(dentry, inode);
748 748
749out_commit: 749out_commit:
@@ -1794,7 +1794,7 @@ static int ocfs2_symlink(struct inode *dir,
1794 mlog_errno(status); 1794 mlog_errno(status);
1795 goto bail; 1795 goto bail;
1796 } 1796 }
1797 dentry->d_op = &ocfs2_dentry_ops; 1797 d_set_d_op(dentry, &ocfs2_dentry_ops);
1798 1798
1799 status = ocfs2_add_entry(handle, dentry, inode, 1799 status = ocfs2_add_entry(handle, dentry, inode,
1800 le64_to_cpu(fe->i_blkno), parent_fe_bh, 1800 le64_to_cpu(fe->i_blkno), parent_fe_bh,
@@ -2459,7 +2459,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2459 goto out_commit; 2459 goto out_commit;
2460 } 2460 }
2461 2461
2462 dentry->d_op = &ocfs2_dentry_ops; 2462 d_set_d_op(dentry, &ocfs2_dentry_ops);
2463 d_instantiate(dentry, inode); 2463 d_instantiate(dentry, inode);
2464 status = 0; 2464 status = 0;
2465out_commit: 2465out_commit:
diff --git a/fs/pipe.c b/fs/pipe.c
index ae3592dcc88c..01a786567810 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1004,7 +1004,7 @@ struct file *create_write_pipe(int flags)
1004 goto err_inode; 1004 goto err_inode;
1005 path.mnt = mntget(pipe_mnt); 1005 path.mnt = mntget(pipe_mnt);
1006 1006
1007 path.dentry->d_op = &pipefs_dentry_operations; 1007 d_set_d_op(path.dentry, &pipefs_dentry_operations);
1008 d_instantiate(path.dentry, inode); 1008 d_instantiate(path.dentry, inode);
1009 1009
1010 err = -ENFILE; 1010 err = -ENFILE;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index d932fdb6a245..85f0a80912aa 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1969,7 +1969,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
1969 inode->i_op = &proc_pid_link_inode_operations; 1969 inode->i_op = &proc_pid_link_inode_operations;
1970 inode->i_size = 64; 1970 inode->i_size = 64;
1971 ei->op.proc_get_link = proc_fd_link; 1971 ei->op.proc_get_link = proc_fd_link;
1972 dentry->d_op = &tid_fd_dentry_operations; 1972 d_set_d_op(dentry, &tid_fd_dentry_operations);
1973 d_add(dentry, inode); 1973 d_add(dentry, inode);
1974 /* Close the race of the process dying before we return the dentry */ 1974 /* Close the race of the process dying before we return the dentry */
1975 if (tid_fd_revalidate(dentry, NULL)) 1975 if (tid_fd_revalidate(dentry, NULL))
@@ -2137,7 +2137,7 @@ static struct dentry *proc_fdinfo_instantiate(struct inode *dir,
2137 ei->fd = fd; 2137 ei->fd = fd;
2138 inode->i_mode = S_IFREG | S_IRUSR; 2138 inode->i_mode = S_IFREG | S_IRUSR;
2139 inode->i_fop = &proc_fdinfo_file_operations; 2139 inode->i_fop = &proc_fdinfo_file_operations;
2140 dentry->d_op = &tid_fd_dentry_operations; 2140 d_set_d_op(dentry, &tid_fd_dentry_operations);
2141 d_add(dentry, inode); 2141 d_add(dentry, inode);
2142 /* Close the race of the process dying before we return the dentry */ 2142 /* Close the race of the process dying before we return the dentry */
2143 if (tid_fd_revalidate(dentry, NULL)) 2143 if (tid_fd_revalidate(dentry, NULL))
@@ -2196,7 +2196,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir,
2196 if (p->fop) 2196 if (p->fop)
2197 inode->i_fop = p->fop; 2197 inode->i_fop = p->fop;
2198 ei->op = p->op; 2198 ei->op = p->op;
2199 dentry->d_op = &pid_dentry_operations; 2199 d_set_d_op(dentry, &pid_dentry_operations);
2200 d_add(dentry, inode); 2200 d_add(dentry, inode);
2201 /* Close the race of the process dying before we return the dentry */ 2201 /* Close the race of the process dying before we return the dentry */
2202 if (pid_revalidate(dentry, NULL)) 2202 if (pid_revalidate(dentry, NULL))
@@ -2615,7 +2615,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
2615 if (p->fop) 2615 if (p->fop)
2616 inode->i_fop = p->fop; 2616 inode->i_fop = p->fop;
2617 ei->op = p->op; 2617 ei->op = p->op;
2618 dentry->d_op = &proc_base_dentry_operations; 2618 d_set_d_op(dentry, &proc_base_dentry_operations);
2619 d_add(dentry, inode); 2619 d_add(dentry, inode);
2620 error = NULL; 2620 error = NULL;
2621out: 2621out:
@@ -2926,7 +2926,7 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
2926 inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff, 2926 inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff,
2927 ARRAY_SIZE(tgid_base_stuff)); 2927 ARRAY_SIZE(tgid_base_stuff));
2928 2928
2929 dentry->d_op = &pid_dentry_operations; 2929 d_set_d_op(dentry, &pid_dentry_operations);
2930 2930
2931 d_add(dentry, inode); 2931 d_add(dentry, inode);
2932 /* Close the race of the process dying before we return the dentry */ 2932 /* Close the race of the process dying before we return the dentry */
@@ -3169,7 +3169,7 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
3169 inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff, 3169 inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff,
3170 ARRAY_SIZE(tid_base_stuff)); 3170 ARRAY_SIZE(tid_base_stuff));
3171 3171
3172 dentry->d_op = &pid_dentry_operations; 3172 d_set_d_op(dentry, &pid_dentry_operations);
3173 3173
3174 d_add(dentry, inode); 3174 d_add(dentry, inode);
3175 /* Close the race of the process dying before we return the dentry */ 3175 /* Close the race of the process dying before we return the dentry */
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 1d607be36d95..f766be29d2c7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -439,7 +439,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
439out_unlock: 439out_unlock:
440 440
441 if (inode) { 441 if (inode) {
442 dentry->d_op = &proc_dentry_operations; 442 d_set_d_op(dentry, &proc_dentry_operations);
443 d_add(dentry, inode); 443 d_add(dentry, inode);
444 return NULL; 444 return NULL;
445 } 445 }
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 998e3a715bcc..35efd85a4d32 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -120,7 +120,7 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
120 goto out; 120 goto out;
121 121
122 err = NULL; 122 err = NULL;
123 dentry->d_op = &proc_sys_dentry_operations; 123 d_set_d_op(dentry, &proc_sys_dentry_operations);
124 d_add(dentry, inode); 124 d_add(dentry, inode);
125 125
126out: 126out:
@@ -201,7 +201,7 @@ static int proc_sys_fill_cache(struct file *filp, void *dirent,
201 dput(child); 201 dput(child);
202 return -ENOMEM; 202 return -ENOMEM;
203 } else { 203 } else {
204 child->d_op = &proc_sys_dentry_operations; 204 d_set_d_op(child, &proc_sys_dentry_operations);
205 d_add(child, inode); 205 d_add(child, inode);
206 } 206 }
207 } else { 207 } else {
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 5d04a7828e7a..e0f0d7ea10a1 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -990,7 +990,7 @@ int reiserfs_lookup_privroot(struct super_block *s)
990 strlen(PRIVROOT_NAME)); 990 strlen(PRIVROOT_NAME));
991 if (!IS_ERR(dentry)) { 991 if (!IS_ERR(dentry)) {
992 REISERFS_SB(s)->priv_root = dentry; 992 REISERFS_SB(s)->priv_root = dentry;
993 dentry->d_op = &xattr_lookup_poison_ops; 993 d_set_d_op(dentry, &xattr_lookup_poison_ops);
994 if (dentry->d_inode) 994 if (dentry->d_inode)
995 dentry->d_inode->i_flags |= S_PRIVATE; 995 dentry->d_inode->i_flags |= S_PRIVATE;
996 } else 996 } else
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 27e1102e303e..3e076caa8daf 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -701,7 +701,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
701 /* instantiate and hash dentry */ 701 /* instantiate and hash dentry */
702 ret = d_find_alias(inode); 702 ret = d_find_alias(inode);
703 if (!ret) { 703 if (!ret) {
704 dentry->d_op = &sysfs_dentry_ops; 704 d_set_d_op(dentry, &sysfs_dentry_ops);
705 dentry->d_fsdata = sysfs_get(sd); 705 dentry->d_fsdata = sysfs_get(sd);
706 d_add(dentry, inode); 706 d_add(dentry, inode);
707 } else { 707 } else {
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 7507aeb4c90e..b5e68da2db32 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -48,7 +48,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, st
48 struct inode * inode = NULL; 48 struct inode * inode = NULL;
49 ino_t ino; 49 ino_t ino;
50 50
51 dentry->d_op = dir->i_sb->s_root->d_op; 51 d_set_d_op(dentry, dir->i_sb->s_root->d_op);
52 if (dentry->d_name.len > SYSV_NAMELEN) 52 if (dentry->d_name.len > SYSV_NAMELEN)
53 return ERR_PTR(-ENAMETOOLONG); 53 return ERR_PTR(-ENAMETOOLONG);
54 ino = sysv_inode_by_name(dentry); 54 ino = sysv_inode_by_name(dentry);
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 3d9c62be0c10..76712aefc4ab 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -346,7 +346,7 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
346 if (sbi->s_forced_ro) 346 if (sbi->s_forced_ro)
347 sb->s_flags |= MS_RDONLY; 347 sb->s_flags |= MS_RDONLY;
348 if (sbi->s_truncate) 348 if (sbi->s_truncate)
349 sb->s_root->d_op = &sysv_dentry_operations; 349 d_set_d_op(sb->s_root, &sysv_dentry_operations);
350 return 1; 350 return 1;
351} 351}
352 352
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index e4414693065e..f4b40a751f09 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -183,6 +183,11 @@ struct dentry_operations {
183#define DCACHE_GENOCIDE 0x0200 183#define DCACHE_GENOCIDE 0x0200
184#define DCACHE_MOUNTED 0x0400 /* is a mountpoint */ 184#define DCACHE_MOUNTED 0x0400 /* is a mountpoint */
185 185
186#define DCACHE_OP_HASH 0x1000
187#define DCACHE_OP_COMPARE 0x2000
188#define DCACHE_OP_REVALIDATE 0x4000
189#define DCACHE_OP_DELETE 0x8000
190
186 191
187extern spinlock_t dcache_inode_lock; 192extern spinlock_t dcache_inode_lock;
188extern seqlock_t rename_lock; 193extern seqlock_t rename_lock;
@@ -201,6 +206,7 @@ extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
201extern void __d_drop(struct dentry *dentry); 206extern void __d_drop(struct dentry *dentry);
202extern void d_drop(struct dentry *dentry); 207extern void d_drop(struct dentry *dentry);
203extern void d_delete(struct dentry *); 208extern void d_delete(struct dentry *);
209extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op);
204 210
205/* allocate/de-allocate */ 211/* allocate/de-allocate */
206extern struct dentry * d_alloc(struct dentry *, const struct qstr *); 212extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 9f41470c3949..51cddc11cd85 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2222,7 +2222,7 @@ static struct dentry *cgroup_lookup(struct inode *dir,
2222 2222
2223 if (dentry->d_name.len > NAME_MAX) 2223 if (dentry->d_name.len > NAME_MAX)
2224 return ERR_PTR(-ENAMETOOLONG); 2224 return ERR_PTR(-ENAMETOOLONG);
2225 dentry->d_op = &cgroup_dentry_operations; 2225 d_set_d_op(dentry, &cgroup_dentry_operations);
2226 d_add(dentry, NULL); 2226 d_add(dentry, NULL);
2227 return NULL; 2227 return NULL;
2228} 2228}
diff --git a/net/socket.c b/net/socket.c
index 817dc92e9ef8..991e266bc7ae 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -368,7 +368,7 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
368 } 368 }
369 path.mnt = mntget(sock_mnt); 369 path.mnt = mntget(sock_mnt);
370 370
371 path.dentry->d_op = &sockfs_dentry_operations; 371 d_set_d_op(path.dentry, &sockfs_dentry_operations);
372 d_instantiate(path.dentry, SOCK_INODE(sock)); 372 d_instantiate(path.dentry, SOCK_INODE(sock));
373 SOCK_INODE(sock)->i_fop = &socket_file_ops; 373 SOCK_INODE(sock)->i_fop = &socket_file_ops;
374 374
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 2899fe27f880..09f01f41e55a 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -591,7 +591,7 @@ static struct dentry *__rpc_lookup_create(struct dentry *parent,
591 } 591 }
592 } 592 }
593 if (!dentry->d_inode) 593 if (!dentry->d_inode)
594 dentry->d_op = &rpc_dentry_operations; 594 d_set_d_op(dentry, &rpc_dentry_operations);
595out_err: 595out_err:
596 return dentry; 596 return dentry;
597} 597}