aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-03-17 18:25:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-15 15:06:57 -0400
commit2b0143b5c986be1ce8408b3aadc4709e0a94429d (patch)
tree98b1dee70f3d5d9ac9309f4638e41864ddcd0952 /fs
parentce0b16ddf18df35026164fda4a642ef10c01f442 (diff)
VFS: normal filesystems (and lustre): d_inode() annotations
that's the bulk of filesystem drivers dealing with inodes of their own Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/acl.c4
-rw-r--r--fs/9p/vfs_dentry.c4
-rw-r--r--fs/9p/vfs_inode.c34
-rw-r--r--fs/9p/vfs_inode_dotl.c16
-rw-r--r--fs/9p/vfs_super.c8
-rw-r--r--fs/adfs/inode.c2
-rw-r--r--fs/affs/amigaffs.c8
-rw-r--r--fs/affs/inode.c2
-rw-r--r--fs/affs/namei.c10
-rw-r--r--fs/afs/dir.c42
-rw-r--r--fs/afs/inode.c4
-rw-r--r--fs/afs/mntpt.c8
-rw-r--r--fs/afs/super.c2
-rw-r--r--fs/autofs4/autofs_i.h4
-rw-r--r--fs/autofs4/expire.c2
-rw-r--r--fs/autofs4/inode.c6
-rw-r--r--fs/autofs4/root.c18
-rw-r--r--fs/autofs4/symlink.c2
-rw-r--r--fs/autofs4/waitq.c4
-rw-r--r--fs/befs/linuxvfs.c4
-rw-r--r--fs/bfs/dir.c8
-rw-r--r--fs/btrfs/export.c6
-rw-r--r--fs/btrfs/file.c2
-rw-r--r--fs/btrfs/inode.c30
-rw-r--r--fs/btrfs/ioctl.c22
-rw-r--r--fs/btrfs/super.c8
-rw-r--r--fs/btrfs/tree-log.c14
-rw-r--r--fs/btrfs/xattr.c16
-rw-r--r--fs/ceph/caps.c2
-rw-r--r--fs/ceph/debugfs.c2
-rw-r--r--fs/ceph/dir.c60
-rw-r--r--fs/ceph/export.c28
-rw-r--r--fs/ceph/file.c4
-rw-r--r--fs/ceph/inode.c52
-rw-r--r--fs/ceph/mds_client.c24
-rw-r--r--fs/ceph/super.c4
-rw-r--r--fs/ceph/xattr.c16
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/cifssmb.c4
-rw-r--r--fs/cifs/dir.c8
-rw-r--r--fs/cifs/file.c48
-rw-r--r--fs/cifs/inode.c32
-rw-r--r--fs/cifs/link.c12
-rw-r--r--fs/cifs/misc.c2
-rw-r--r--fs/cifs/readdir.c4
-rw-r--r--fs/cifs/smb1ops.c2
-rw-r--r--fs/cifs/smb2file.c4
-rw-r--r--fs/cifs/smb2misc.c4
-rw-r--r--fs/cifs/smb2ops.c10
-rw-r--r--fs/cifs/xattr.c22
-rw-r--r--fs/coda/cache.c4
-rw-r--r--fs/coda/dir.c22
-rw-r--r--fs/coda/inode.c6
-rw-r--r--fs/coda/pioctl.c2
-rw-r--r--fs/coda/upcall.c4
-rw-r--r--fs/configfs/dir.c70
-rw-r--r--fs/configfs/file.c4
-rw-r--r--fs/configfs/inode.c16
-rw-r--r--fs/debugfs/file.c2
-rw-r--r--fs/debugfs/inode.c56
-rw-r--r--fs/devpts/inode.c16
-rw-r--r--fs/ecryptfs/crypto.c4
-rw-r--r--fs/ecryptfs/dentry.c6
-rw-r--r--fs/ecryptfs/file.c2
-rw-r--r--fs/ecryptfs/inode.c164
-rw-r--r--fs/ecryptfs/kthread.c2
-rw-r--r--fs/ecryptfs/main.c6
-rw-r--r--fs/ecryptfs/mmap.c2
-rw-r--r--fs/efivarfs/inode.c4
-rw-r--r--fs/efivarfs/super.c2
-rw-r--r--fs/efs/namei.c4
-rw-r--r--fs/exofs/dir.c4
-rw-r--r--fs/exofs/inode.c2
-rw-r--r--fs/exofs/namei.c10
-rw-r--r--fs/exofs/super.c2
-rw-r--r--fs/exofs/symlink.c2
-rw-r--r--fs/ext2/dir.c2
-rw-r--r--fs/ext2/ialloc.c2
-rw-r--r--fs/ext2/inode.c2
-rw-r--r--fs/ext2/namei.c14
-rw-r--r--fs/ext2/symlink.c2
-rw-r--r--fs/ext2/xattr.c4
-rw-r--r--fs/ext2/xattr_security.c4
-rw-r--r--fs/ext2/xattr_trusted.c4
-rw-r--r--fs/ext2/xattr_user.c4
-rw-r--r--fs/ext3/ialloc.c2
-rw-r--r--fs/ext3/inode.c2
-rw-r--r--fs/ext3/namei.c34
-rw-r--r--fs/ext3/super.c6
-rw-r--r--fs/ext3/symlink.c2
-rw-r--r--fs/ext3/xattr.c10
-rw-r--r--fs/ext3/xattr_security.c4
-rw-r--r--fs/ext3/xattr_trusted.c4
-rw-r--r--fs/ext3/xattr_user.c4
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/ext4/ialloc.c2
-rw-r--r--fs/ext4/inline.c4
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/ext4/migrate.c2
-rw-r--r--fs/ext4/namei.c34
-rw-r--r--fs/ext4/super.c6
-rw-r--r--fs/ext4/symlink.c2
-rw-r--r--fs/ext4/xattr.c10
-rw-r--r--fs/ext4/xattr_security.c4
-rw-r--r--fs/ext4/xattr_trusted.c4
-rw-r--r--fs/ext4/xattr_user.c4
-rw-r--r--fs/f2fs/f2fs.h2
-rw-r--r--fs/f2fs/file.c4
-rw-r--r--fs/f2fs/namei.c18
-rw-r--r--fs/f2fs/xattr.c10
-rw-r--r--fs/fat/file.c4
-rw-r--r--fs/fat/namei_msdos.c8
-rw-r--r--fs/fat/namei_vfat.c14
-rw-r--r--fs/fat/nfs.c4
-rw-r--r--fs/freevxfs/vxfs_immed.c2
-rw-r--r--fs/fuse/control.c6
-rw-r--r--fs/fuse/dir.c60
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--fs/gfs2/dentry.c12
-rw-r--r--fs/gfs2/export.c8
-rw-r--r--fs/gfs2/inode.c34
-rw-r--r--fs/gfs2/ops_fstype.c8
-rw-r--r--fs/gfs2/super.c2
-rw-r--r--fs/gfs2/xattr.c6
-rw-r--r--fs/hfs/attr.c6
-rw-r--r--fs/hfs/dir.c8
-rw-r--r--fs/hfs/inode.c2
-rw-r--r--fs/hfs/sysdep.c2
-rw-r--r--fs/hfsplus/dir.c12
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hfsplus/ioctl.c2
-rw-r--r--fs/hfsplus/xattr.c4
-rw-r--r--fs/hfsplus/xattr.h4
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hpfs/inode.c2
-rw-r--r--fs/hpfs/namei.c8
-rw-r--r--fs/hppfs/hppfs.c20
-rw-r--r--fs/hugetlbfs/inode.c4
-rw-r--r--fs/isofs/export.c2
-rw-r--r--fs/jffs2/dir.c40
-rw-r--r--fs/jffs2/fs.c2
-rw-r--r--fs/jffs2/security.c4
-rw-r--r--fs/jffs2/super.c4
-rw-r--r--fs/jffs2/symlink.c2
-rw-r--r--fs/jffs2/xattr.c2
-rw-r--r--fs/jffs2/xattr_trusted.c4
-rw-r--r--fs/jffs2/xattr_user.c4
-rw-r--r--fs/jfs/file.c2
-rw-r--r--fs/jfs/namei.c18
-rw-r--r--fs/jfs/symlink.c2
-rw-r--r--fs/jfs/xattr.c12
-rw-r--r--fs/kernfs/dir.c2
-rw-r--r--fs/kernfs/inode.c8
-rw-r--r--fs/logfs/dir.c14
-rw-r--r--fs/logfs/file.c2
-rw-r--r--fs/minix/dir.c4
-rw-r--r--fs/minix/file.c2
-rw-r--r--fs/minix/inode.c4
-rw-r--r--fs/minix/namei.c10
-rw-r--r--fs/ncpfs/dir.c48
-rw-r--r--fs/ncpfs/inode.c6
-rw-r--r--fs/ncpfs/ioctl.c8
-rw-r--r--fs/ncpfs/ncplib_kernel.c2
-rw-r--r--fs/ncpfs/symlink.c2
-rw-r--r--fs/nfs/dir.c59
-rw-r--r--fs/nfs/direct.c4
-rw-r--r--fs/nfs/getroot.c4
-rw-r--r--fs/nfs/inode.c18
-rw-r--r--fs/nfs/namespace.c10
-rw-r--r--fs/nfs/nfs3acl.c2
-rw-r--r--fs/nfs/nfs3proc.c12
-rw-r--r--fs/nfs/nfs4client.c2
-rw-r--r--fs/nfs/nfs4file.c4
-rw-r--r--fs/nfs/nfs4namespace.c4
-rw-r--r--fs/nfs/nfs4proc.c60
-rw-r--r--fs/nfs/nfs4state.c4
-rw-r--r--fs/nfs/nfs4trace.h4
-rw-r--r--fs/nfs/pagelist.c2
-rw-r--r--fs/nfs/pnfs.h4
-rw-r--r--fs/nfs/proc.c4
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/super.c6
-rw-r--r--fs/nfs/symlink.c2
-rw-r--r--fs/nfs/unlink.c20
-rw-r--r--fs/nfs/write.c8
-rw-r--r--fs/nfsd/export.c4
-rw-r--r--fs/nfsd/nfs2acl.c8
-rw-r--r--fs/nfsd/nfs3acl.c8
-rw-r--r--fs/nfsd/nfs3proc.c6
-rw-r--r--fs/nfsd/nfs3xdr.c16
-rw-r--r--fs/nfsd/nfs4acl.c4
-rw-r--r--fs/nfsd/nfs4proc.c12
-rw-r--r--fs/nfsd/nfs4recover.c22
-rw-r--r--fs/nfsd/nfs4state.c4
-rw-r--r--fs/nfsd/nfs4xdr.c10
-rw-r--r--fs/nfsd/nfsfh.c20
-rw-r--r--fs/nfsd/nfsfh.h6
-rw-r--r--fs/nfsd/nfsproc.c4
-rw-r--r--fs/nfsd/nfsxdr.c2
-rw-r--r--fs/nfsd/vfs.c62
-rw-r--r--fs/nfsd/xdr4.h2
-rw-r--r--fs/nilfs2/dir.c2
-rw-r--r--fs/nilfs2/inode.c2
-rw-r--r--fs/nilfs2/namei.c18
-rw-r--r--fs/nilfs2/super.c6
-rw-r--r--fs/ntfs/inode.c2
-rw-r--r--fs/ntfs/namei.c4
-rw-r--r--fs/ocfs2/dcache.c14
-rw-r--r--fs/ocfs2/dir.h2
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c4
-rw-r--r--fs/ocfs2/export.c2
-rw-r--r--fs/ocfs2/file.c8
-rw-r--r--fs/ocfs2/inode.c2
-rw-r--r--fs/ocfs2/namei.c14
-rw-r--r--fs/ocfs2/refcounttree.c10
-rw-r--r--fs/ocfs2/xattr.c22
-rw-r--r--fs/omfs/dir.c10
-rw-r--r--fs/omfs/file.c2
-rw-r--r--fs/proc/base.c32
-rw-r--r--fs/proc/fd.c6
-rw-r--r--fs/proc/generic.c4
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/namespaces.c4
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--fs/proc/proc_sysctl.c12
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/proc/self.c2
-rw-r--r--fs/proc/thread_self.c2
-rw-r--r--fs/pstore/inode.c10
-rw-r--r--fs/qnx6/inode.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/reiserfs/dir.c4
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/reiserfs/namei.c12
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--fs/reiserfs/xattr.c126
-rw-r--r--fs/reiserfs/xattr.h2
-rw-r--r--fs/reiserfs/xattr_security.c10
-rw-r--r--fs/reiserfs/xattr_trusted.c10
-rw-r--r--fs/reiserfs/xattr_user.c4
-rw-r--r--fs/squashfs/export.c2
-rw-r--r--fs/squashfs/xattr.c8
-rw-r--r--fs/sysv/dir.c4
-rw-r--r--fs/sysv/file.c2
-rw-r--r--fs/sysv/itree.c2
-rw-r--r--fs/sysv/namei.c10
-rw-r--r--fs/sysv/symlink.c2
-rw-r--r--fs/ubifs/dir.c14
-rw-r--r--fs/ubifs/file.c4
-rw-r--r--fs/ubifs/journal.c4
-rw-r--r--fs/ubifs/xattr.c10
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/udf/namei.c16
-rw-r--r--fs/ufs/dir.c2
-rw-r--r--fs/ufs/namei.c10
-rw-r--r--fs/ufs/super.c4
-rw-r--r--fs/ufs/symlink.c2
-rw-r--r--fs/ufs/truncate.c2
-rw-r--r--fs/xfs/xfs_export.c2
-rw-r--r--fs/xfs/xfs_filestream.c2
-rw-r--r--fs/xfs/xfs_ioctl.c18
-rw-r--r--fs/xfs/xfs_ioctl32.c12
-rw-r--r--fs/xfs/xfs_iops.c20
-rw-r--r--fs/xfs/xfs_super.c2
-rw-r--r--fs/xfs/xfs_xattr.c6
266 files changed, 1350 insertions, 1351 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 8482f2d11606..31c010372660 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -247,7 +247,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
247 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) 247 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
248 return v9fs_remote_get_acl(dentry, name, buffer, size, type); 248 return v9fs_remote_get_acl(dentry, name, buffer, size, type);
249 249
250 acl = v9fs_get_cached_acl(dentry->d_inode, type); 250 acl = v9fs_get_cached_acl(d_inode(dentry), type);
251 if (IS_ERR(acl)) 251 if (IS_ERR(acl))
252 return PTR_ERR(acl); 252 return PTR_ERR(acl);
253 if (acl == NULL) 253 if (acl == NULL)
@@ -285,7 +285,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
285 int retval; 285 int retval;
286 struct posix_acl *acl; 286 struct posix_acl *acl;
287 struct v9fs_session_info *v9ses; 287 struct v9fs_session_info *v9ses;
288 struct inode *inode = dentry->d_inode; 288 struct inode *inode = d_inode(dentry);
289 289
290 if (strcmp(name, "") != 0) 290 if (strcmp(name, "") != 0)
291 return -EINVAL; 291 return -EINVAL;
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index a345b2d659cc..bd456c668d39 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -53,7 +53,7 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
53 dentry, dentry); 53 dentry, dentry);
54 54
55 /* Don't cache negative dentries */ 55 /* Don't cache negative dentries */
56 if (!dentry->d_inode) 56 if (d_really_is_negative(dentry))
57 return 1; 57 return 1;
58 return 0; 58 return 0;
59} 59}
@@ -83,7 +83,7 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
83 if (flags & LOOKUP_RCU) 83 if (flags & LOOKUP_RCU)
84 return -ECHILD; 84 return -ECHILD;
85 85
86 inode = dentry->d_inode; 86 inode = d_inode(dentry);
87 if (!inode) 87 if (!inode)
88 goto out_valid; 88 goto out_valid;
89 89
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 3662f1d1d9cf..703342e309f5 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -595,7 +595,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
595 dir, dentry, flags); 595 dir, dentry, flags);
596 596
597 v9ses = v9fs_inode2v9ses(dir); 597 v9ses = v9fs_inode2v9ses(dir);
598 inode = dentry->d_inode; 598 inode = d_inode(dentry);
599 dfid = v9fs_fid_lookup(dentry->d_parent); 599 dfid = v9fs_fid_lookup(dentry->d_parent);
600 if (IS_ERR(dfid)) { 600 if (IS_ERR(dfid)) {
601 retval = PTR_ERR(dfid); 601 retval = PTR_ERR(dfid);
@@ -864,7 +864,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
864 } 864 }
865 865
866 /* Only creates */ 866 /* Only creates */
867 if (!(flags & O_CREAT) || dentry->d_inode) 867 if (!(flags & O_CREAT) || d_really_is_positive(dentry))
868 return finish_no_open(file, res); 868 return finish_no_open(file, res);
869 869
870 err = 0; 870 err = 0;
@@ -881,7 +881,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
881 } 881 }
882 882
883 v9fs_invalidate_inode_attr(dir); 883 v9fs_invalidate_inode_attr(dir);
884 v9inode = V9FS_I(dentry->d_inode); 884 v9inode = V9FS_I(d_inode(dentry));
885 mutex_lock(&v9inode->v_mutex); 885 mutex_lock(&v9inode->v_mutex);
886 if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && 886 if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) &&
887 !v9inode->writeback_fid && 887 !v9inode->writeback_fid &&
@@ -908,7 +908,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
908 908
909 file->private_data = fid; 909 file->private_data = fid;
910 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) 910 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
911 v9fs_cache_inode_set_cookie(dentry->d_inode, file); 911 v9fs_cache_inode_set_cookie(d_inode(dentry), file);
912 912
913 *opened |= FILE_CREATED; 913 *opened |= FILE_CREATED;
914out: 914out:
@@ -969,8 +969,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
969 969
970 p9_debug(P9_DEBUG_VFS, "\n"); 970 p9_debug(P9_DEBUG_VFS, "\n");
971 retval = 0; 971 retval = 0;
972 old_inode = old_dentry->d_inode; 972 old_inode = d_inode(old_dentry);
973 new_inode = new_dentry->d_inode; 973 new_inode = d_inode(new_dentry);
974 v9ses = v9fs_inode2v9ses(old_inode); 974 v9ses = v9fs_inode2v9ses(old_inode);
975 oldfid = v9fs_fid_lookup(old_dentry); 975 oldfid = v9fs_fid_lookup(old_dentry);
976 if (IS_ERR(oldfid)) 976 if (IS_ERR(oldfid))
@@ -1061,7 +1061,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1061 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); 1061 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
1062 v9ses = v9fs_dentry2v9ses(dentry); 1062 v9ses = v9fs_dentry2v9ses(dentry);
1063 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 1063 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
1064 generic_fillattr(dentry->d_inode, stat); 1064 generic_fillattr(d_inode(dentry), stat);
1065 return 0; 1065 return 0;
1066 } 1066 }
1067 fid = v9fs_fid_lookup(dentry); 1067 fid = v9fs_fid_lookup(dentry);
@@ -1072,8 +1072,8 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1072 if (IS_ERR(st)) 1072 if (IS_ERR(st))
1073 return PTR_ERR(st); 1073 return PTR_ERR(st);
1074 1074
1075 v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); 1075 v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb);
1076 generic_fillattr(dentry->d_inode, stat); 1076 generic_fillattr(d_inode(dentry), stat);
1077 1077
1078 p9stat_free(st); 1078 p9stat_free(st);
1079 kfree(st); 1079 kfree(st);
@@ -1095,7 +1095,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1095 struct p9_wstat wstat; 1095 struct p9_wstat wstat;
1096 1096
1097 p9_debug(P9_DEBUG_VFS, "\n"); 1097 p9_debug(P9_DEBUG_VFS, "\n");
1098 retval = inode_change_ok(dentry->d_inode, iattr); 1098 retval = inode_change_ok(d_inode(dentry), iattr);
1099 if (retval) 1099 if (retval)
1100 return retval; 1100 return retval;
1101 1101
@@ -1128,20 +1128,20 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1128 1128
1129 /* Write all dirty data */ 1129 /* Write all dirty data */
1130 if (d_is_reg(dentry)) 1130 if (d_is_reg(dentry))
1131 filemap_write_and_wait(dentry->d_inode->i_mapping); 1131 filemap_write_and_wait(d_inode(dentry)->i_mapping);
1132 1132
1133 retval = p9_client_wstat(fid, &wstat); 1133 retval = p9_client_wstat(fid, &wstat);
1134 if (retval < 0) 1134 if (retval < 0)
1135 return retval; 1135 return retval;
1136 1136
1137 if ((iattr->ia_valid & ATTR_SIZE) && 1137 if ((iattr->ia_valid & ATTR_SIZE) &&
1138 iattr->ia_size != i_size_read(dentry->d_inode)) 1138 iattr->ia_size != i_size_read(d_inode(dentry)))
1139 truncate_setsize(dentry->d_inode, iattr->ia_size); 1139 truncate_setsize(d_inode(dentry), iattr->ia_size);
1140 1140
1141 v9fs_invalidate_inode_attr(dentry->d_inode); 1141 v9fs_invalidate_inode_attr(d_inode(dentry));
1142 1142
1143 setattr_copy(dentry->d_inode, iattr); 1143 setattr_copy(d_inode(dentry), iattr);
1144 mark_inode_dirty(dentry->d_inode); 1144 mark_inode_dirty(d_inode(dentry));
1145 return 0; 1145 return 0;
1146} 1146}
1147 1147
@@ -1403,7 +1403,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1403 retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); 1403 retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name);
1404 __putname(name); 1404 __putname(name);
1405 if (!retval) { 1405 if (!retval) {
1406 v9fs_refresh_inode(oldfid, old_dentry->d_inode); 1406 v9fs_refresh_inode(oldfid, d_inode(old_dentry));
1407 v9fs_invalidate_inode_attr(dir); 1407 v9fs_invalidate_inode_attr(dir);
1408 } 1408 }
1409clunk_fid: 1409clunk_fid:
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 6054c16b8fae..9861c7c951a6 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -265,7 +265,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
265 } 265 }
266 266
267 /* Only creates */ 267 /* Only creates */
268 if (!(flags & O_CREAT) || dentry->d_inode) 268 if (!(flags & O_CREAT) || d_really_is_positive(dentry))
269 return finish_no_open(file, res); 269 return finish_no_open(file, res);
270 270
271 v9ses = v9fs_inode2v9ses(dir); 271 v9ses = v9fs_inode2v9ses(dir);
@@ -481,7 +481,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
481 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); 481 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
482 v9ses = v9fs_dentry2v9ses(dentry); 482 v9ses = v9fs_dentry2v9ses(dentry);
483 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 483 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
484 generic_fillattr(dentry->d_inode, stat); 484 generic_fillattr(d_inode(dentry), stat);
485 return 0; 485 return 0;
486 } 486 }
487 fid = v9fs_fid_lookup(dentry); 487 fid = v9fs_fid_lookup(dentry);
@@ -496,8 +496,8 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
496 if (IS_ERR(st)) 496 if (IS_ERR(st))
497 return PTR_ERR(st); 497 return PTR_ERR(st);
498 498
499 v9fs_stat2inode_dotl(st, dentry->d_inode); 499 v9fs_stat2inode_dotl(st, d_inode(dentry));
500 generic_fillattr(dentry->d_inode, stat); 500 generic_fillattr(d_inode(dentry), stat);
501 /* Change block size to what the server returned */ 501 /* Change block size to what the server returned */
502 stat->blksize = st->st_blksize; 502 stat->blksize = st->st_blksize;
503 503
@@ -557,7 +557,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
557 int retval; 557 int retval;
558 struct p9_fid *fid; 558 struct p9_fid *fid;
559 struct p9_iattr_dotl p9attr; 559 struct p9_iattr_dotl p9attr;
560 struct inode *inode = dentry->d_inode; 560 struct inode *inode = d_inode(dentry);
561 561
562 p9_debug(P9_DEBUG_VFS, "\n"); 562 p9_debug(P9_DEBUG_VFS, "\n");
563 563
@@ -795,10 +795,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
795 if (IS_ERR(fid)) 795 if (IS_ERR(fid))
796 return PTR_ERR(fid); 796 return PTR_ERR(fid);
797 797
798 v9fs_refresh_inode_dotl(fid, old_dentry->d_inode); 798 v9fs_refresh_inode_dotl(fid, d_inode(old_dentry));
799 } 799 }
800 ihold(old_dentry->d_inode); 800 ihold(d_inode(old_dentry));
801 d_instantiate(dentry, old_dentry->d_inode); 801 d_instantiate(dentry, d_inode(old_dentry));
802 802
803 return err; 803 return err;
804} 804}
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 0afd0382822b..e99a338a4638 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -168,8 +168,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
168 retval = PTR_ERR(st); 168 retval = PTR_ERR(st);
169 goto release_sb; 169 goto release_sb;
170 } 170 }
171 root->d_inode->i_ino = v9fs_qid2ino(&st->qid); 171 d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
172 v9fs_stat2inode_dotl(st, root->d_inode); 172 v9fs_stat2inode_dotl(st, d_inode(root));
173 kfree(st); 173 kfree(st);
174 } else { 174 } else {
175 struct p9_wstat *st = NULL; 175 struct p9_wstat *st = NULL;
@@ -179,8 +179,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
179 goto release_sb; 179 goto release_sb;
180 } 180 }
181 181
182 root->d_inode->i_ino = v9fs_qid2ino(&st->qid); 182 d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
183 v9fs_stat2inode(st, root->d_inode, sb); 183 v9fs_stat2inode(st, d_inode(root), sb);
184 184
185 p9stat_free(st); 185 p9stat_free(st);
186 kfree(st); 186 kfree(st);
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index b9acadafa4a1..335055d828e4 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -298,7 +298,7 @@ out:
298int 298int
299adfs_notify_change(struct dentry *dentry, struct iattr *attr) 299adfs_notify_change(struct dentry *dentry, struct iattr *attr)
300{ 300{
301 struct inode *inode = dentry->d_inode; 301 struct inode *inode = d_inode(dentry);
302 struct super_block *sb = inode->i_sb; 302 struct super_block *sb = inode->i_sb;
303 unsigned int ia_valid = attr->ia_valid; 303 unsigned int ia_valid = attr->ia_valid;
304 int error; 304 int error;
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 388da1ea815d..40eb5814b98c 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -138,7 +138,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino)
138static int 138static int
139affs_remove_link(struct dentry *dentry) 139affs_remove_link(struct dentry *dentry)
140{ 140{
141 struct inode *dir, *inode = dentry->d_inode; 141 struct inode *dir, *inode = d_inode(dentry);
142 struct super_block *sb = inode->i_sb; 142 struct super_block *sb = inode->i_sb;
143 struct buffer_head *bh = NULL, *link_bh = NULL; 143 struct buffer_head *bh = NULL, *link_bh = NULL;
144 u32 link_ino, ino; 144 u32 link_ino, ino;
@@ -268,11 +268,11 @@ affs_remove_header(struct dentry *dentry)
268 struct buffer_head *bh = NULL; 268 struct buffer_head *bh = NULL;
269 int retval; 269 int retval;
270 270
271 dir = dentry->d_parent->d_inode; 271 dir = d_inode(dentry->d_parent);
272 sb = dir->i_sb; 272 sb = dir->i_sb;
273 273
274 retval = -ENOENT; 274 retval = -ENOENT;
275 inode = dentry->d_inode; 275 inode = d_inode(dentry);
276 if (!inode) 276 if (!inode)
277 goto done; 277 goto done;
278 278
@@ -471,7 +471,7 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
471bool 471bool
472affs_nofilenametruncate(const struct dentry *dentry) 472affs_nofilenametruncate(const struct dentry *dentry)
473{ 473{
474 struct inode *inode = dentry->d_inode; 474 struct inode *inode = d_inode(dentry);
475 return AFFS_SB(inode->i_sb)->s_flags & SF_NO_TRUNCATE; 475 return AFFS_SB(inode->i_sb)->s_flags & SF_NO_TRUNCATE;
476 476
477} 477}
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 6f34510449e8..57ed17137a13 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -212,7 +212,7 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
212int 212int
213affs_notify_change(struct dentry *dentry, struct iattr *attr) 213affs_notify_change(struct dentry *dentry, struct iattr *attr)
214{ 214{
215 struct inode *inode = dentry->d_inode; 215 struct inode *inode = d_inode(dentry);
216 int error; 216 int error;
217 217
218 pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); 218 pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index ffb7bd82c2a5..372100288ee5 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -250,7 +250,7 @@ int
250affs_unlink(struct inode *dir, struct dentry *dentry) 250affs_unlink(struct inode *dir, struct dentry *dentry)
251{ 251{
252 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, 252 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
253 dentry->d_inode->i_ino, dentry); 253 d_inode(dentry)->i_ino, dentry);
254 254
255 return affs_remove_header(dentry); 255 return affs_remove_header(dentry);
256} 256}
@@ -318,7 +318,7 @@ int
318affs_rmdir(struct inode *dir, struct dentry *dentry) 318affs_rmdir(struct inode *dir, struct dentry *dentry)
319{ 319{
320 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, 320 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
321 dentry->d_inode->i_ino, dentry); 321 d_inode(dentry)->i_ino, dentry);
322 322
323 return affs_remove_header(dentry); 323 return affs_remove_header(dentry);
324} 324}
@@ -401,7 +401,7 @@ err:
401int 401int
402affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 402affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
403{ 403{
404 struct inode *inode = old_dentry->d_inode; 404 struct inode *inode = d_inode(old_dentry);
405 405
406 pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, 406 pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino,
407 dentry); 407 dentry);
@@ -428,13 +428,13 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
428 return retval; 428 return retval;
429 429
430 /* Unlink destination if it already exists */ 430 /* Unlink destination if it already exists */
431 if (new_dentry->d_inode) { 431 if (d_really_is_positive(new_dentry)) {
432 retval = affs_remove_header(new_dentry); 432 retval = affs_remove_header(new_dentry);
433 if (retval) 433 if (retval)
434 return retval; 434 return retval;
435 } 435 }
436 436
437 bh = affs_bread(sb, old_dentry->d_inode->i_ino); 437 bh = affs_bread(sb, d_inode(old_dentry)->i_ino);
438 if (!bh) 438 if (!bh)
439 return -EIO; 439 return -EIO;
440 440
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 4ec35e9130e1..e10e17788f06 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -505,7 +505,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
505 _enter("{%x:%u},%p{%pd},", 505 _enter("{%x:%u},%p{%pd},",
506 vnode->fid.vid, vnode->fid.vnode, dentry, dentry); 506 vnode->fid.vid, vnode->fid.vnode, dentry, dentry);
507 507
508 ASSERTCMP(dentry->d_inode, ==, NULL); 508 ASSERTCMP(d_inode(dentry), ==, NULL);
509 509
510 if (dentry->d_name.len >= AFSNAMEMAX) { 510 if (dentry->d_name.len >= AFSNAMEMAX) {
511 _leave(" = -ENAMETOOLONG"); 511 _leave(" = -ENAMETOOLONG");
@@ -563,8 +563,8 @@ success:
563 _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%u }", 563 _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%u }",
564 fid.vnode, 564 fid.vnode,
565 fid.unique, 565 fid.unique,
566 dentry->d_inode->i_ino, 566 d_inode(dentry)->i_ino,
567 dentry->d_inode->i_generation); 567 d_inode(dentry)->i_generation);
568 568
569 return NULL; 569 return NULL;
570} 570}
@@ -586,9 +586,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
586 if (flags & LOOKUP_RCU) 586 if (flags & LOOKUP_RCU)
587 return -ECHILD; 587 return -ECHILD;
588 588
589 vnode = AFS_FS_I(dentry->d_inode); 589 vnode = AFS_FS_I(d_inode(dentry));
590 590
591 if (dentry->d_inode) 591 if (d_really_is_positive(dentry))
592 _enter("{v={%x:%u} n=%pd fl=%lx},", 592 _enter("{v={%x:%u} n=%pd fl=%lx},",
593 vnode->fid.vid, vnode->fid.vnode, dentry, 593 vnode->fid.vid, vnode->fid.vnode, dentry,
594 vnode->flags); 594 vnode->flags);
@@ -601,7 +601,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
601 601
602 /* lock down the parent dentry so we can peer at it */ 602 /* lock down the parent dentry so we can peer at it */
603 parent = dget_parent(dentry); 603 parent = dget_parent(dentry);
604 dir = AFS_FS_I(parent->d_inode); 604 dir = AFS_FS_I(d_inode(parent));
605 605
606 /* validate the parent directory */ 606 /* validate the parent directory */
607 if (test_bit(AFS_VNODE_MODIFIED, &dir->flags)) 607 if (test_bit(AFS_VNODE_MODIFIED, &dir->flags))
@@ -623,9 +623,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
623 switch (ret) { 623 switch (ret) {
624 case 0: 624 case 0:
625 /* the filename maps to something */ 625 /* the filename maps to something */
626 if (!dentry->d_inode) 626 if (d_really_is_negative(dentry))
627 goto out_bad; 627 goto out_bad;
628 if (is_bad_inode(dentry->d_inode)) { 628 if (is_bad_inode(d_inode(dentry))) {
629 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", 629 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n",
630 dentry); 630 dentry);
631 goto out_bad; 631 goto out_bad;
@@ -647,7 +647,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
647 _debug("%pd: file deleted (uq %u -> %u I:%u)", 647 _debug("%pd: file deleted (uq %u -> %u I:%u)",
648 dentry, fid.unique, 648 dentry, fid.unique,
649 vnode->fid.unique, 649 vnode->fid.unique,
650 dentry->d_inode->i_generation); 650 d_inode(dentry)->i_generation);
651 spin_lock(&vnode->lock); 651 spin_lock(&vnode->lock);
652 set_bit(AFS_VNODE_DELETED, &vnode->flags); 652 set_bit(AFS_VNODE_DELETED, &vnode->flags);
653 spin_unlock(&vnode->lock); 653 spin_unlock(&vnode->lock);
@@ -658,7 +658,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
658 case -ENOENT: 658 case -ENOENT:
659 /* the filename is unknown */ 659 /* the filename is unknown */
660 _debug("%pd: dirent not found", dentry); 660 _debug("%pd: dirent not found", dentry);
661 if (dentry->d_inode) 661 if (d_really_is_positive(dentry))
662 goto not_found; 662 goto not_found;
663 goto out_valid; 663 goto out_valid;
664 664
@@ -703,9 +703,9 @@ static int afs_d_delete(const struct dentry *dentry)
703 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) 703 if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
704 goto zap; 704 goto zap;
705 705
706 if (dentry->d_inode && 706 if (d_really_is_positive(dentry) &&
707 (test_bit(AFS_VNODE_DELETED, &AFS_FS_I(dentry->d_inode)->flags) || 707 (test_bit(AFS_VNODE_DELETED, &AFS_FS_I(d_inode(dentry))->flags) ||
708 test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(dentry->d_inode)->flags))) 708 test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(d_inode(dentry))->flags)))
709 goto zap; 709 goto zap;
710 710
711 _leave(" = 0 [keep]"); 711 _leave(" = 0 [keep]");
@@ -814,8 +814,8 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
814 if (ret < 0) 814 if (ret < 0)
815 goto rmdir_error; 815 goto rmdir_error;
816 816
817 if (dentry->d_inode) { 817 if (d_really_is_positive(dentry)) {
818 vnode = AFS_FS_I(dentry->d_inode); 818 vnode = AFS_FS_I(d_inode(dentry));
819 clear_nlink(&vnode->vfs_inode); 819 clear_nlink(&vnode->vfs_inode);
820 set_bit(AFS_VNODE_DELETED, &vnode->flags); 820 set_bit(AFS_VNODE_DELETED, &vnode->flags);
821 afs_discard_callback_on_delete(vnode); 821 afs_discard_callback_on_delete(vnode);
@@ -856,8 +856,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
856 goto error; 856 goto error;
857 } 857 }
858 858
859 if (dentry->d_inode) { 859 if (d_really_is_positive(dentry)) {
860 vnode = AFS_FS_I(dentry->d_inode); 860 vnode = AFS_FS_I(d_inode(dentry));
861 861
862 /* make sure we have a callback promise on the victim */ 862 /* make sure we have a callback promise on the victim */
863 ret = afs_validate(vnode, key); 863 ret = afs_validate(vnode, key);
@@ -869,7 +869,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
869 if (ret < 0) 869 if (ret < 0)
870 goto remove_error; 870 goto remove_error;
871 871
872 if (dentry->d_inode) { 872 if (d_really_is_positive(dentry)) {
873 /* if the file wasn't deleted due to excess hard links, the 873 /* if the file wasn't deleted due to excess hard links, the
874 * fileserver will break the callback promise on the file - if 874 * fileserver will break the callback promise on the file - if
875 * it had one - before it returns to us, and if it was deleted, 875 * it had one - before it returns to us, and if it was deleted,
@@ -879,7 +879,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
879 * or it was outstanding on a different server, then it won't 879 * or it was outstanding on a different server, then it won't
880 * break it either... 880 * break it either...
881 */ 881 */
882 vnode = AFS_FS_I(dentry->d_inode); 882 vnode = AFS_FS_I(d_inode(dentry));
883 if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) 883 if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
884 _debug("AFS_VNODE_DELETED"); 884 _debug("AFS_VNODE_DELETED");
885 if (test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags)) 885 if (test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags))
@@ -977,7 +977,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
977 struct key *key; 977 struct key *key;
978 int ret; 978 int ret;
979 979
980 vnode = AFS_FS_I(from->d_inode); 980 vnode = AFS_FS_I(d_inode(from));
981 dvnode = AFS_FS_I(dir); 981 dvnode = AFS_FS_I(dir);
982 982
983 _enter("{%x:%u},{%x:%u},{%pd}", 983 _enter("{%x:%u},{%x:%u},{%pd}",
@@ -1089,7 +1089,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
1089 struct key *key; 1089 struct key *key;
1090 int ret; 1090 int ret;
1091 1091
1092 vnode = AFS_FS_I(old_dentry->d_inode); 1092 vnode = AFS_FS_I(d_inode(old_dentry));
1093 orig_dvnode = AFS_FS_I(old_dir); 1093 orig_dvnode = AFS_FS_I(old_dir);
1094 new_dvnode = AFS_FS_I(new_dir); 1094 new_dvnode = AFS_FS_I(new_dir);
1095 1095
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 8a1d38ef0fc2..e06f5a23352a 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -379,7 +379,7 @@ int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
379{ 379{
380 struct inode *inode; 380 struct inode *inode;
381 381
382 inode = dentry->d_inode; 382 inode = d_inode(dentry);
383 383
384 _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); 384 _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
385 385
@@ -458,7 +458,7 @@ void afs_evict_inode(struct inode *inode)
458 */ 458 */
459int afs_setattr(struct dentry *dentry, struct iattr *attr) 459int afs_setattr(struct dentry *dentry, struct iattr *attr)
460{ 460{
461 struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); 461 struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
462 struct key *key; 462 struct key *key;
463 int ret; 463 int ret;
464 464
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 938c5ab06d5a..ccd0b212e82a 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -134,7 +134,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
134 134
135 _enter("{%pd}", mntpt); 135 _enter("{%pd}", mntpt);
136 136
137 BUG_ON(!mntpt->d_inode); 137 BUG_ON(!d_inode(mntpt));
138 138
139 ret = -ENOMEM; 139 ret = -ENOMEM;
140 devname = (char *) get_zeroed_page(GFP_KERNEL); 140 devname = (char *) get_zeroed_page(GFP_KERNEL);
@@ -145,7 +145,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
145 if (!options) 145 if (!options)
146 goto error_no_options; 146 goto error_no_options;
147 147
148 vnode = AFS_FS_I(mntpt->d_inode); 148 vnode = AFS_FS_I(d_inode(mntpt));
149 if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) { 149 if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) {
150 /* if the directory is a pseudo directory, use the d_name */ 150 /* if the directory is a pseudo directory, use the d_name */
151 static const char afs_root_cell[] = ":root.cell."; 151 static const char afs_root_cell[] = ":root.cell.";
@@ -169,14 +169,14 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
169 } 169 }
170 } else { 170 } else {
171 /* read the contents of the AFS special symlink */ 171 /* read the contents of the AFS special symlink */
172 loff_t size = i_size_read(mntpt->d_inode); 172 loff_t size = i_size_read(d_inode(mntpt));
173 char *buf; 173 char *buf;
174 174
175 ret = -EINVAL; 175 ret = -EINVAL;
176 if (size > PAGE_SIZE - 1) 176 if (size > PAGE_SIZE - 1)
177 goto error_no_page; 177 goto error_no_page;
178 178
179 page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); 179 page = read_mapping_page(d_inode(mntpt)->i_mapping, 0, NULL);
180 if (IS_ERR(page)) { 180 if (IS_ERR(page)) {
181 ret = PTR_ERR(page); 181 ret = PTR_ERR(page);
182 goto error_no_page; 182 goto error_no_page;
diff --git a/fs/afs/super.c b/fs/afs/super.c
index c4861557e385..1fb4a5129f7d 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -529,7 +529,7 @@ static void afs_destroy_inode(struct inode *inode)
529static int afs_statfs(struct dentry *dentry, struct kstatfs *buf) 529static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
530{ 530{
531 struct afs_volume_status vs; 531 struct afs_volume_status vs;
532 struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); 532 struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
533 struct key *key; 533 struct key *key;
534 int ret; 534 int ret;
535 535
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index d10e619632ab..5b700ef1e59d 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -235,12 +235,12 @@ static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi)
235 235
236static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi) 236static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi)
237{ 237{
238 return sbi->sb->s_root->d_inode->i_ino; 238 return d_inode(sbi->sb->s_root)->i_ino;
239} 239}
240 240
241static inline int simple_positive(struct dentry *dentry) 241static inline int simple_positive(struct dentry *dentry)
242{ 242{
243 return dentry->d_inode && !d_unhashed(dentry); 243 return d_really_is_positive(dentry) && !d_unhashed(dentry);
244} 244}
245 245
246static inline void __autofs4_add_expiring(struct dentry *dentry) 246static inline void __autofs4_add_expiring(struct dentry *dentry)
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 11dd118f75e2..1cebc3c52fa5 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -374,7 +374,7 @@ static struct dentry *should_expire(struct dentry *dentry,
374 return NULL; 374 return NULL;
375 } 375 }
376 376
377 if (dentry->d_inode && d_is_symlink(dentry)) { 377 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) {
378 DPRINTK("checking symlink %p %pd", dentry, dentry); 378 DPRINTK("checking symlink %p %pd", dentry, dentry);
379 /* 379 /*
380 * A symlink can't be "busy" in the usual sense so 380 * A symlink can't be "busy" in the usual sense so
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 1c55388ae633..a3ae0b2aeb5a 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -71,7 +71,7 @@ void autofs4_kill_sb(struct super_block *sb)
71static int autofs4_show_options(struct seq_file *m, struct dentry *root) 71static int autofs4_show_options(struct seq_file *m, struct dentry *root)
72{ 72{
73 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); 73 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
74 struct inode *root_inode = root->d_sb->s_root->d_inode; 74 struct inode *root_inode = d_inode(root->d_sb->s_root);
75 75
76 if (!sbi) 76 if (!sbi)
77 return 0; 77 return 0;
@@ -352,8 +352,8 @@ struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode)
352 352
353 inode->i_mode = mode; 353 inode->i_mode = mode;
354 if (sb->s_root) { 354 if (sb->s_root) {
355 inode->i_uid = sb->s_root->d_inode->i_uid; 355 inode->i_uid = d_inode(sb->s_root)->i_uid;
356 inode->i_gid = sb->s_root->d_inode->i_gid; 356 inode->i_gid = d_inode(sb->s_root)->i_gid;
357 } 357 }
358 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 358 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
359 inode->i_ino = get_next_ino(); 359 inode->i_ino = get_next_ino();
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 7e44fdd03e2d..c6d7d3dbd52a 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -240,7 +240,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
240 spin_lock(&expiring->d_lock); 240 spin_lock(&expiring->d_lock);
241 241
242 /* We've already been dentry_iput or unlinked */ 242 /* We've already been dentry_iput or unlinked */
243 if (!expiring->d_inode) 243 if (d_really_is_negative(expiring))
244 goto next; 244 goto next;
245 245
246 qstr = &expiring->d_name; 246 qstr = &expiring->d_name;
@@ -371,7 +371,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
371 * having d_mountpoint() true, so there's no need to call back 371 * having d_mountpoint() true, so there's no need to call back
372 * to the daemon. 372 * to the daemon.
373 */ 373 */
374 if (dentry->d_inode && d_is_symlink(dentry)) { 374 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) {
375 spin_unlock(&sbi->fs_lock); 375 spin_unlock(&sbi->fs_lock);
376 goto done; 376 goto done;
377 } 377 }
@@ -459,7 +459,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk)
459 return 0; 459 return 0;
460 if (d_mountpoint(dentry)) 460 if (d_mountpoint(dentry))
461 return 0; 461 return 0;
462 inode = ACCESS_ONCE(dentry->d_inode); 462 inode = d_inode_rcu(dentry);
463 if (inode && S_ISLNK(inode->i_mode)) 463 if (inode && S_ISLNK(inode->i_mode))
464 return -EISDIR; 464 return -EISDIR;
465 if (list_empty(&dentry->d_subdirs)) 465 if (list_empty(&dentry->d_subdirs))
@@ -485,7 +485,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk)
485 * an incorrect ELOOP error return. 485 * an incorrect ELOOP error return.
486 */ 486 */
487 if ((!d_mountpoint(dentry) && !simple_empty(dentry)) || 487 if ((!d_mountpoint(dentry) && !simple_empty(dentry)) ||
488 (dentry->d_inode && d_is_symlink(dentry))) 488 (d_really_is_positive(dentry) && d_is_symlink(dentry)))
489 status = -EISDIR; 489 status = -EISDIR;
490 } 490 }
491 spin_unlock(&sbi->fs_lock); 491 spin_unlock(&sbi->fs_lock);
@@ -625,8 +625,8 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
625 } 625 }
626 dput(ino->dentry); 626 dput(ino->dentry);
627 627
628 dentry->d_inode->i_size = 0; 628 d_inode(dentry)->i_size = 0;
629 clear_nlink(dentry->d_inode); 629 clear_nlink(d_inode(dentry));
630 630
631 dir->i_mtime = CURRENT_TIME; 631 dir->i_mtime = CURRENT_TIME;
632 632
@@ -719,8 +719,8 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
719 atomic_dec(&p_ino->count); 719 atomic_dec(&p_ino->count);
720 } 720 }
721 dput(ino->dentry); 721 dput(ino->dentry);
722 dentry->d_inode->i_size = 0; 722 d_inode(dentry)->i_size = 0;
723 clear_nlink(dentry->d_inode); 723 clear_nlink(d_inode(dentry));
724 724
725 if (dir->i_nlink) 725 if (dir->i_nlink)
726 drop_nlink(dir); 726 drop_nlink(dir);
@@ -839,7 +839,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
839*/ 839*/
840int is_autofs4_dentry(struct dentry *dentry) 840int is_autofs4_dentry(struct dentry *dentry)
841{ 841{
842 return dentry && dentry->d_inode && 842 return dentry && d_really_is_positive(dentry) &&
843 dentry->d_op == &autofs4_dentry_operations && 843 dentry->d_op == &autofs4_dentry_operations &&
844 dentry->d_fsdata != NULL; 844 dentry->d_fsdata != NULL;
845} 845}
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c
index 1e8ea192be2b..de58cc7b8076 100644
--- a/fs/autofs4/symlink.c
+++ b/fs/autofs4/symlink.c
@@ -18,7 +18,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
18 struct autofs_info *ino = autofs4_dentry_ino(dentry); 18 struct autofs_info *ino = autofs4_dentry_ino(dentry);
19 if (ino && !autofs4_oz_mode(sbi)) 19 if (ino && !autofs4_oz_mode(sbi))
20 ino->last_used = jiffies; 20 ino->last_used = jiffies;
21 nd_set_link(nd, dentry->d_inode->i_private); 21 nd_set_link(nd, d_inode(dentry)->i_private);
22 return NULL; 22 return NULL;
23} 23}
24 24
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 2ad05ab93db8..35b755e79c2d 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -322,7 +322,7 @@ static int validate_request(struct autofs_wait_queue **wait,
322 * continue on and create a new request. 322 * continue on and create a new request.
323 */ 323 */
324 if (!IS_ROOT(dentry)) { 324 if (!IS_ROOT(dentry)) {
325 if (dentry->d_inode && d_unhashed(dentry)) { 325 if (d_really_is_positive(dentry) && d_unhashed(dentry)) {
326 struct dentry *parent = dentry->d_parent; 326 struct dentry *parent = dentry->d_parent;
327 new = d_lookup(parent, &dentry->d_name); 327 new = d_lookup(parent, &dentry->d_name);
328 if (new) 328 if (new)
@@ -364,7 +364,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
364 if (pid == 0 || tgid == 0) 364 if (pid == 0 || tgid == 0)
365 return -ENOENT; 365 return -ENOENT;
366 366
367 if (!dentry->d_inode) { 367 if (d_really_is_negative(dentry)) {
368 /* 368 /*
369 * A wait for a negative dentry is invalid for certain 369 * A wait for a negative dentry is invalid for certain
370 * cases. A direct or offset mount "always" has its mount 370 * cases. A direct or offset mount "always" has its mount
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index e089f1985fca..d3cb8774765f 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -472,7 +472,7 @@ static void *
472befs_follow_link(struct dentry *dentry, struct nameidata *nd) 472befs_follow_link(struct dentry *dentry, struct nameidata *nd)
473{ 473{
474 struct super_block *sb = dentry->d_sb; 474 struct super_block *sb = dentry->d_sb;
475 befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); 475 befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
476 befs_data_stream *data = &befs_ino->i_data.ds; 476 befs_data_stream *data = &befs_ino->i_data.ds;
477 befs_off_t len = data->size; 477 befs_off_t len = data->size;
478 char *link; 478 char *link;
@@ -502,7 +502,7 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd)
502static void * 502static void *
503befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) 503befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
504{ 504{
505 befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); 505 befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
506 nd_set_link(nd, befs_ino->i_data.symlink); 506 nd_set_link(nd, befs_ino->i_data.symlink);
507 return NULL; 507 return NULL;
508} 508}
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 08063ae0a17c..7efed2ad7eea 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -153,7 +153,7 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
153static int bfs_link(struct dentry *old, struct inode *dir, 153static int bfs_link(struct dentry *old, struct inode *dir,
154 struct dentry *new) 154 struct dentry *new)
155{ 155{
156 struct inode *inode = old->d_inode; 156 struct inode *inode = d_inode(old);
157 struct bfs_sb_info *info = BFS_SB(inode->i_sb); 157 struct bfs_sb_info *info = BFS_SB(inode->i_sb);
158 int err; 158 int err;
159 159
@@ -176,7 +176,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
176static int bfs_unlink(struct inode *dir, struct dentry *dentry) 176static int bfs_unlink(struct inode *dir, struct dentry *dentry)
177{ 177{
178 int error = -ENOENT; 178 int error = -ENOENT;
179 struct inode *inode = dentry->d_inode; 179 struct inode *inode = d_inode(dentry);
180 struct buffer_head *bh; 180 struct buffer_head *bh;
181 struct bfs_dirent *de; 181 struct bfs_dirent *de;
182 struct bfs_sb_info *info = BFS_SB(inode->i_sb); 182 struct bfs_sb_info *info = BFS_SB(inode->i_sb);
@@ -216,7 +216,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
216 int error = -ENOENT; 216 int error = -ENOENT;
217 217
218 old_bh = new_bh = NULL; 218 old_bh = new_bh = NULL;
219 old_inode = old_dentry->d_inode; 219 old_inode = d_inode(old_dentry);
220 if (S_ISDIR(old_inode->i_mode)) 220 if (S_ISDIR(old_inode->i_mode))
221 return -EINVAL; 221 return -EINVAL;
222 222
@@ -231,7 +231,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
231 goto end_rename; 231 goto end_rename;
232 232
233 error = -EPERM; 233 error = -EPERM;
234 new_inode = new_dentry->d_inode; 234 new_inode = d_inode(new_dentry);
235 new_bh = bfs_find_entry(new_dir, 235 new_bh = bfs_find_entry(new_dir,
236 new_dentry->d_name.name, 236 new_dentry->d_name.name,
237 new_dentry->d_name.len, &new_de); 237 new_dentry->d_name.len, &new_de);
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 37d164540c3a..8d052209f473 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -152,7 +152,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
152 152
153static struct dentry *btrfs_get_parent(struct dentry *child) 153static struct dentry *btrfs_get_parent(struct dentry *child)
154{ 154{
155 struct inode *dir = child->d_inode; 155 struct inode *dir = d_inode(child);
156 struct btrfs_root *root = BTRFS_I(dir)->root; 156 struct btrfs_root *root = BTRFS_I(dir)->root;
157 struct btrfs_path *path; 157 struct btrfs_path *path;
158 struct extent_buffer *leaf; 158 struct extent_buffer *leaf;
@@ -220,8 +220,8 @@ fail:
220static int btrfs_get_name(struct dentry *parent, char *name, 220static int btrfs_get_name(struct dentry *parent, char *name,
221 struct dentry *child) 221 struct dentry *child)
222{ 222{
223 struct inode *inode = child->d_inode; 223 struct inode *inode = d_inode(child);
224 struct inode *dir = parent->d_inode; 224 struct inode *dir = d_inode(parent);
225 struct btrfs_path *path; 225 struct btrfs_path *path;
226 struct btrfs_root *root = BTRFS_I(dir)->root; 226 struct btrfs_root *root = BTRFS_I(dir)->root;
227 struct btrfs_inode_ref *iref; 227 struct btrfs_inode_ref *iref;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index faa7d390841b..2e57064c3cdf 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1864,7 +1864,7 @@ static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end)
1864int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) 1864int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1865{ 1865{
1866 struct dentry *dentry = file->f_path.dentry; 1866 struct dentry *dentry = file->f_path.dentry;
1867 struct inode *inode = dentry->d_inode; 1867 struct inode *inode = d_inode(dentry);
1868 struct btrfs_root *root = BTRFS_I(inode)->root; 1868 struct btrfs_root *root = BTRFS_I(inode)->root;
1869 struct btrfs_trans_handle *trans; 1869 struct btrfs_trans_handle *trans;
1870 struct btrfs_log_ctx ctx; 1870 struct btrfs_log_ctx ctx;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 43192e10cc43..811576346a92 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4016,16 +4016,16 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
4016{ 4016{
4017 struct btrfs_root *root = BTRFS_I(dir)->root; 4017 struct btrfs_root *root = BTRFS_I(dir)->root;
4018 struct btrfs_trans_handle *trans; 4018 struct btrfs_trans_handle *trans;
4019 struct inode *inode = dentry->d_inode; 4019 struct inode *inode = d_inode(dentry);
4020 int ret; 4020 int ret;
4021 4021
4022 trans = __unlink_start_trans(dir); 4022 trans = __unlink_start_trans(dir);
4023 if (IS_ERR(trans)) 4023 if (IS_ERR(trans))
4024 return PTR_ERR(trans); 4024 return PTR_ERR(trans);
4025 4025
4026 btrfs_record_unlink_dir(trans, dir, dentry->d_inode, 0); 4026 btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0);
4027 4027
4028 ret = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, 4028 ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
4029 dentry->d_name.name, dentry->d_name.len); 4029 dentry->d_name.name, dentry->d_name.len);
4030 if (ret) 4030 if (ret)
4031 goto out; 4031 goto out;
@@ -4124,7 +4124,7 @@ out:
4124 4124
4125static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) 4125static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4126{ 4126{
4127 struct inode *inode = dentry->d_inode; 4127 struct inode *inode = d_inode(dentry);
4128 int err = 0; 4128 int err = 0;
4129 struct btrfs_root *root = BTRFS_I(dir)->root; 4129 struct btrfs_root *root = BTRFS_I(dir)->root;
4130 struct btrfs_trans_handle *trans; 4130 struct btrfs_trans_handle *trans;
@@ -4151,7 +4151,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4151 goto out; 4151 goto out;
4152 4152
4153 /* now the directory is empty */ 4153 /* now the directory is empty */
4154 err = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, 4154 err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
4155 dentry->d_name.name, dentry->d_name.len); 4155 dentry->d_name.name, dentry->d_name.len);
4156 if (!err) 4156 if (!err)
4157 btrfs_i_size_write(inode, 0); 4157 btrfs_i_size_write(inode, 0);
@@ -4826,7 +4826,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
4826 4826
4827static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) 4827static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
4828{ 4828{
4829 struct inode *inode = dentry->d_inode; 4829 struct inode *inode = d_inode(dentry);
4830 struct btrfs_root *root = BTRFS_I(inode)->root; 4830 struct btrfs_root *root = BTRFS_I(inode)->root;
4831 int err; 4831 int err;
4832 4832
@@ -5416,10 +5416,10 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
5416static int btrfs_dentry_delete(const struct dentry *dentry) 5416static int btrfs_dentry_delete(const struct dentry *dentry)
5417{ 5417{
5418 struct btrfs_root *root; 5418 struct btrfs_root *root;
5419 struct inode *inode = dentry->d_inode; 5419 struct inode *inode = d_inode(dentry);
5420 5420
5421 if (!inode && !IS_ROOT(dentry)) 5421 if (!inode && !IS_ROOT(dentry))
5422 inode = dentry->d_parent->d_inode; 5422 inode = d_inode(dentry->d_parent);
5423 5423
5424 if (inode) { 5424 if (inode) {
5425 root = BTRFS_I(inode)->root; 5425 root = BTRFS_I(inode)->root;
@@ -6226,7 +6226,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
6226{ 6226{
6227 struct btrfs_trans_handle *trans; 6227 struct btrfs_trans_handle *trans;
6228 struct btrfs_root *root = BTRFS_I(dir)->root; 6228 struct btrfs_root *root = BTRFS_I(dir)->root;
6229 struct inode *inode = old_dentry->d_inode; 6229 struct inode *inode = d_inode(old_dentry);
6230 u64 index; 6230 u64 index;
6231 int err; 6231 int err;
6232 int drop_inode = 0; 6232 int drop_inode = 0;
@@ -8875,7 +8875,7 @@ static int btrfs_getattr(struct vfsmount *mnt,
8875 struct dentry *dentry, struct kstat *stat) 8875 struct dentry *dentry, struct kstat *stat)
8876{ 8876{
8877 u64 delalloc_bytes; 8877 u64 delalloc_bytes;
8878 struct inode *inode = dentry->d_inode; 8878 struct inode *inode = d_inode(dentry);
8879 u32 blocksize = inode->i_sb->s_blocksize; 8879 u32 blocksize = inode->i_sb->s_blocksize;
8880 8880
8881 generic_fillattr(inode, stat); 8881 generic_fillattr(inode, stat);
@@ -8896,8 +8896,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
8896 struct btrfs_trans_handle *trans; 8896 struct btrfs_trans_handle *trans;
8897 struct btrfs_root *root = BTRFS_I(old_dir)->root; 8897 struct btrfs_root *root = BTRFS_I(old_dir)->root;
8898 struct btrfs_root *dest = BTRFS_I(new_dir)->root; 8898 struct btrfs_root *dest = BTRFS_I(new_dir)->root;
8899 struct inode *new_inode = new_dentry->d_inode; 8899 struct inode *new_inode = d_inode(new_dentry);
8900 struct inode *old_inode = old_dentry->d_inode; 8900 struct inode *old_inode = d_inode(old_dentry);
8901 struct timespec ctime = CURRENT_TIME; 8901 struct timespec ctime = CURRENT_TIME;
8902 u64 index = 0; 8902 u64 index = 0;
8903 u64 root_objectid; 8903 u64 root_objectid;
@@ -9009,7 +9009,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9009 old_dentry->d_name.len); 9009 old_dentry->d_name.len);
9010 } else { 9010 } else {
9011 ret = __btrfs_unlink_inode(trans, root, old_dir, 9011 ret = __btrfs_unlink_inode(trans, root, old_dir,
9012 old_dentry->d_inode, 9012 d_inode(old_dentry),
9013 old_dentry->d_name.name, 9013 old_dentry->d_name.name,
9014 old_dentry->d_name.len); 9014 old_dentry->d_name.len);
9015 if (!ret) 9015 if (!ret)
@@ -9033,12 +9033,12 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9033 BUG_ON(new_inode->i_nlink == 0); 9033 BUG_ON(new_inode->i_nlink == 0);
9034 } else { 9034 } else {
9035 ret = btrfs_unlink_inode(trans, dest, new_dir, 9035 ret = btrfs_unlink_inode(trans, dest, new_dir,
9036 new_dentry->d_inode, 9036 d_inode(new_dentry),
9037 new_dentry->d_name.name, 9037 new_dentry->d_name.name,
9038 new_dentry->d_name.len); 9038 new_dentry->d_name.len);
9039 } 9039 }
9040 if (!ret && new_inode->i_nlink == 0) 9040 if (!ret && new_inode->i_nlink == 0)
9041 ret = btrfs_orphan_add(trans, new_dentry->d_inode); 9041 ret = btrfs_orphan_add(trans, d_inode(new_dentry));
9042 if (ret) { 9042 if (ret) {
9043 btrfs_abort_transaction(trans, root, ret); 9043 btrfs_abort_transaction(trans, root, ret);
9044 goto out_fail; 9044 goto out_fail;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 74609b931ba5..20957ed47ce2 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -717,7 +717,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
717 if (ret) 717 if (ret)
718 goto fail; 718 goto fail;
719 719
720 inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); 720 inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
721 if (IS_ERR(inode)) { 721 if (IS_ERR(inode)) {
722 ret = PTR_ERR(inode); 722 ret = PTR_ERR(inode);
723 goto fail; 723 goto fail;
@@ -761,10 +761,10 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
761{ 761{
762 int error; 762 int error;
763 763
764 if (!victim->d_inode) 764 if (d_really_is_negative(victim))
765 return -ENOENT; 765 return -ENOENT;
766 766
767 BUG_ON(victim->d_parent->d_inode != dir); 767 BUG_ON(d_inode(victim->d_parent) != dir);
768 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); 768 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
769 769
770 error = inode_permission(dir, MAY_WRITE | MAY_EXEC); 770 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
@@ -772,8 +772,8 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
772 return error; 772 return error;
773 if (IS_APPEND(dir)) 773 if (IS_APPEND(dir))
774 return -EPERM; 774 return -EPERM;
775 if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || 775 if (check_sticky(dir, d_inode(victim)) || IS_APPEND(d_inode(victim)) ||
776 IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) 776 IS_IMMUTABLE(d_inode(victim)) || IS_SWAPFILE(d_inode(victim)))
777 return -EPERM; 777 return -EPERM;
778 if (isdir) { 778 if (isdir) {
779 if (!d_is_dir(victim)) 779 if (!d_is_dir(victim))
@@ -792,7 +792,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
792/* copy of may_create in fs/namei.c() */ 792/* copy of may_create in fs/namei.c() */
793static inline int btrfs_may_create(struct inode *dir, struct dentry *child) 793static inline int btrfs_may_create(struct inode *dir, struct dentry *child)
794{ 794{
795 if (child->d_inode) 795 if (d_really_is_positive(child))
796 return -EEXIST; 796 return -EEXIST;
797 if (IS_DEADDIR(dir)) 797 if (IS_DEADDIR(dir))
798 return -ENOENT; 798 return -ENOENT;
@@ -810,7 +810,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
810 u64 *async_transid, bool readonly, 810 u64 *async_transid, bool readonly,
811 struct btrfs_qgroup_inherit *inherit) 811 struct btrfs_qgroup_inherit *inherit)
812{ 812{
813 struct inode *dir = parent->dentry->d_inode; 813 struct inode *dir = d_inode(parent->dentry);
814 struct dentry *dentry; 814 struct dentry *dentry;
815 int error; 815 int error;
816 816
@@ -824,7 +824,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
824 goto out_unlock; 824 goto out_unlock;
825 825
826 error = -EEXIST; 826 error = -EEXIST;
827 if (dentry->d_inode) 827 if (d_really_is_positive(dentry))
828 goto out_dput; 828 goto out_dput;
829 829
830 error = btrfs_may_create(dir, dentry); 830 error = btrfs_may_create(dir, dentry);
@@ -2294,7 +2294,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2294{ 2294{
2295 struct dentry *parent = file->f_path.dentry; 2295 struct dentry *parent = file->f_path.dentry;
2296 struct dentry *dentry; 2296 struct dentry *dentry;
2297 struct inode *dir = parent->d_inode; 2297 struct inode *dir = d_inode(parent);
2298 struct inode *inode; 2298 struct inode *inode;
2299 struct btrfs_root *root = BTRFS_I(dir)->root; 2299 struct btrfs_root *root = BTRFS_I(dir)->root;
2300 struct btrfs_root *dest = NULL; 2300 struct btrfs_root *dest = NULL;
@@ -2333,12 +2333,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2333 goto out_unlock_dir; 2333 goto out_unlock_dir;
2334 } 2334 }
2335 2335
2336 if (!dentry->d_inode) { 2336 if (d_really_is_negative(dentry)) {
2337 err = -ENOENT; 2337 err = -ENOENT;
2338 goto out_dput; 2338 goto out_dput;
2339 } 2339 }
2340 2340
2341 inode = dentry->d_inode; 2341 inode = d_inode(dentry);
2342 dest = BTRFS_I(inode)->root; 2342 dest = BTRFS_I(inode)->root;
2343 if (!capable(CAP_SYS_ADMIN)) { 2343 if (!capable(CAP_SYS_ADMIN)) {
2344 /* 2344 /*
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 05fef198ff94..68ee619fff45 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -916,7 +916,7 @@ setup_root:
916 * a reference to the dentry. We will have already gotten a reference 916 * a reference to the dentry. We will have already gotten a reference
917 * to the inode in btrfs_fill_super so we're good to go. 917 * to the inode in btrfs_fill_super so we're good to go.
918 */ 918 */
919 if (!new && sb->s_root->d_inode == inode) { 919 if (!new && d_inode(sb->s_root) == inode) {
920 iput(inode); 920 iput(inode);
921 return dget(sb->s_root); 921 return dget(sb->s_root);
922 } 922 }
@@ -1221,7 +1221,7 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags,
1221 1221
1222 root = mount_subtree(mnt, subvol_name); 1222 root = mount_subtree(mnt, subvol_name);
1223 1223
1224 if (!IS_ERR(root) && !is_subvolume_inode(root->d_inode)) { 1224 if (!IS_ERR(root) && !is_subvolume_inode(d_inode(root))) {
1225 struct super_block *s = root->d_sb; 1225 struct super_block *s = root->d_sb;
1226 dput(root); 1226 dput(root);
1227 root = ERR_PTR(-EINVAL); 1227 root = ERR_PTR(-EINVAL);
@@ -1886,8 +1886,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1886 buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); 1886 buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]);
1887 buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); 1887 buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]);
1888 /* Mask in the root object ID too, to disambiguate subvols */ 1888 /* Mask in the root object ID too, to disambiguate subvols */
1889 buf->f_fsid.val[0] ^= BTRFS_I(dentry->d_inode)->root->objectid >> 32; 1889 buf->f_fsid.val[0] ^= BTRFS_I(d_inode(dentry))->root->objectid >> 32;
1890 buf->f_fsid.val[1] ^= BTRFS_I(dentry->d_inode)->root->objectid; 1890 buf->f_fsid.val[1] ^= BTRFS_I(d_inode(dentry))->root->objectid;
1891 1891
1892 return 0; 1892 return 0;
1893} 1893}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c5b8ba37f88e..25db71be462a 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4327,9 +4327,9 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4327 goto out; 4327 goto out;
4328 4328
4329 if (!S_ISDIR(inode->i_mode)) { 4329 if (!S_ISDIR(inode->i_mode)) {
4330 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4330 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4331 goto out; 4331 goto out;
4332 inode = parent->d_inode; 4332 inode = d_inode(parent);
4333 } 4333 }
4334 4334
4335 while (1) { 4335 while (1) {
@@ -4355,7 +4355,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4355 break; 4355 break;
4356 } 4356 }
4357 4357
4358 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4358 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4359 break; 4359 break;
4360 4360
4361 if (IS_ROOT(parent)) 4361 if (IS_ROOT(parent))
@@ -4364,7 +4364,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4364 parent = dget_parent(parent); 4364 parent = dget_parent(parent);
4365 dput(old_parent); 4365 dput(old_parent);
4366 old_parent = parent; 4366 old_parent = parent;
4367 inode = parent->d_inode; 4367 inode = d_inode(parent);
4368 4368
4369 } 4369 }
4370 dput(old_parent); 4370 dput(old_parent);
@@ -4450,10 +4450,10 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
4450 } 4450 }
4451 4451
4452 while (1) { 4452 while (1) {
4453 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4453 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4454 break; 4454 break;
4455 4455
4456 inode = parent->d_inode; 4456 inode = d_inode(parent);
4457 if (root != BTRFS_I(inode)->root) 4457 if (root != BTRFS_I(inode)->root)
4458 break; 4458 break;
4459 4459
@@ -4515,7 +4515,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,
4515 struct dentry *parent = dget_parent(dentry); 4515 struct dentry *parent = dget_parent(dentry);
4516 int ret; 4516 int ret;
4517 4517
4518 ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, 4518 ret = btrfs_log_inode_parent(trans, root, d_inode(dentry), parent,
4519 start, end, 0, ctx); 4519 start, end, 0, ctx);
4520 dput(parent); 4520 dput(parent);
4521 4521
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 883b93623bc5..4cca14ecb660 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -261,7 +261,7 @@ out:
261ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) 261ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
262{ 262{
263 struct btrfs_key key, found_key; 263 struct btrfs_key key, found_key;
264 struct inode *inode = dentry->d_inode; 264 struct inode *inode = d_inode(dentry);
265 struct btrfs_root *root = BTRFS_I(inode)->root; 265 struct btrfs_root *root = BTRFS_I(inode)->root;
266 struct btrfs_path *path; 266 struct btrfs_path *path;
267 struct extent_buffer *leaf; 267 struct extent_buffer *leaf;
@@ -390,13 +390,13 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
390 390
391 if (!btrfs_is_valid_xattr(name)) 391 if (!btrfs_is_valid_xattr(name))
392 return -EOPNOTSUPP; 392 return -EOPNOTSUPP;
393 return __btrfs_getxattr(dentry->d_inode, name, buffer, size); 393 return __btrfs_getxattr(d_inode(dentry), name, buffer, size);
394} 394}
395 395
396int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, 396int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
397 size_t size, int flags) 397 size_t size, int flags)
398{ 398{
399 struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; 399 struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root;
400 400
401 /* 401 /*
402 * The permission on security.* and system.* is not checked 402 * The permission on security.* and system.* is not checked
@@ -417,19 +417,19 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
417 return -EOPNOTSUPP; 417 return -EOPNOTSUPP;
418 418
419 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) 419 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
420 return btrfs_set_prop(dentry->d_inode, name, 420 return btrfs_set_prop(d_inode(dentry), name,
421 value, size, flags); 421 value, size, flags);
422 422
423 if (size == 0) 423 if (size == 0)
424 value = ""; /* empty EA, do not remove */ 424 value = ""; /* empty EA, do not remove */
425 425
426 return __btrfs_setxattr(NULL, dentry->d_inode, name, value, size, 426 return __btrfs_setxattr(NULL, d_inode(dentry), name, value, size,
427 flags); 427 flags);
428} 428}
429 429
430int btrfs_removexattr(struct dentry *dentry, const char *name) 430int btrfs_removexattr(struct dentry *dentry, const char *name)
431{ 431{
432 struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; 432 struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root;
433 433
434 /* 434 /*
435 * The permission on security.* and system.* is not checked 435 * The permission on security.* and system.* is not checked
@@ -450,10 +450,10 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
450 return -EOPNOTSUPP; 450 return -EOPNOTSUPP;
451 451
452 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) 452 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
453 return btrfs_set_prop(dentry->d_inode, name, 453 return btrfs_set_prop(d_inode(dentry), name,
454 NULL, 0, XATTR_REPLACE); 454 NULL, 0, XATTR_REPLACE);
455 455
456 return __btrfs_setxattr(NULL, dentry->d_inode, name, NULL, 0, 456 return __btrfs_setxattr(NULL, d_inode(dentry), name, NULL, 0,
457 XATTR_REPLACE); 457 XATTR_REPLACE);
458} 458}
459 459
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 8172775428a0..283cf69c6904 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3391,7 +3391,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode,
3391int ceph_encode_dentry_release(void **p, struct dentry *dentry, 3391int ceph_encode_dentry_release(void **p, struct dentry *dentry,
3392 int mds, int drop, int unless) 3392 int mds, int drop, int unless)
3393{ 3393{
3394 struct inode *dir = dentry->d_parent->d_inode; 3394 struct inode *dir = d_inode(dentry->d_parent);
3395 struct ceph_mds_request_release *rel = *p; 3395 struct ceph_mds_request_release *rel = *p;
3396 struct ceph_dentry_info *di = ceph_dentry(dentry); 3396 struct ceph_dentry_info *di = ceph_dentry(dentry);
3397 int force = 0; 3397 int force = 0;
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 1b2355109b9f..31f831471ed2 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -84,7 +84,7 @@ static int mdsc_show(struct seq_file *s, void *p)
84 path = NULL; 84 path = NULL;
85 spin_lock(&req->r_dentry->d_lock); 85 spin_lock(&req->r_dentry->d_lock);
86 seq_printf(s, " #%llx/%pd (%s)", 86 seq_printf(s, " #%llx/%pd (%s)",
87 ceph_ino(req->r_dentry->d_parent->d_inode), 87 ceph_ino(d_inode(req->r_dentry->d_parent)),
88 req->r_dentry, 88 req->r_dentry,
89 path ? path : ""); 89 path ? path : "");
90 spin_unlock(&req->r_dentry->d_lock); 90 spin_unlock(&req->r_dentry->d_lock);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 83e9976f7189..173fc598c7f1 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -49,9 +49,9 @@ int ceph_init_dentry(struct dentry *dentry)
49 goto out_unlock; 49 goto out_unlock;
50 } 50 }
51 51
52 if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) 52 if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP)
53 d_set_d_op(dentry, &ceph_dentry_ops); 53 d_set_d_op(dentry, &ceph_dentry_ops);
54 else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) 54 else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR)
55 d_set_d_op(dentry, &ceph_snapdir_dentry_ops); 55 d_set_d_op(dentry, &ceph_snapdir_dentry_ops);
56 else 56 else
57 d_set_d_op(dentry, &ceph_snap_dentry_ops); 57 d_set_d_op(dentry, &ceph_snap_dentry_ops);
@@ -77,7 +77,7 @@ struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry)
77 77
78 spin_lock(&dentry->d_lock); 78 spin_lock(&dentry->d_lock);
79 if (!IS_ROOT(dentry)) { 79 if (!IS_ROOT(dentry)) {
80 inode = dentry->d_parent->d_inode; 80 inode = d_inode(dentry->d_parent);
81 ihold(inode); 81 ihold(inode);
82 } 82 }
83 spin_unlock(&dentry->d_lock); 83 spin_unlock(&dentry->d_lock);
@@ -122,7 +122,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
122{ 122{
123 struct ceph_file_info *fi = file->private_data; 123 struct ceph_file_info *fi = file->private_data;
124 struct dentry *parent = file->f_path.dentry; 124 struct dentry *parent = file->f_path.dentry;
125 struct inode *dir = parent->d_inode; 125 struct inode *dir = d_inode(parent);
126 struct list_head *p; 126 struct list_head *p;
127 struct dentry *dentry, *last; 127 struct dentry *dentry, *last;
128 struct ceph_dentry_info *di; 128 struct ceph_dentry_info *di;
@@ -161,15 +161,15 @@ more:
161 } 161 }
162 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 162 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
163 if (di->lease_shared_gen == shared_gen && 163 if (di->lease_shared_gen == shared_gen &&
164 !d_unhashed(dentry) && dentry->d_inode && 164 !d_unhashed(dentry) && d_really_is_positive(dentry) &&
165 ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && 165 ceph_snap(d_inode(dentry)) != CEPH_SNAPDIR &&
166 ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && 166 ceph_ino(d_inode(dentry)) != CEPH_INO_CEPH &&
167 fpos_cmp(ctx->pos, di->offset) <= 0) 167 fpos_cmp(ctx->pos, di->offset) <= 0)
168 break; 168 break;
169 dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, 169 dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry,
170 dentry, di->offset, 170 dentry, di->offset,
171 ctx->pos, d_unhashed(dentry) ? " unhashed" : "", 171 ctx->pos, d_unhashed(dentry) ? " unhashed" : "",
172 !dentry->d_inode ? " null" : ""); 172 !d_inode(dentry) ? " null" : "");
173 spin_unlock(&dentry->d_lock); 173 spin_unlock(&dentry->d_lock);
174 p = p->prev; 174 p = p->prev;
175 dentry = list_entry(p, struct dentry, d_child); 175 dentry = list_entry(p, struct dentry, d_child);
@@ -189,11 +189,11 @@ more:
189 } 189 }
190 190
191 dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, 191 dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos,
192 dentry, dentry, dentry->d_inode); 192 dentry, dentry, d_inode(dentry));
193 if (!dir_emit(ctx, dentry->d_name.name, 193 if (!dir_emit(ctx, dentry->d_name.name,
194 dentry->d_name.len, 194 dentry->d_name.len,
195 ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino), 195 ceph_translate_ino(dentry->d_sb, d_inode(dentry)->i_ino),
196 dentry->d_inode->i_mode >> 12)) { 196 d_inode(dentry)->i_mode >> 12)) {
197 if (last) { 197 if (last) {
198 /* remember our position */ 198 /* remember our position */
199 fi->dentry = last; 199 fi->dentry = last;
@@ -535,7 +535,7 @@ int ceph_handle_snapdir(struct ceph_mds_request *req,
535 struct dentry *dentry, int err) 535 struct dentry *dentry, int err)
536{ 536{
537 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); 537 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
538 struct inode *parent = dentry->d_parent->d_inode; /* we hold i_mutex */ 538 struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */
539 539
540 /* .snap dir? */ 540 /* .snap dir? */
541 if (err == -ENOENT && 541 if (err == -ENOENT &&
@@ -571,8 +571,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
571 err = 0; 571 err = 0;
572 if (!req->r_reply_info.head->is_dentry) { 572 if (!req->r_reply_info.head->is_dentry) {
573 dout("ENOENT and no trace, dentry %p inode %p\n", 573 dout("ENOENT and no trace, dentry %p inode %p\n",
574 dentry, dentry->d_inode); 574 dentry, d_inode(dentry));
575 if (dentry->d_inode) { 575 if (d_really_is_positive(dentry)) {
576 d_drop(dentry); 576 d_drop(dentry);
577 err = -ENOENT; 577 err = -ENOENT;
578 } else { 578 } else {
@@ -619,7 +619,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
619 return ERR_PTR(err); 619 return ERR_PTR(err);
620 620
621 /* can we conclude ENOENT locally? */ 621 /* can we conclude ENOENT locally? */
622 if (dentry->d_inode == NULL) { 622 if (d_really_is_negative(dentry)) {
623 struct ceph_inode_info *ci = ceph_inode(dir); 623 struct ceph_inode_info *ci = ceph_inode(dir);
624 struct ceph_dentry_info *di = ceph_dentry(dentry); 624 struct ceph_dentry_info *di = ceph_dentry(dentry);
625 625
@@ -725,7 +725,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
725 ceph_mdsc_put_request(req); 725 ceph_mdsc_put_request(req);
726out: 726out:
727 if (!err) 727 if (!err)
728 ceph_init_inode_acls(dentry->d_inode, &acls); 728 ceph_init_inode_acls(d_inode(dentry), &acls);
729 else 729 else
730 d_drop(dentry); 730 d_drop(dentry);
731 ceph_release_acls_info(&acls); 731 ceph_release_acls_info(&acls);
@@ -821,7 +821,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
821 ceph_mdsc_put_request(req); 821 ceph_mdsc_put_request(req);
822out: 822out:
823 if (!err) 823 if (!err)
824 ceph_init_inode_acls(dentry->d_inode, &acls); 824 ceph_init_inode_acls(d_inode(dentry), &acls);
825 else 825 else
826 d_drop(dentry); 826 d_drop(dentry);
827 ceph_release_acls_info(&acls); 827 ceph_release_acls_info(&acls);
@@ -858,8 +858,8 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
858 if (err) { 858 if (err) {
859 d_drop(dentry); 859 d_drop(dentry);
860 } else if (!req->r_reply_info.head->is_dentry) { 860 } else if (!req->r_reply_info.head->is_dentry) {
861 ihold(old_dentry->d_inode); 861 ihold(d_inode(old_dentry));
862 d_instantiate(dentry, old_dentry->d_inode); 862 d_instantiate(dentry, d_inode(old_dentry));
863 } 863 }
864 ceph_mdsc_put_request(req); 864 ceph_mdsc_put_request(req);
865 return err; 865 return err;
@@ -892,7 +892,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
892{ 892{
893 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 893 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
894 struct ceph_mds_client *mdsc = fsc->mdsc; 894 struct ceph_mds_client *mdsc = fsc->mdsc;
895 struct inode *inode = dentry->d_inode; 895 struct inode *inode = d_inode(dentry);
896 struct ceph_mds_request *req; 896 struct ceph_mds_request *req;
897 int err = -EROFS; 897 int err = -EROFS;
898 int op; 898 int op;
@@ -957,8 +957,8 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
957 req->r_dentry_unless = CEPH_CAP_FILE_EXCL; 957 req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
958 /* release LINK_RDCACHE on source inode (mds will lock it) */ 958 /* release LINK_RDCACHE on source inode (mds will lock it) */
959 req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; 959 req->r_old_inode_drop = CEPH_CAP_LINK_SHARED;
960 if (new_dentry->d_inode) 960 if (d_really_is_positive(new_dentry))
961 req->r_inode_drop = drop_caps_for_unlink(new_dentry->d_inode); 961 req->r_inode_drop = drop_caps_for_unlink(d_inode(new_dentry));
962 err = ceph_mdsc_do_request(mdsc, old_dir, req); 962 err = ceph_mdsc_do_request(mdsc, old_dir, req);
963 if (!err && !req->r_reply_info.head->is_dentry) { 963 if (!err && !req->r_reply_info.head->is_dentry) {
964 /* 964 /*
@@ -1024,7 +1024,7 @@ static int dentry_lease_is_valid(struct dentry *dentry)
1024 if (di->lease_renew_after && 1024 if (di->lease_renew_after &&
1025 time_after(jiffies, di->lease_renew_after)) { 1025 time_after(jiffies, di->lease_renew_after)) {
1026 /* we should renew */ 1026 /* we should renew */
1027 dir = dentry->d_parent->d_inode; 1027 dir = d_inode(dentry->d_parent);
1028 session = ceph_get_mds_session(s); 1028 session = ceph_get_mds_session(s);
1029 seq = di->lease_seq; 1029 seq = di->lease_seq;
1030 di->lease_renew_after = 0; 1030 di->lease_renew_after = 0;
@@ -1074,22 +1074,22 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
1074 return -ECHILD; 1074 return -ECHILD;
1075 1075
1076 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, 1076 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
1077 dentry, dentry->d_inode, ceph_dentry(dentry)->offset); 1077 dentry, d_inode(dentry), ceph_dentry(dentry)->offset);
1078 1078
1079 dir = ceph_get_dentry_parent_inode(dentry); 1079 dir = ceph_get_dentry_parent_inode(dentry);
1080 1080
1081 /* always trust cached snapped dentries, snapdir dentry */ 1081 /* always trust cached snapped dentries, snapdir dentry */
1082 if (ceph_snap(dir) != CEPH_NOSNAP) { 1082 if (ceph_snap(dir) != CEPH_NOSNAP) {
1083 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, 1083 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
1084 dentry, dentry->d_inode); 1084 dentry, d_inode(dentry));
1085 valid = 1; 1085 valid = 1;
1086 } else if (dentry->d_inode && 1086 } else if (d_really_is_positive(dentry) &&
1087 ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) { 1087 ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) {
1088 valid = 1; 1088 valid = 1;
1089 } else if (dentry_lease_is_valid(dentry) || 1089 } else if (dentry_lease_is_valid(dentry) ||
1090 dir_lease_is_valid(dir, dentry)) { 1090 dir_lease_is_valid(dir, dentry)) {
1091 if (dentry->d_inode) 1091 if (d_really_is_positive(dentry))
1092 valid = ceph_is_any_caps(dentry->d_inode); 1092 valid = ceph_is_any_caps(d_inode(dentry));
1093 else 1093 else
1094 valid = 1; 1094 valid = 1;
1095 } 1095 }
@@ -1151,7 +1151,7 @@ static void ceph_d_prune(struct dentry *dentry)
1151 * we hold d_lock, so d_parent is stable, and d_fsdata is never 1151 * we hold d_lock, so d_parent is stable, and d_fsdata is never
1152 * cleared until d_release 1152 * cleared until d_release
1153 */ 1153 */
1154 ceph_dir_clear_complete(dentry->d_parent->d_inode); 1154 ceph_dir_clear_complete(d_inode(dentry->d_parent));
1155} 1155}
1156 1156
1157/* 1157/*
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 8d7d782f4382..fe02ae7f056a 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -136,8 +136,8 @@ static struct dentry *__get_parent(struct super_block *sb,
136 return ERR_CAST(req); 136 return ERR_CAST(req);
137 137
138 if (child) { 138 if (child) {
139 req->r_inode = child->d_inode; 139 req->r_inode = d_inode(child);
140 ihold(child->d_inode); 140 ihold(d_inode(child));
141 } else { 141 } else {
142 req->r_ino1 = (struct ceph_vino) { 142 req->r_ino1 = (struct ceph_vino) {
143 .ino = ino, 143 .ino = ino,
@@ -164,7 +164,7 @@ static struct dentry *__get_parent(struct super_block *sb,
164 return ERR_PTR(err); 164 return ERR_PTR(err);
165 } 165 }
166 dout("__get_parent ino %llx parent %p ino %llx.%llx\n", 166 dout("__get_parent ino %llx parent %p ino %llx.%llx\n",
167 child ? ceph_ino(child->d_inode) : ino, 167 child ? ceph_ino(d_inode(child)) : ino,
168 dentry, ceph_vinop(inode)); 168 dentry, ceph_vinop(inode));
169 return dentry; 169 return dentry;
170} 170}
@@ -172,11 +172,11 @@ static struct dentry *__get_parent(struct super_block *sb,
172static struct dentry *ceph_get_parent(struct dentry *child) 172static struct dentry *ceph_get_parent(struct dentry *child)
173{ 173{
174 /* don't re-export snaps */ 174 /* don't re-export snaps */
175 if (ceph_snap(child->d_inode) != CEPH_NOSNAP) 175 if (ceph_snap(d_inode(child)) != CEPH_NOSNAP)
176 return ERR_PTR(-EINVAL); 176 return ERR_PTR(-EINVAL);
177 177
178 dout("get_parent %p ino %llx.%llx\n", 178 dout("get_parent %p ino %llx.%llx\n",
179 child, ceph_vinop(child->d_inode)); 179 child, ceph_vinop(d_inode(child)));
180 return __get_parent(child->d_sb, child, 0); 180 return __get_parent(child->d_sb, child, 0);
181} 181}
182 182
@@ -209,32 +209,32 @@ static int ceph_get_name(struct dentry *parent, char *name,
209 struct ceph_mds_request *req; 209 struct ceph_mds_request *req;
210 int err; 210 int err;
211 211
212 mdsc = ceph_inode_to_client(child->d_inode)->mdsc; 212 mdsc = ceph_inode_to_client(d_inode(child))->mdsc;
213 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME, 213 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME,
214 USE_ANY_MDS); 214 USE_ANY_MDS);
215 if (IS_ERR(req)) 215 if (IS_ERR(req))
216 return PTR_ERR(req); 216 return PTR_ERR(req);
217 217
218 mutex_lock(&parent->d_inode->i_mutex); 218 mutex_lock(&d_inode(parent)->i_mutex);
219 219
220 req->r_inode = child->d_inode; 220 req->r_inode = d_inode(child);
221 ihold(child->d_inode); 221 ihold(d_inode(child));
222 req->r_ino2 = ceph_vino(parent->d_inode); 222 req->r_ino2 = ceph_vino(d_inode(parent));
223 req->r_locked_dir = parent->d_inode; 223 req->r_locked_dir = d_inode(parent);
224 req->r_num_caps = 2; 224 req->r_num_caps = 2;
225 err = ceph_mdsc_do_request(mdsc, NULL, req); 225 err = ceph_mdsc_do_request(mdsc, NULL, req);
226 226
227 mutex_unlock(&parent->d_inode->i_mutex); 227 mutex_unlock(&d_inode(parent)->i_mutex);
228 228
229 if (!err) { 229 if (!err) {
230 struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; 230 struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
231 memcpy(name, rinfo->dname, rinfo->dname_len); 231 memcpy(name, rinfo->dname, rinfo->dname_len);
232 name[rinfo->dname_len] = 0; 232 name[rinfo->dname_len] = 0;
233 dout("get_name %p ino %llx.%llx name %s\n", 233 dout("get_name %p ino %llx.%llx name %s\n",
234 child, ceph_vinop(child->d_inode), name); 234 child, ceph_vinop(d_inode(child)), name);
235 } else { 235 } else {
236 dout("get_name %p ino %llx.%llx err %d\n", 236 dout("get_name %p ino %llx.%llx err %d\n",
237 child, ceph_vinop(child->d_inode), err); 237 child, ceph_vinop(d_inode(child)), err);
238 } 238 }
239 239
240 ceph_mdsc_put_request(req); 240 ceph_mdsc_put_request(req);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index b9b8eb225f66..3b6b522b4b31 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -291,14 +291,14 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
291 } 291 }
292 if (err) 292 if (err)
293 goto out_req; 293 goto out_req;
294 if (dn || dentry->d_inode == NULL || d_is_symlink(dentry)) { 294 if (dn || d_really_is_negative(dentry) || d_is_symlink(dentry)) {
295 /* make vfs retry on splice, ENOENT, or symlink */ 295 /* make vfs retry on splice, ENOENT, or symlink */
296 dout("atomic_open finish_no_open on dn %p\n", dn); 296 dout("atomic_open finish_no_open on dn %p\n", dn);
297 err = finish_no_open(file, dn); 297 err = finish_no_open(file, dn);
298 } else { 298 } else {
299 dout("atomic_open finish_open on dn %p\n", dn); 299 dout("atomic_open finish_open on dn %p\n", dn);
300 if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) { 300 if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
301 ceph_init_inode_acls(dentry->d_inode, &acls); 301 ceph_init_inode_acls(d_inode(dentry), &acls);
302 *opened |= FILE_CREATED; 302 *opened |= FILE_CREATED;
303 } 303 }
304 err = finish_open(file, dentry, ceph_open, opened); 304 err = finish_open(file, dentry, ceph_open, opened);
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 119c43c80638..e876e1944519 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -940,7 +940,7 @@ static void update_dentry_lease(struct dentry *dentry,
940 dentry, duration, ttl); 940 dentry, duration, ttl);
941 941
942 /* make lease_rdcache_gen match directory */ 942 /* make lease_rdcache_gen match directory */
943 dir = dentry->d_parent->d_inode; 943 dir = d_inode(dentry->d_parent);
944 di->lease_shared_gen = ceph_inode(dir)->i_shared_gen; 944 di->lease_shared_gen = ceph_inode(dir)->i_shared_gen;
945 945
946 if (duration == 0) 946 if (duration == 0)
@@ -980,7 +980,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
980{ 980{
981 struct dentry *realdn; 981 struct dentry *realdn;
982 982
983 BUG_ON(dn->d_inode); 983 BUG_ON(d_inode(dn));
984 984
985 /* dn must be unhashed */ 985 /* dn must be unhashed */
986 if (!d_unhashed(dn)) 986 if (!d_unhashed(dn))
@@ -998,13 +998,13 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
998 "inode %p ino %llx.%llx\n", 998 "inode %p ino %llx.%llx\n",
999 dn, d_count(dn), 999 dn, d_count(dn),
1000 realdn, d_count(realdn), 1000 realdn, d_count(realdn),
1001 realdn->d_inode, ceph_vinop(realdn->d_inode)); 1001 d_inode(realdn), ceph_vinop(d_inode(realdn)));
1002 dput(dn); 1002 dput(dn);
1003 dn = realdn; 1003 dn = realdn;
1004 } else { 1004 } else {
1005 BUG_ON(!ceph_dentry(dn)); 1005 BUG_ON(!ceph_dentry(dn));
1006 dout("dn %p attached to %p ino %llx.%llx\n", 1006 dout("dn %p attached to %p ino %llx.%llx\n",
1007 dn, dn->d_inode, ceph_vinop(dn->d_inode)); 1007 dn, d_inode(dn), ceph_vinop(d_inode(dn)));
1008 } 1008 }
1009 if ((!prehash || *prehash) && d_unhashed(dn)) 1009 if ((!prehash || *prehash) && d_unhashed(dn))
1010 d_rehash(dn); 1010 d_rehash(dn);
@@ -1125,11 +1125,11 @@ retry_lookup:
1125 dput(parent); 1125 dput(parent);
1126 goto done; 1126 goto done;
1127 } 1127 }
1128 } else if (dn->d_inode && 1128 } else if (d_really_is_positive(dn) &&
1129 (ceph_ino(dn->d_inode) != vino.ino || 1129 (ceph_ino(d_inode(dn)) != vino.ino ||
1130 ceph_snap(dn->d_inode) != vino.snap)) { 1130 ceph_snap(d_inode(dn)) != vino.snap)) {
1131 dout(" dn %p points to wrong inode %p\n", 1131 dout(" dn %p points to wrong inode %p\n",
1132 dn, dn->d_inode); 1132 dn, d_inode(dn));
1133 d_delete(dn); 1133 d_delete(dn);
1134 dput(dn); 1134 dput(dn);
1135 goto retry_lookup; 1135 goto retry_lookup;
@@ -1183,7 +1183,7 @@ retry_lookup:
1183 1183
1184 BUG_ON(!dn); 1184 BUG_ON(!dn);
1185 BUG_ON(!dir); 1185 BUG_ON(!dir);
1186 BUG_ON(dn->d_parent->d_inode != dir); 1186 BUG_ON(d_inode(dn->d_parent) != dir);
1187 BUG_ON(ceph_ino(dir) != 1187 BUG_ON(ceph_ino(dir) !=
1188 le64_to_cpu(rinfo->diri.in->ino)); 1188 le64_to_cpu(rinfo->diri.in->ino));
1189 BUG_ON(ceph_snap(dir) != 1189 BUG_ON(ceph_snap(dir) !=
@@ -1235,7 +1235,7 @@ retry_lookup:
1235 /* null dentry? */ 1235 /* null dentry? */
1236 if (!rinfo->head->is_target) { 1236 if (!rinfo->head->is_target) {
1237 dout("fill_trace null dentry\n"); 1237 dout("fill_trace null dentry\n");
1238 if (dn->d_inode) { 1238 if (d_really_is_positive(dn)) {
1239 ceph_dir_clear_ordered(dir); 1239 ceph_dir_clear_ordered(dir);
1240 dout("d_delete %p\n", dn); 1240 dout("d_delete %p\n", dn);
1241 d_delete(dn); 1241 d_delete(dn);
@@ -1252,7 +1252,7 @@ retry_lookup:
1252 } 1252 }
1253 1253
1254 /* attach proper inode */ 1254 /* attach proper inode */
1255 if (!dn->d_inode) { 1255 if (d_really_is_negative(dn)) {
1256 ceph_dir_clear_ordered(dir); 1256 ceph_dir_clear_ordered(dir);
1257 ihold(in); 1257 ihold(in);
1258 dn = splice_dentry(dn, in, &have_lease); 1258 dn = splice_dentry(dn, in, &have_lease);
@@ -1261,9 +1261,9 @@ retry_lookup:
1261 goto done; 1261 goto done;
1262 } 1262 }
1263 req->r_dentry = dn; /* may have spliced */ 1263 req->r_dentry = dn; /* may have spliced */
1264 } else if (dn->d_inode && dn->d_inode != in) { 1264 } else if (d_really_is_positive(dn) && d_inode(dn) != in) {
1265 dout(" %p links to %p %llx.%llx, not %llx.%llx\n", 1265 dout(" %p links to %p %llx.%llx, not %llx.%llx\n",
1266 dn, dn->d_inode, ceph_vinop(dn->d_inode), 1266 dn, d_inode(dn), ceph_vinop(d_inode(dn)),
1267 ceph_vinop(in)); 1267 ceph_vinop(in));
1268 have_lease = false; 1268 have_lease = false;
1269 } 1269 }
@@ -1363,7 +1363,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
1363 return readdir_prepopulate_inodes_only(req, session); 1363 return readdir_prepopulate_inodes_only(req, session);
1364 1364
1365 if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { 1365 if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) {
1366 snapdir = ceph_get_snapdir(parent->d_inode); 1366 snapdir = ceph_get_snapdir(d_inode(parent));
1367 parent = d_find_alias(snapdir); 1367 parent = d_find_alias(snapdir);
1368 dout("readdir_prepopulate %d items under SNAPDIR dn %p\n", 1368 dout("readdir_prepopulate %d items under SNAPDIR dn %p\n",
1369 rinfo->dir_nr, parent); 1369 rinfo->dir_nr, parent);
@@ -1371,7 +1371,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
1371 dout("readdir_prepopulate %d items under dn %p\n", 1371 dout("readdir_prepopulate %d items under dn %p\n",
1372 rinfo->dir_nr, parent); 1372 rinfo->dir_nr, parent);
1373 if (rinfo->dir_dir) 1373 if (rinfo->dir_dir)
1374 ceph_fill_dirfrag(parent->d_inode, rinfo->dir_dir); 1374 ceph_fill_dirfrag(d_inode(parent), rinfo->dir_dir);
1375 } 1375 }
1376 1376
1377 /* FIXME: release caps/leases if error occurs */ 1377 /* FIXME: release caps/leases if error occurs */
@@ -1405,11 +1405,11 @@ retry_lookup:
1405 err = ret; 1405 err = ret;
1406 goto out; 1406 goto out;
1407 } 1407 }
1408 } else if (dn->d_inode && 1408 } else if (d_really_is_positive(dn) &&
1409 (ceph_ino(dn->d_inode) != vino.ino || 1409 (ceph_ino(d_inode(dn)) != vino.ino ||
1410 ceph_snap(dn->d_inode) != vino.snap)) { 1410 ceph_snap(d_inode(dn)) != vino.snap)) {
1411 dout(" dn %p points to wrong inode %p\n", 1411 dout(" dn %p points to wrong inode %p\n",
1412 dn, dn->d_inode); 1412 dn, d_inode(dn));
1413 d_delete(dn); 1413 d_delete(dn);
1414 dput(dn); 1414 dput(dn);
1415 goto retry_lookup; 1415 goto retry_lookup;
@@ -1423,8 +1423,8 @@ retry_lookup:
1423 } 1423 }
1424 1424
1425 /* inode */ 1425 /* inode */
1426 if (dn->d_inode) { 1426 if (d_really_is_positive(dn)) {
1427 in = dn->d_inode; 1427 in = d_inode(dn);
1428 } else { 1428 } else {
1429 in = ceph_get_inode(parent->d_sb, vino); 1429 in = ceph_get_inode(parent->d_sb, vino);
1430 if (IS_ERR(in)) { 1430 if (IS_ERR(in)) {
@@ -1440,13 +1440,13 @@ retry_lookup:
1440 req->r_request_started, -1, 1440 req->r_request_started, -1,
1441 &req->r_caps_reservation) < 0) { 1441 &req->r_caps_reservation) < 0) {
1442 pr_err("fill_inode badness on %p\n", in); 1442 pr_err("fill_inode badness on %p\n", in);
1443 if (!dn->d_inode) 1443 if (d_really_is_negative(dn))
1444 iput(in); 1444 iput(in);
1445 d_drop(dn); 1445 d_drop(dn);
1446 goto next_item; 1446 goto next_item;
1447 } 1447 }
1448 1448
1449 if (!dn->d_inode) { 1449 if (d_really_is_negative(dn)) {
1450 struct dentry *realdn = splice_dentry(dn, in, NULL); 1450 struct dentry *realdn = splice_dentry(dn, in, NULL);
1451 if (IS_ERR(realdn)) { 1451 if (IS_ERR(realdn)) {
1452 err = PTR_ERR(realdn); 1452 err = PTR_ERR(realdn);
@@ -1693,7 +1693,7 @@ retry:
1693 */ 1693 */
1694static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd) 1694static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd)
1695{ 1695{
1696 struct ceph_inode_info *ci = ceph_inode(dentry->d_inode); 1696 struct ceph_inode_info *ci = ceph_inode(d_inode(dentry));
1697 nd_set_link(nd, ci->i_symlink); 1697 nd_set_link(nd, ci->i_symlink);
1698 return NULL; 1698 return NULL;
1699} 1699}
@@ -1714,7 +1714,7 @@ static const struct inode_operations ceph_symlink_iops = {
1714 */ 1714 */
1715int ceph_setattr(struct dentry *dentry, struct iattr *attr) 1715int ceph_setattr(struct dentry *dentry, struct iattr *attr)
1716{ 1716{
1717 struct inode *inode = dentry->d_inode; 1717 struct inode *inode = d_inode(dentry);
1718 struct ceph_inode_info *ci = ceph_inode(inode); 1718 struct ceph_inode_info *ci = ceph_inode(inode);
1719 const unsigned int ia_valid = attr->ia_valid; 1719 const unsigned int ia_valid = attr->ia_valid;
1720 struct ceph_mds_request *req; 1720 struct ceph_mds_request *req;
@@ -1990,7 +1990,7 @@ int ceph_permission(struct inode *inode, int mask)
1990int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, 1990int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
1991 struct kstat *stat) 1991 struct kstat *stat)
1992{ 1992{
1993 struct inode *inode = dentry->d_inode; 1993 struct inode *inode = d_inode(dentry);
1994 struct ceph_inode_info *ci = ceph_inode(inode); 1994 struct ceph_inode_info *ci = ceph_inode(inode);
1995 int err; 1995 int err;
1996 1996
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 71c073f38e54..a39389092102 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -679,7 +679,7 @@ static struct dentry *get_nonsnap_parent(struct dentry *dentry)
679 * except to resplice to another snapdir, and either the old or new 679 * except to resplice to another snapdir, and either the old or new
680 * result is a valid result. 680 * result is a valid result.
681 */ 681 */
682 while (!IS_ROOT(dentry) && ceph_snap(dentry->d_inode) != CEPH_NOSNAP) 682 while (!IS_ROOT(dentry) && ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
683 dentry = dentry->d_parent; 683 dentry = dentry->d_parent;
684 return dentry; 684 return dentry;
685} 685}
@@ -716,20 +716,20 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
716 } else if (req->r_dentry) { 716 } else if (req->r_dentry) {
717 /* ignore race with rename; old or new d_parent is okay */ 717 /* ignore race with rename; old or new d_parent is okay */
718 struct dentry *parent = req->r_dentry->d_parent; 718 struct dentry *parent = req->r_dentry->d_parent;
719 struct inode *dir = parent->d_inode; 719 struct inode *dir = d_inode(parent);
720 720
721 if (dir->i_sb != mdsc->fsc->sb) { 721 if (dir->i_sb != mdsc->fsc->sb) {
722 /* not this fs! */ 722 /* not this fs! */
723 inode = req->r_dentry->d_inode; 723 inode = d_inode(req->r_dentry);
724 } else if (ceph_snap(dir) != CEPH_NOSNAP) { 724 } else if (ceph_snap(dir) != CEPH_NOSNAP) {
725 /* direct snapped/virtual snapdir requests 725 /* direct snapped/virtual snapdir requests
726 * based on parent dir inode */ 726 * based on parent dir inode */
727 struct dentry *dn = get_nonsnap_parent(parent); 727 struct dentry *dn = get_nonsnap_parent(parent);
728 inode = dn->d_inode; 728 inode = d_inode(dn);
729 dout("__choose_mds using nonsnap parent %p\n", inode); 729 dout("__choose_mds using nonsnap parent %p\n", inode);
730 } else { 730 } else {
731 /* dentry target */ 731 /* dentry target */
732 inode = req->r_dentry->d_inode; 732 inode = d_inode(req->r_dentry);
733 if (!inode || mode == USE_AUTH_MDS) { 733 if (!inode || mode == USE_AUTH_MDS) {
734 /* dir + name */ 734 /* dir + name */
735 inode = dir; 735 inode = dir;
@@ -1712,7 +1712,7 @@ retry:
1712 seq = read_seqbegin(&rename_lock); 1712 seq = read_seqbegin(&rename_lock);
1713 rcu_read_lock(); 1713 rcu_read_lock();
1714 for (temp = dentry; !IS_ROOT(temp);) { 1714 for (temp = dentry; !IS_ROOT(temp);) {
1715 struct inode *inode = temp->d_inode; 1715 struct inode *inode = d_inode(temp);
1716 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) 1716 if (inode && ceph_snap(inode) == CEPH_SNAPDIR)
1717 len++; /* slash only */ 1717 len++; /* slash only */
1718 else if (stop_on_nosnap && inode && 1718 else if (stop_on_nosnap && inode &&
@@ -1736,7 +1736,7 @@ retry:
1736 struct inode *inode; 1736 struct inode *inode;
1737 1737
1738 spin_lock(&temp->d_lock); 1738 spin_lock(&temp->d_lock);
1739 inode = temp->d_inode; 1739 inode = d_inode(temp);
1740 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 1740 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
1741 dout("build_path path+%d: %p SNAPDIR\n", 1741 dout("build_path path+%d: %p SNAPDIR\n",
1742 pos, temp); 1742 pos, temp);
@@ -1770,7 +1770,7 @@ retry:
1770 goto retry; 1770 goto retry;
1771 } 1771 }
1772 1772
1773 *base = ceph_ino(temp->d_inode); 1773 *base = ceph_ino(d_inode(temp));
1774 *plen = len; 1774 *plen = len;
1775 dout("build_path on %p %d built %llx '%.*s'\n", 1775 dout("build_path on %p %d built %llx '%.*s'\n",
1776 dentry, d_count(dentry), *base, len, path); 1776 dentry, d_count(dentry), *base, len, path);
@@ -1783,8 +1783,8 @@ static int build_dentry_path(struct dentry *dentry,
1783{ 1783{
1784 char *path; 1784 char *path;
1785 1785
1786 if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) { 1786 if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) {
1787 *pino = ceph_ino(dentry->d_parent->d_inode); 1787 *pino = ceph_ino(d_inode(dentry->d_parent));
1788 *ppath = dentry->d_name.name; 1788 *ppath = dentry->d_name.name;
1789 *ppathlen = dentry->d_name.len; 1789 *ppathlen = dentry->d_name.len;
1790 return 0; 1790 return 0;
@@ -1925,7 +1925,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1925 releases = 0; 1925 releases = 0;
1926 if (req->r_inode_drop) 1926 if (req->r_inode_drop)
1927 releases += ceph_encode_inode_release(&p, 1927 releases += ceph_encode_inode_release(&p,
1928 req->r_inode ? req->r_inode : req->r_dentry->d_inode, 1928 req->r_inode ? req->r_inode : d_inode(req->r_dentry),
1929 mds, req->r_inode_drop, req->r_inode_unless, 0); 1929 mds, req->r_inode_drop, req->r_inode_unless, 0);
1930 if (req->r_dentry_drop) 1930 if (req->r_dentry_drop)
1931 releases += ceph_encode_dentry_release(&p, req->r_dentry, 1931 releases += ceph_encode_dentry_release(&p, req->r_dentry,
@@ -1935,7 +1935,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1935 mds, req->r_old_dentry_drop, req->r_old_dentry_unless); 1935 mds, req->r_old_dentry_drop, req->r_old_dentry_unless);
1936 if (req->r_old_inode_drop) 1936 if (req->r_old_inode_drop)
1937 releases += ceph_encode_inode_release(&p, 1937 releases += ceph_encode_inode_release(&p,
1938 req->r_old_dentry->d_inode, 1938 d_inode(req->r_old_dentry),
1939 mds, req->r_old_inode_drop, req->r_old_inode_unless, 0); 1939 mds, req->r_old_inode_drop, req->r_old_inode_unless, 0);
1940 head->num_releases = cpu_to_le16(releases); 1940 head->num_releases = cpu_to_le16(releases);
1941 1941
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index a63997b8bcff..e68591df9942 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -44,7 +44,7 @@ static void ceph_put_super(struct super_block *s)
44 44
45static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) 45static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
46{ 46{
47 struct ceph_fs_client *fsc = ceph_inode_to_client(dentry->d_inode); 47 struct ceph_fs_client *fsc = ceph_inode_to_client(d_inode(dentry));
48 struct ceph_monmap *monmap = fsc->client->monc.monmap; 48 struct ceph_monmap *monmap = fsc->client->monc.monmap;
49 struct ceph_statfs st; 49 struct ceph_statfs st;
50 u64 fsid; 50 u64 fsid;
@@ -976,7 +976,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
976 if (IS_ERR(res)) 976 if (IS_ERR(res))
977 goto out_splat; 977 goto out_splat;
978 dout("root %p inode %p ino %llx.%llx\n", res, 978 dout("root %p inode %p ino %llx.%llx\n", res,
979 res->d_inode, ceph_vinop(res->d_inode)); 979 d_inode(res), ceph_vinop(d_inode(res)));
980 return res; 980 return res;
981 981
982out_splat: 982out_splat:
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 5a492caf34cb..e448766ce549 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -776,12 +776,12 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value,
776 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 776 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
777 return generic_getxattr(dentry, name, value, size); 777 return generic_getxattr(dentry, name, value, size);
778 778
779 return __ceph_getxattr(dentry->d_inode, name, value, size); 779 return __ceph_getxattr(d_inode(dentry), name, value, size);
780} 780}
781 781
782ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) 782ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
783{ 783{
784 struct inode *inode = dentry->d_inode; 784 struct inode *inode = d_inode(dentry);
785 struct ceph_inode_info *ci = ceph_inode(inode); 785 struct ceph_inode_info *ci = ceph_inode(inode);
786 struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode); 786 struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
787 u32 vir_namelen = 0; 787 u32 vir_namelen = 0;
@@ -847,7 +847,7 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
847 const char *value, size_t size, int flags) 847 const char *value, size_t size, int flags)
848{ 848{
849 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); 849 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
850 struct inode *inode = dentry->d_inode; 850 struct inode *inode = d_inode(dentry);
851 struct ceph_inode_info *ci = ceph_inode(inode); 851 struct ceph_inode_info *ci = ceph_inode(inode);
852 struct ceph_mds_request *req; 852 struct ceph_mds_request *req;
853 struct ceph_mds_client *mdsc = fsc->mdsc; 853 struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -901,7 +901,7 @@ out:
901int __ceph_setxattr(struct dentry *dentry, const char *name, 901int __ceph_setxattr(struct dentry *dentry, const char *name,
902 const void *value, size_t size, int flags) 902 const void *value, size_t size, int flags)
903{ 903{
904 struct inode *inode = dentry->d_inode; 904 struct inode *inode = d_inode(dentry);
905 struct ceph_vxattr *vxattr; 905 struct ceph_vxattr *vxattr;
906 struct ceph_inode_info *ci = ceph_inode(inode); 906 struct ceph_inode_info *ci = ceph_inode(inode);
907 int issued; 907 int issued;
@@ -995,7 +995,7 @@ out:
995int ceph_setxattr(struct dentry *dentry, const char *name, 995int ceph_setxattr(struct dentry *dentry, const char *name,
996 const void *value, size_t size, int flags) 996 const void *value, size_t size, int flags)
997{ 997{
998 if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) 998 if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
999 return -EROFS; 999 return -EROFS;
1000 1000
1001 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 1001 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
@@ -1011,7 +1011,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
1011{ 1011{
1012 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); 1012 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
1013 struct ceph_mds_client *mdsc = fsc->mdsc; 1013 struct ceph_mds_client *mdsc = fsc->mdsc;
1014 struct inode *inode = dentry->d_inode; 1014 struct inode *inode = d_inode(dentry);
1015 struct ceph_mds_request *req; 1015 struct ceph_mds_request *req;
1016 int err; 1016 int err;
1017 1017
@@ -1032,7 +1032,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
1032 1032
1033int __ceph_removexattr(struct dentry *dentry, const char *name) 1033int __ceph_removexattr(struct dentry *dentry, const char *name)
1034{ 1034{
1035 struct inode *inode = dentry->d_inode; 1035 struct inode *inode = d_inode(dentry);
1036 struct ceph_vxattr *vxattr; 1036 struct ceph_vxattr *vxattr;
1037 struct ceph_inode_info *ci = ceph_inode(inode); 1037 struct ceph_inode_info *ci = ceph_inode(inode);
1038 int issued; 1038 int issued;
@@ -1098,7 +1098,7 @@ out:
1098 1098
1099int ceph_removexattr(struct dentry *dentry, const char *name) 1099int ceph_removexattr(struct dentry *dentry, const char *name)
1100{ 1100{
1101 if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) 1101 if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
1102 return -EROFS; 1102 return -EROFS;
1103 1103
1104 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 1104 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index b8602f199815..430e0348c99e 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -301,7 +301,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
301 if (full_path == NULL) 301 if (full_path == NULL)
302 goto cdda_exit; 302 goto cdda_exit;
303 303
304 cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); 304 cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb);
305 tlink = cifs_sb_tlink(cifs_sb); 305 tlink = cifs_sb_tlink(cifs_sb);
306 if (IS_ERR(tlink)) { 306 if (IS_ERR(tlink)) {
307 mnt = ERR_CAST(tlink); 307 mnt = ERR_CAST(tlink);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index eaab4b2a0595..f5089bde3635 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -607,7 +607,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
607 p = s = full_path; 607 p = s = full_path;
608 608
609 do { 609 do {
610 struct inode *dir = dentry->d_inode; 610 struct inode *dir = d_inode(dentry);
611 struct dentry *child; 611 struct dentry *child;
612 612
613 if (!dir) { 613 if (!dir) {
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index fa13d5e79f64..84650a51c7c4 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1898,7 +1898,7 @@ static void
1898cifs_writev_requeue(struct cifs_writedata *wdata) 1898cifs_writev_requeue(struct cifs_writedata *wdata)
1899{ 1899{
1900 int i, rc = 0; 1900 int i, rc = 0;
1901 struct inode *inode = wdata->cfile->dentry->d_inode; 1901 struct inode *inode = d_inode(wdata->cfile->dentry);
1902 struct TCP_Server_Info *server; 1902 struct TCP_Server_Info *server;
1903 unsigned int rest_len; 1903 unsigned int rest_len;
1904 1904
@@ -1981,7 +1981,7 @@ cifs_writev_complete(struct work_struct *work)
1981{ 1981{
1982 struct cifs_writedata *wdata = container_of(work, 1982 struct cifs_writedata *wdata = container_of(work,
1983 struct cifs_writedata, work); 1983 struct cifs_writedata, work);
1984 struct inode *inode = wdata->cfile->dentry->d_inode; 1984 struct inode *inode = d_inode(wdata->cfile->dentry);
1985 int i = 0; 1985 int i = 0;
1986 1986
1987 if (wdata->result == 0) { 1987 if (wdata->result == 0) {
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index b72bc29cba23..338d56936f6a 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -745,13 +745,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
745 goto lookup_out; 745 goto lookup_out;
746 } 746 }
747 747
748 if (direntry->d_inode != NULL) { 748 if (d_really_is_positive(direntry)) {
749 cifs_dbg(FYI, "non-NULL inode in lookup\n"); 749 cifs_dbg(FYI, "non-NULL inode in lookup\n");
750 } else { 750 } else {
751 cifs_dbg(FYI, "NULL inode in lookup\n"); 751 cifs_dbg(FYI, "NULL inode in lookup\n");
752 } 752 }
753 cifs_dbg(FYI, "Full path: %s inode = 0x%p\n", 753 cifs_dbg(FYI, "Full path: %s inode = 0x%p\n",
754 full_path, direntry->d_inode); 754 full_path, d_inode(direntry));
755 755
756 if (pTcon->unix_ext) { 756 if (pTcon->unix_ext) {
757 rc = cifs_get_inode_info_unix(&newInode, full_path, 757 rc = cifs_get_inode_info_unix(&newInode, full_path,
@@ -792,7 +792,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
792 if (flags & LOOKUP_RCU) 792 if (flags & LOOKUP_RCU)
793 return -ECHILD; 793 return -ECHILD;
794 794
795 if (direntry->d_inode) { 795 if (d_really_is_positive(direntry)) {
796 if (cifs_revalidate_dentry(direntry)) 796 if (cifs_revalidate_dentry(direntry))
797 return 0; 797 return 0;
798 else { 798 else {
@@ -803,7 +803,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
803 * attributes will have been updated by 803 * attributes will have been updated by
804 * cifs_revalidate_dentry(). 804 * cifs_revalidate_dentry().
805 */ 805 */
806 if (IS_AUTOMOUNT(direntry->d_inode) && 806 if (IS_AUTOMOUNT(d_inode(direntry)) &&
807 !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { 807 !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) {
808 spin_lock(&direntry->d_lock); 808 spin_lock(&direntry->d_lock);
809 direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; 809 direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ca2bc5406306..cafbf10521d5 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -273,7 +273,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
273 struct tcon_link *tlink, __u32 oplock) 273 struct tcon_link *tlink, __u32 oplock)
274{ 274{
275 struct dentry *dentry = file->f_path.dentry; 275 struct dentry *dentry = file->f_path.dentry;
276 struct inode *inode = dentry->d_inode; 276 struct inode *inode = d_inode(dentry);
277 struct cifsInodeInfo *cinode = CIFS_I(inode); 277 struct cifsInodeInfo *cinode = CIFS_I(inode);
278 struct cifsFileInfo *cfile; 278 struct cifsFileInfo *cfile;
279 struct cifs_fid_locks *fdlocks; 279 struct cifs_fid_locks *fdlocks;
@@ -357,7 +357,7 @@ cifsFileInfo_get(struct cifsFileInfo *cifs_file)
357 */ 357 */
358void cifsFileInfo_put(struct cifsFileInfo *cifs_file) 358void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
359{ 359{
360 struct inode *inode = cifs_file->dentry->d_inode; 360 struct inode *inode = d_inode(cifs_file->dentry);
361 struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); 361 struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);
362 struct TCP_Server_Info *server = tcon->ses->server; 362 struct TCP_Server_Info *server = tcon->ses->server;
363 struct cifsInodeInfo *cifsi = CIFS_I(inode); 363 struct cifsInodeInfo *cifsi = CIFS_I(inode);
@@ -386,7 +386,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
386 386
387 if (list_empty(&cifsi->openFileList)) { 387 if (list_empty(&cifsi->openFileList)) {
388 cifs_dbg(FYI, "closing last open instance for inode %p\n", 388 cifs_dbg(FYI, "closing last open instance for inode %p\n",
389 cifs_file->dentry->d_inode); 389 d_inode(cifs_file->dentry));
390 /* 390 /*
391 * In strict cache mode we need invalidate mapping on the last 391 * In strict cache mode we need invalidate mapping on the last
392 * close because it may cause a error when we open this file 392 * close because it may cause a error when we open this file
@@ -572,7 +572,7 @@ static int
572cifs_relock_file(struct cifsFileInfo *cfile) 572cifs_relock_file(struct cifsFileInfo *cfile)
573{ 573{
574 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); 574 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb);
575 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 575 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
576 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 576 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
577 int rc = 0; 577 int rc = 0;
578 578
@@ -620,7 +620,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
620 return rc; 620 return rc;
621 } 621 }
622 622
623 inode = cfile->dentry->d_inode; 623 inode = d_inode(cfile->dentry);
624 cifs_sb = CIFS_SB(inode->i_sb); 624 cifs_sb = CIFS_SB(inode->i_sb);
625 tcon = tlink_tcon(cfile->tlink); 625 tcon = tlink_tcon(cfile->tlink);
626 server = tcon->ses->server; 626 server = tcon->ses->server;
@@ -874,7 +874,7 @@ cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
874{ 874{
875 bool rc = false; 875 bool rc = false;
876 struct cifs_fid_locks *cur; 876 struct cifs_fid_locks *cur;
877 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 877 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
878 878
879 list_for_each_entry(cur, &cinode->llist, llist) { 879 list_for_each_entry(cur, &cinode->llist, llist) {
880 rc = cifs_find_fid_lock_conflict(cur, offset, length, type, 880 rc = cifs_find_fid_lock_conflict(cur, offset, length, type,
@@ -899,7 +899,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
899{ 899{
900 int rc = 0; 900 int rc = 0;
901 struct cifsLockInfo *conf_lock; 901 struct cifsLockInfo *conf_lock;
902 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 902 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
903 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; 903 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server;
904 bool exist; 904 bool exist;
905 905
@@ -927,7 +927,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
927static void 927static void
928cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) 928cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock)
929{ 929{
930 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 930 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
931 down_write(&cinode->lock_sem); 931 down_write(&cinode->lock_sem);
932 list_add_tail(&lock->llist, &cfile->llist->locks); 932 list_add_tail(&lock->llist, &cfile->llist->locks);
933 up_write(&cinode->lock_sem); 933 up_write(&cinode->lock_sem);
@@ -944,7 +944,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
944 bool wait) 944 bool wait)
945{ 945{
946 struct cifsLockInfo *conf_lock; 946 struct cifsLockInfo *conf_lock;
947 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 947 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
948 bool exist; 948 bool exist;
949 int rc = 0; 949 int rc = 0;
950 950
@@ -1125,7 +1125,7 @@ struct lock_to_push {
1125static int 1125static int
1126cifs_push_posix_locks(struct cifsFileInfo *cfile) 1126cifs_push_posix_locks(struct cifsFileInfo *cfile)
1127{ 1127{
1128 struct inode *inode = cfile->dentry->d_inode; 1128 struct inode *inode = d_inode(cfile->dentry);
1129 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1129 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1130 struct file_lock *flock; 1130 struct file_lock *flock;
1131 struct file_lock_context *flctx = inode->i_flctx; 1131 struct file_lock_context *flctx = inode->i_flctx;
@@ -1214,7 +1214,7 @@ static int
1214cifs_push_locks(struct cifsFileInfo *cfile) 1214cifs_push_locks(struct cifsFileInfo *cfile)
1215{ 1215{
1216 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); 1216 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb);
1217 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 1217 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
1218 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1218 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1219 int rc = 0; 1219 int rc = 0;
1220 1220
@@ -1382,7 +1382,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
1382 unsigned int max_num, num, max_buf; 1382 unsigned int max_num, num, max_buf;
1383 LOCKING_ANDX_RANGE *buf, *cur; 1383 LOCKING_ANDX_RANGE *buf, *cur;
1384 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1384 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1385 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 1385 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
1386 struct cifsLockInfo *li, *tmp; 1386 struct cifsLockInfo *li, *tmp;
1387 __u64 length = 1 + flock->fl_end - flock->fl_start; 1387 __u64 length = 1 + flock->fl_end - flock->fl_start;
1388 struct list_head tmp_llist; 1388 struct list_head tmp_llist;
@@ -1488,7 +1488,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
1488 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; 1488 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data;
1489 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1489 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1490 struct TCP_Server_Info *server = tcon->ses->server; 1490 struct TCP_Server_Info *server = tcon->ses->server;
1491 struct inode *inode = cfile->dentry->d_inode; 1491 struct inode *inode = d_inode(cfile->dentry);
1492 1492
1493 if (posix_lck) { 1493 if (posix_lck) {
1494 int posix_lock_type; 1494 int posix_lock_type;
@@ -1643,7 +1643,7 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
1643 struct TCP_Server_Info *server; 1643 struct TCP_Server_Info *server;
1644 unsigned int xid; 1644 unsigned int xid;
1645 struct dentry *dentry = open_file->dentry; 1645 struct dentry *dentry = open_file->dentry;
1646 struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); 1646 struct cifsInodeInfo *cifsi = CIFS_I(d_inode(dentry));
1647 struct cifs_io_parms io_parms; 1647 struct cifs_io_parms io_parms;
1648 1648
1649 cifs_sb = CIFS_SB(dentry->d_sb); 1649 cifs_sb = CIFS_SB(dentry->d_sb);
@@ -1676,7 +1676,7 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
1676 break; 1676 break;
1677 } 1677 }
1678 1678
1679 len = min(server->ops->wp_retry_size(dentry->d_inode), 1679 len = min(server->ops->wp_retry_size(d_inode(dentry)),
1680 (unsigned int)write_size - total_written); 1680 (unsigned int)write_size - total_written);
1681 /* iov[0] is reserved for smb header */ 1681 /* iov[0] is reserved for smb header */
1682 iov[1].iov_base = (char *)write_data + total_written; 1682 iov[1].iov_base = (char *)write_data + total_written;
@@ -1696,9 +1696,9 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
1696 return rc; 1696 return rc;
1697 } 1697 }
1698 } else { 1698 } else {
1699 spin_lock(&dentry->d_inode->i_lock); 1699 spin_lock(&d_inode(dentry)->i_lock);
1700 cifs_update_eof(cifsi, *offset, bytes_written); 1700 cifs_update_eof(cifsi, *offset, bytes_written);
1701 spin_unlock(&dentry->d_inode->i_lock); 1701 spin_unlock(&d_inode(dentry)->i_lock);
1702 *offset += bytes_written; 1702 *offset += bytes_written;
1703 } 1703 }
1704 } 1704 }
@@ -1706,12 +1706,12 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
1706 cifs_stats_bytes_written(tcon, total_written); 1706 cifs_stats_bytes_written(tcon, total_written);
1707 1707
1708 if (total_written > 0) { 1708 if (total_written > 0) {
1709 spin_lock(&dentry->d_inode->i_lock); 1709 spin_lock(&d_inode(dentry)->i_lock);
1710 if (*offset > dentry->d_inode->i_size) 1710 if (*offset > d_inode(dentry)->i_size)
1711 i_size_write(dentry->d_inode, *offset); 1711 i_size_write(d_inode(dentry), *offset);
1712 spin_unlock(&dentry->d_inode->i_lock); 1712 spin_unlock(&d_inode(dentry)->i_lock);
1713 } 1713 }
1714 mark_inode_dirty_sync(dentry->d_inode); 1714 mark_inode_dirty_sync(d_inode(dentry));
1715 free_xid(xid); 1715 free_xid(xid);
1716 return total_written; 1716 return total_written;
1717} 1717}
@@ -2406,7 +2406,7 @@ cifs_uncached_writev_complete(struct work_struct *work)
2406{ 2406{
2407 struct cifs_writedata *wdata = container_of(work, 2407 struct cifs_writedata *wdata = container_of(work,
2408 struct cifs_writedata, work); 2408 struct cifs_writedata, work);
2409 struct inode *inode = wdata->cfile->dentry->d_inode; 2409 struct inode *inode = d_inode(wdata->cfile->dentry);
2410 struct cifsInodeInfo *cifsi = CIFS_I(inode); 2410 struct cifsInodeInfo *cifsi = CIFS_I(inode);
2411 2411
2412 spin_lock(&inode->i_lock); 2412 spin_lock(&inode->i_lock);
@@ -3794,7 +3794,7 @@ void cifs_oplock_break(struct work_struct *work)
3794{ 3794{
3795 struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, 3795 struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo,
3796 oplock_break); 3796 oplock_break);
3797 struct inode *inode = cfile->dentry->d_inode; 3797 struct inode *inode = d_inode(cfile->dentry);
3798 struct cifsInodeInfo *cinode = CIFS_I(inode); 3798 struct cifsInodeInfo *cinode = CIFS_I(inode);
3799 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 3799 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
3800 struct TCP_Server_Info *server = tcon->ses->server; 3800 struct TCP_Server_Info *server = tcon->ses->server;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 3e126d7bb2ea..55b58112d122 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1067,7 +1067,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
1067 int rc; 1067 int rc;
1068 struct cifs_fid fid; 1068 struct cifs_fid fid;
1069 struct cifs_open_parms oparms; 1069 struct cifs_open_parms oparms;
1070 struct inode *inode = dentry->d_inode; 1070 struct inode *inode = d_inode(dentry);
1071 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 1071 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
1072 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1072 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1073 struct tcon_link *tlink; 1073 struct tcon_link *tlink;
@@ -1196,7 +1196,7 @@ cifs_drop_nlink(struct inode *inode)
1196} 1196}
1197 1197
1198/* 1198/*
1199 * If dentry->d_inode is null (usually meaning the cached dentry 1199 * If d_inode(dentry) is null (usually meaning the cached dentry
1200 * is a negative dentry) then we would attempt a standard SMB delete, but 1200 * is a negative dentry) then we would attempt a standard SMB delete, but
1201 * if that fails we can not attempt the fall back mechanisms on EACCESS 1201 * if that fails we can not attempt the fall back mechanisms on EACCESS
1202 * but will return the EACCESS to the caller. Note that the VFS does not call 1202 * but will return the EACCESS to the caller. Note that the VFS does not call
@@ -1207,7 +1207,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
1207 int rc = 0; 1207 int rc = 0;
1208 unsigned int xid; 1208 unsigned int xid;
1209 char *full_path = NULL; 1209 char *full_path = NULL;
1210 struct inode *inode = dentry->d_inode; 1210 struct inode *inode = d_inode(dentry);
1211 struct cifsInodeInfo *cifs_inode; 1211 struct cifsInodeInfo *cifs_inode;
1212 struct super_block *sb = dir->i_sb; 1212 struct super_block *sb = dir->i_sb;
1213 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 1213 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -1551,13 +1551,13 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1551 cifs_put_tlink(tlink); 1551 cifs_put_tlink(tlink);
1552 1552
1553 if (!rc) { 1553 if (!rc) {
1554 spin_lock(&direntry->d_inode->i_lock); 1554 spin_lock(&d_inode(direntry)->i_lock);
1555 i_size_write(direntry->d_inode, 0); 1555 i_size_write(d_inode(direntry), 0);
1556 clear_nlink(direntry->d_inode); 1556 clear_nlink(d_inode(direntry));
1557 spin_unlock(&direntry->d_inode->i_lock); 1557 spin_unlock(&d_inode(direntry)->i_lock);
1558 } 1558 }
1559 1559
1560 cifsInode = CIFS_I(direntry->d_inode); 1560 cifsInode = CIFS_I(d_inode(direntry));
1561 /* force revalidate to go get info when needed */ 1561 /* force revalidate to go get info when needed */
1562 cifsInode->time = 0; 1562 cifsInode->time = 0;
1563 1563
@@ -1568,7 +1568,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1568 */ 1568 */
1569 cifsInode->time = 0; 1569 cifsInode->time = 0;
1570 1570
1571 direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = 1571 d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime =
1572 current_fs_time(inode->i_sb); 1572 current_fs_time(inode->i_sb);
1573 1573
1574rmdir_exit: 1574rmdir_exit:
@@ -1727,7 +1727,7 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
1727 1727
1728unlink_target: 1728unlink_target:
1729 /* Try unlinking the target dentry if it's not negative */ 1729 /* Try unlinking the target dentry if it's not negative */
1730 if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { 1730 if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
1731 if (d_is_dir(target_dentry)) 1731 if (d_is_dir(target_dentry))
1732 tmprc = cifs_rmdir(target_dir, target_dentry); 1732 tmprc = cifs_rmdir(target_dir, target_dentry);
1733 else 1733 else
@@ -1867,7 +1867,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
1867{ 1867{
1868 unsigned int xid; 1868 unsigned int xid;
1869 int rc = 0; 1869 int rc = 0;
1870 struct inode *inode = dentry->d_inode; 1870 struct inode *inode = d_inode(dentry);
1871 struct super_block *sb = dentry->d_sb; 1871 struct super_block *sb = dentry->d_sb;
1872 char *full_path = NULL; 1872 char *full_path = NULL;
1873 1873
@@ -1919,7 +1919,7 @@ int cifs_revalidate_file(struct file *filp)
1919int cifs_revalidate_dentry(struct dentry *dentry) 1919int cifs_revalidate_dentry(struct dentry *dentry)
1920{ 1920{
1921 int rc; 1921 int rc;
1922 struct inode *inode = dentry->d_inode; 1922 struct inode *inode = d_inode(dentry);
1923 1923
1924 rc = cifs_revalidate_dentry_attr(dentry); 1924 rc = cifs_revalidate_dentry_attr(dentry);
1925 if (rc) 1925 if (rc)
@@ -1933,7 +1933,7 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1933{ 1933{
1934 struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); 1934 struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
1935 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); 1935 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
1936 struct inode *inode = dentry->d_inode; 1936 struct inode *inode = d_inode(dentry);
1937 int rc; 1937 int rc;
1938 1938
1939 /* 1939 /*
@@ -2110,7 +2110,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
2110 int rc; 2110 int rc;
2111 unsigned int xid; 2111 unsigned int xid;
2112 char *full_path = NULL; 2112 char *full_path = NULL;
2113 struct inode *inode = direntry->d_inode; 2113 struct inode *inode = d_inode(direntry);
2114 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 2114 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
2115 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 2115 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2116 struct tcon_link *tlink; 2116 struct tcon_link *tlink;
@@ -2251,7 +2251,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2251 unsigned int xid; 2251 unsigned int xid;
2252 kuid_t uid = INVALID_UID; 2252 kuid_t uid = INVALID_UID;
2253 kgid_t gid = INVALID_GID; 2253 kgid_t gid = INVALID_GID;
2254 struct inode *inode = direntry->d_inode; 2254 struct inode *inode = d_inode(direntry);
2255 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 2255 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2256 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 2256 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
2257 char *full_path = NULL; 2257 char *full_path = NULL;
@@ -2409,7 +2409,7 @@ cifs_setattr_exit:
2409int 2409int
2410cifs_setattr(struct dentry *direntry, struct iattr *attrs) 2410cifs_setattr(struct dentry *direntry, struct iattr *attrs)
2411{ 2411{
2412 struct inode *inode = direntry->d_inode; 2412 struct inode *inode = d_inode(direntry);
2413 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 2413 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2414 struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); 2414 struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);
2415 2415
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 2ec6037f61c7..252e672d5604 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -586,12 +586,12 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
586 * if source file is cached (oplocked) revalidate will not go to server 586 * if source file is cached (oplocked) revalidate will not go to server
587 * until the file is closed or oplock broken so update nlinks locally 587 * until the file is closed or oplock broken so update nlinks locally
588 */ 588 */
589 if (old_file->d_inode) { 589 if (d_really_is_positive(old_file)) {
590 cifsInode = CIFS_I(old_file->d_inode); 590 cifsInode = CIFS_I(d_inode(old_file));
591 if (rc == 0) { 591 if (rc == 0) {
592 spin_lock(&old_file->d_inode->i_lock); 592 spin_lock(&d_inode(old_file)->i_lock);
593 inc_nlink(old_file->d_inode); 593 inc_nlink(d_inode(old_file));
594 spin_unlock(&old_file->d_inode->i_lock); 594 spin_unlock(&d_inode(old_file)->i_lock);
595 595
596 /* 596 /*
597 * parent dir timestamps will update from srv within a 597 * parent dir timestamps will update from srv within a
@@ -629,7 +629,7 @@ cifs_hl_exit:
629void * 629void *
630cifs_follow_link(struct dentry *direntry, struct nameidata *nd) 630cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
631{ 631{
632 struct inode *inode = direntry->d_inode; 632 struct inode *inode = d_inode(direntry);
633 int rc = -ENOMEM; 633 int rc = -ENOMEM;
634 unsigned int xid; 634 unsigned int xid;
635 char *full_path = NULL; 635 char *full_path = NULL;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 337946355b29..8442b8b8e0be 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -473,7 +473,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
473 continue; 473 continue;
474 474
475 cifs_dbg(FYI, "file id match, oplock break\n"); 475 cifs_dbg(FYI, "file id match, oplock break\n");
476 pCifsInode = CIFS_I(netfile->dentry->d_inode); 476 pCifsInode = CIFS_I(d_inode(netfile->dentry));
477 477
478 set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, 478 set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK,
479 &pCifsInode->flags); 479 &pCifsInode->flags);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index c295338e0a98..b4a47237486b 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -78,7 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
78{ 78{
79 struct dentry *dentry, *alias; 79 struct dentry *dentry, *alias;
80 struct inode *inode; 80 struct inode *inode;
81 struct super_block *sb = parent->d_inode->i_sb; 81 struct super_block *sb = d_inode(parent)->i_sb;
82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
83 83
84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); 84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
@@ -88,7 +88,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
88 return; 88 return;
89 89
90 if (dentry) { 90 if (dentry) {
91 inode = dentry->d_inode; 91 inode = d_inode(dentry);
92 if (inode) { 92 if (inode) {
93 /* 93 /*
94 * If we're generating inode numbers, then we don't 94 * If we're generating inode numbers, then we don't
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index d2979036a4c7..7bfdd6066276 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -722,7 +722,7 @@ cifs_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
722static void 722static void
723cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) 723cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
724{ 724{
725 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 725 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
726 cfile->fid.netfid = fid->netfid; 726 cfile->fid.netfid = fid->netfid;
727 cifs_set_oplock_level(cinode, oplock); 727 cifs_set_oplock_level(cinode, oplock);
728 cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); 728 cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode);
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index 7198eac5dddd..2ab297dae5a7 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -95,7 +95,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
95 unsigned int max_num, num = 0, max_buf; 95 unsigned int max_num, num = 0, max_buf;
96 struct smb2_lock_element *buf, *cur; 96 struct smb2_lock_element *buf, *cur;
97 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 97 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
98 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 98 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
99 struct cifsLockInfo *li, *tmp; 99 struct cifsLockInfo *li, *tmp;
100 __u64 length = 1 + flock->fl_end - flock->fl_start; 100 __u64 length = 1 + flock->fl_end - flock->fl_start;
101 struct list_head tmp_llist; 101 struct list_head tmp_llist;
@@ -231,7 +231,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
231 unsigned int xid; 231 unsigned int xid;
232 unsigned int max_num, max_buf; 232 unsigned int max_num, max_buf;
233 struct smb2_lock_element *buf; 233 struct smb2_lock_element *buf;
234 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 234 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
235 struct cifs_fid_locks *fdlocks; 235 struct cifs_fid_locks *fdlocks;
236 236
237 xid = get_xid(); 237 xid = get_xid();
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 22dfdf17d065..1c5907019045 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -453,7 +453,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
453 453
454 list_for_each(tmp, &tcon->openFileList) { 454 list_for_each(tmp, &tcon->openFileList) {
455 cfile = list_entry(tmp, struct cifsFileInfo, tlist); 455 cfile = list_entry(tmp, struct cifsFileInfo, tlist);
456 cinode = CIFS_I(cfile->dentry->d_inode); 456 cinode = CIFS_I(d_inode(cfile->dentry));
457 457
458 if (memcmp(cinode->lease_key, rsp->LeaseKey, 458 if (memcmp(cinode->lease_key, rsp->LeaseKey,
459 SMB2_LEASE_KEY_SIZE)) 459 SMB2_LEASE_KEY_SIZE))
@@ -590,7 +590,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
590 continue; 590 continue;
591 591
592 cifs_dbg(FYI, "file id match, oplock break\n"); 592 cifs_dbg(FYI, "file id match, oplock break\n");
593 cinode = CIFS_I(cfile->dentry->d_inode); 593 cinode = CIFS_I(d_inode(cfile->dentry));
594 594
595 if (!CIFS_CACHE_WRITE(cinode) && 595 if (!CIFS_CACHE_WRITE(cinode) &&
596 rsp->OplockLevel == SMB2_OPLOCK_LEVEL_NONE) 596 rsp->OplockLevel == SMB2_OPLOCK_LEVEL_NONE)
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index eab05e1aa587..54daee5ad4c1 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -524,7 +524,7 @@ smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
524static void 524static void
525smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) 525smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
526{ 526{
527 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); 527 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
528 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; 528 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server;
529 529
530 cfile->fid.persistent_fid = fid->persistent_fid; 530 cfile->fid.persistent_fid = fid->persistent_fid;
@@ -793,7 +793,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
793 * If extending file more than one page make sparse. Many Linux fs 793 * If extending file more than one page make sparse. Many Linux fs
794 * make files sparse by default when extending via ftruncate 794 * make files sparse by default when extending via ftruncate
795 */ 795 */
796 inode = cfile->dentry->d_inode; 796 inode = d_inode(cfile->dentry);
797 797
798 if (!set_alloc && (size > inode->i_size + 8192)) { 798 if (!set_alloc && (size > inode->i_size + 8192)) {
799 __u8 set_sparse = 1; 799 __u8 set_sparse = 1;
@@ -1032,7 +1032,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
1032 1032
1033 xid = get_xid(); 1033 xid = get_xid();
1034 1034
1035 inode = cfile->dentry->d_inode; 1035 inode = d_inode(cfile->dentry);
1036 cifsi = CIFS_I(inode); 1036 cifsi = CIFS_I(inode);
1037 1037
1038 /* if file not oplocked can't be sure whether asking to extend size */ 1038 /* if file not oplocked can't be sure whether asking to extend size */
@@ -1083,7 +1083,7 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
1083 1083
1084 xid = get_xid(); 1084 xid = get_xid();
1085 1085
1086 inode = cfile->dentry->d_inode; 1086 inode = d_inode(cfile->dentry);
1087 cifsi = CIFS_I(inode); 1087 cifsi = CIFS_I(inode);
1088 1088
1089 /* Need to make file sparse, if not already, before freeing range. */ 1089 /* Need to make file sparse, if not already, before freeing range. */
@@ -1115,7 +1115,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
1115 1115
1116 xid = get_xid(); 1116 xid = get_xid();
1117 1117
1118 inode = cfile->dentry->d_inode; 1118 inode = d_inode(cfile->dentry);
1119 cifsi = CIFS_I(inode); 1119 cifsi = CIFS_I(inode);
1120 1120
1121 /* if file not oplocked can't be sure whether asking to extend size */ 1121 /* if file not oplocked can't be sure whether asking to extend size */
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 72a4d10653d6..ff9e1f8b16a4 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -50,9 +50,9 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
50 50
51 if (direntry == NULL) 51 if (direntry == NULL)
52 return -EIO; 52 return -EIO;
53 if (direntry->d_inode == NULL) 53 if (d_really_is_negative(direntry))
54 return -EIO; 54 return -EIO;
55 sb = direntry->d_inode->i_sb; 55 sb = d_inode(direntry)->i_sb;
56 if (sb == NULL) 56 if (sb == NULL)
57 return -EIO; 57 return -EIO;
58 58
@@ -111,9 +111,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
111 111
112 if (direntry == NULL) 112 if (direntry == NULL)
113 return -EIO; 113 return -EIO;
114 if (direntry->d_inode == NULL) 114 if (d_really_is_negative(direntry))
115 return -EIO; 115 return -EIO;
116 sb = direntry->d_inode->i_sb; 116 sb = d_inode(direntry)->i_sb;
117 if (sb == NULL) 117 if (sb == NULL)
118 return -EIO; 118 return -EIO;
119 119
@@ -177,12 +177,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
177 memcpy(pacl, ea_value, value_size); 177 memcpy(pacl, ea_value, value_size);
178 if (pTcon->ses->server->ops->set_acl) 178 if (pTcon->ses->server->ops->set_acl)
179 rc = pTcon->ses->server->ops->set_acl(pacl, 179 rc = pTcon->ses->server->ops->set_acl(pacl,
180 value_size, direntry->d_inode, 180 value_size, d_inode(direntry),
181 full_path, CIFS_ACL_DACL); 181 full_path, CIFS_ACL_DACL);
182 else 182 else
183 rc = -EOPNOTSUPP; 183 rc = -EOPNOTSUPP;
184 if (rc == 0) /* force revalidate of the inode */ 184 if (rc == 0) /* force revalidate of the inode */
185 CIFS_I(direntry->d_inode)->time = 0; 185 CIFS_I(d_inode(direntry))->time = 0;
186 kfree(pacl); 186 kfree(pacl);
187 } 187 }
188#else 188#else
@@ -246,9 +246,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
246 246
247 if (direntry == NULL) 247 if (direntry == NULL)
248 return -EIO; 248 return -EIO;
249 if (direntry->d_inode == NULL) 249 if (d_really_is_negative(direntry))
250 return -EIO; 250 return -EIO;
251 sb = direntry->d_inode->i_sb; 251 sb = d_inode(direntry)->i_sb;
252 if (sb == NULL) 252 if (sb == NULL)
253 return -EIO; 253 return -EIO;
254 254
@@ -324,7 +324,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
324 goto get_ea_exit; /* rc already EOPNOTSUPP */ 324 goto get_ea_exit; /* rc already EOPNOTSUPP */
325 325
326 pacl = pTcon->ses->server->ops->get_acl(cifs_sb, 326 pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
327 direntry->d_inode, full_path, &acllen); 327 d_inode(direntry), full_path, &acllen);
328 if (IS_ERR(pacl)) { 328 if (IS_ERR(pacl)) {
329 rc = PTR_ERR(pacl); 329 rc = PTR_ERR(pacl);
330 cifs_dbg(VFS, "%s: error %zd getting sec desc\n", 330 cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
@@ -382,9 +382,9 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
382 382
383 if (direntry == NULL) 383 if (direntry == NULL)
384 return -EIO; 384 return -EIO;
385 if (direntry->d_inode == NULL) 385 if (d_really_is_negative(direntry))
386 return -EIO; 386 return -EIO;
387 sb = direntry->d_inode->i_sb; 387 sb = d_inode(direntry)->i_sb;
388 if (sb == NULL) 388 if (sb == NULL)
389 return -EIO; 389 return -EIO;
390 390
diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 46ee6f238985..5bb630a769e0 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -94,8 +94,8 @@ static void coda_flag_children(struct dentry *parent, int flag)
94 spin_lock(&parent->d_lock); 94 spin_lock(&parent->d_lock);
95 list_for_each_entry(de, &parent->d_subdirs, d_child) { 95 list_for_each_entry(de, &parent->d_subdirs, d_child) {
96 /* don't know what to do with negative dentries */ 96 /* don't know what to do with negative dentries */
97 if (de->d_inode ) 97 if (d_inode(de) )
98 coda_flag_inode(de->d_inode, flag); 98 coda_flag_inode(d_inode(de), flag);
99 } 99 }
100 spin_unlock(&parent->d_lock); 100 spin_unlock(&parent->d_lock);
101 return; 101 return;
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 60cb88c1dd2b..fda9f4311212 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -201,7 +201,7 @@ err_out:
201static int coda_link(struct dentry *source_de, struct inode *dir_inode, 201static int coda_link(struct dentry *source_de, struct inode *dir_inode,
202 struct dentry *de) 202 struct dentry *de)
203{ 203{
204 struct inode *inode = source_de->d_inode; 204 struct inode *inode = d_inode(source_de);
205 const char * name = de->d_name.name; 205 const char * name = de->d_name.name;
206 int len = de->d_name.len; 206 int len = de->d_name.len;
207 int error; 207 int error;
@@ -266,7 +266,7 @@ static int coda_unlink(struct inode *dir, struct dentry *de)
266 return error; 266 return error;
267 267
268 coda_dir_update_mtime(dir); 268 coda_dir_update_mtime(dir);
269 drop_nlink(de->d_inode); 269 drop_nlink(d_inode(de));
270 return 0; 270 return 0;
271} 271}
272 272
@@ -279,8 +279,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)
279 error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len); 279 error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
280 if (!error) { 280 if (!error) {
281 /* VFS may delete the child */ 281 /* VFS may delete the child */
282 if (de->d_inode) 282 if (d_really_is_positive(de))
283 clear_nlink(de->d_inode); 283 clear_nlink(d_inode(de));
284 284
285 /* fix the link count of the parent */ 285 /* fix the link count of the parent */
286 coda_dir_drop_nlink(dir); 286 coda_dir_drop_nlink(dir);
@@ -303,14 +303,14 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
303 coda_i2f(new_dir), old_length, new_length, 303 coda_i2f(new_dir), old_length, new_length,
304 (const char *) old_name, (const char *)new_name); 304 (const char *) old_name, (const char *)new_name);
305 if (!error) { 305 if (!error) {
306 if (new_dentry->d_inode) { 306 if (d_really_is_positive(new_dentry)) {
307 if (d_is_dir(new_dentry)) { 307 if (d_is_dir(new_dentry)) {
308 coda_dir_drop_nlink(old_dir); 308 coda_dir_drop_nlink(old_dir);
309 coda_dir_inc_nlink(new_dir); 309 coda_dir_inc_nlink(new_dir);
310 } 310 }
311 coda_dir_update_mtime(old_dir); 311 coda_dir_update_mtime(old_dir);
312 coda_dir_update_mtime(new_dir); 312 coda_dir_update_mtime(new_dir);
313 coda_flag_inode(new_dentry->d_inode, C_VATTR); 313 coda_flag_inode(d_inode(new_dentry), C_VATTR);
314 } else { 314 } else {
315 coda_flag_inode(old_dir, C_VATTR); 315 coda_flag_inode(old_dir, C_VATTR);
316 coda_flag_inode(new_dir, C_VATTR); 316 coda_flag_inode(new_dir, C_VATTR);
@@ -449,13 +449,13 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
449 if (flags & LOOKUP_RCU) 449 if (flags & LOOKUP_RCU)
450 return -ECHILD; 450 return -ECHILD;
451 451
452 inode = de->d_inode; 452 inode = d_inode(de);
453 if (!inode || is_root_inode(inode)) 453 if (!inode || is_root_inode(inode))
454 goto out; 454 goto out;
455 if (is_bad_inode(inode)) 455 if (is_bad_inode(inode))
456 goto bad; 456 goto bad;
457 457
458 cii = ITOC(de->d_inode); 458 cii = ITOC(d_inode(de));
459 if (!(cii->c_flags & (C_PURGE | C_FLUSH))) 459 if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
460 goto out; 460 goto out;
461 461
@@ -487,11 +487,11 @@ static int coda_dentry_delete(const struct dentry * dentry)
487{ 487{
488 int flags; 488 int flags;
489 489
490 if (!dentry->d_inode) 490 if (d_really_is_negative(dentry))
491 return 0; 491 return 0;
492 492
493 flags = (ITOC(dentry->d_inode)->c_flags) & C_PURGE; 493 flags = (ITOC(d_inode(dentry))->c_flags) & C_PURGE;
494 if (is_bad_inode(dentry->d_inode) || flags) { 494 if (is_bad_inode(d_inode(dentry)) || flags) {
495 return 1; 495 return 1;
496 } 496 }
497 return 0; 497 return 0;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 82ec68b59208..cac1390b87a3 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -257,15 +257,15 @@ static void coda_evict_inode(struct inode *inode)
257 257
258int coda_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 258int coda_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
259{ 259{
260 int err = coda_revalidate_inode(dentry->d_inode); 260 int err = coda_revalidate_inode(d_inode(dentry));
261 if (!err) 261 if (!err)
262 generic_fillattr(dentry->d_inode, stat); 262 generic_fillattr(d_inode(dentry), stat);
263 return err; 263 return err;
264} 264}
265 265
266int coda_setattr(struct dentry *de, struct iattr *iattr) 266int coda_setattr(struct dentry *de, struct iattr *iattr)
267{ 267{
268 struct inode *inode = de->d_inode; 268 struct inode *inode = d_inode(de);
269 struct coda_vattr vattr; 269 struct coda_vattr vattr;
270 int error; 270 int error;
271 271
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 4326d172fc27..f36a4040afb8 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -72,7 +72,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd,
72 if (error) 72 if (error)
73 return error; 73 return error;
74 74
75 target_inode = path.dentry->d_inode; 75 target_inode = d_inode(path.dentry);
76 76
77 /* return if it is not a Coda inode */ 77 /* return if it is not a Coda inode */
78 if (target_inode->i_sb != inode->i_sb) { 78 if (target_inode->i_sb != inode->i_sb) {
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 5bb6e27298a4..9b1ffaa0572e 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -820,8 +820,8 @@ int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out)
820 case CODA_FLUSH: 820 case CODA_FLUSH:
821 coda_cache_clear_all(sb); 821 coda_cache_clear_all(sb);
822 shrink_dcache_sb(sb); 822 shrink_dcache_sb(sb);
823 if (sb->s_root->d_inode) 823 if (d_really_is_positive(sb->s_root))
824 coda_flag_inode(sb->s_root->d_inode, C_FLUSH); 824 coda_flag_inode(d_inode(sb->s_root), C_FLUSH);
825 break; 825 break;
826 826
827 case CODA_PURGEUSER: 827 case CODA_PURGEUSER:
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index acb3d63bc9dc..c81ce7f200a6 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -289,7 +289,7 @@ static int configfs_create_dir(struct config_item *item, struct dentry *dentry)
289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata); 289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata);
290 error = configfs_create(dentry, mode, init_dir); 290 error = configfs_create(dentry, mode, init_dir);
291 if (!error) { 291 if (!error) {
292 inc_nlink(p->d_inode); 292 inc_nlink(d_inode(p));
293 item->ci_dentry = dentry; 293 item->ci_dentry = dentry;
294 } else { 294 } else {
295 struct configfs_dirent *sd = dentry->d_fsdata; 295 struct configfs_dirent *sd = dentry->d_fsdata;
@@ -375,8 +375,8 @@ static void remove_dir(struct dentry * d)
375 list_del_init(&sd->s_sibling); 375 list_del_init(&sd->s_sibling);
376 spin_unlock(&configfs_dirent_lock); 376 spin_unlock(&configfs_dirent_lock);
377 configfs_put(sd); 377 configfs_put(sd);
378 if (d->d_inode) 378 if (d_really_is_positive(d))
379 simple_rmdir(parent->d_inode,d); 379 simple_rmdir(d_inode(parent),d);
380 380
381 pr_debug(" o %pd removing done (%d)\n", d, d_count(d)); 381 pr_debug(" o %pd removing done (%d)\n", d, d_count(d));
382 382
@@ -513,7 +513,7 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
513 /* Abort if racing with mkdir() */ 513 /* Abort if racing with mkdir() */
514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { 514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) {
515 if (wait_mutex) 515 if (wait_mutex)
516 *wait_mutex = &sd->s_dentry->d_inode->i_mutex; 516 *wait_mutex = &d_inode(sd->s_dentry)->i_mutex;
517 return -EAGAIN; 517 return -EAGAIN;
518 } 518 }
519 519
@@ -624,13 +624,13 @@ static void detach_groups(struct config_group *group)
624 624
625 child = sd->s_dentry; 625 child = sd->s_dentry;
626 626
627 mutex_lock(&child->d_inode->i_mutex); 627 mutex_lock(&d_inode(child)->i_mutex);
628 628
629 configfs_detach_group(sd->s_element); 629 configfs_detach_group(sd->s_element);
630 child->d_inode->i_flags |= S_DEAD; 630 d_inode(child)->i_flags |= S_DEAD;
631 dont_mount(child); 631 dont_mount(child);
632 632
633 mutex_unlock(&child->d_inode->i_mutex); 633 mutex_unlock(&d_inode(child)->i_mutex);
634 634
635 d_delete(child); 635 d_delete(child);
636 dput(child); 636 dput(child);
@@ -672,7 +672,7 @@ static int create_default_group(struct config_group *parent_group,
672 sd = child->d_fsdata; 672 sd = child->d_fsdata;
673 sd->s_type |= CONFIGFS_USET_DEFAULT; 673 sd->s_type |= CONFIGFS_USET_DEFAULT;
674 } else { 674 } else {
675 BUG_ON(child->d_inode); 675 BUG_ON(d_inode(child));
676 d_drop(child); 676 d_drop(child);
677 dput(child); 677 dput(child);
678 } 678 }
@@ -818,11 +818,11 @@ static int configfs_attach_item(struct config_item *parent_item,
818 * the VFS may already have hit and used them. Thus, 818 * the VFS may already have hit and used them. Thus,
819 * we must lock them as rmdir() would. 819 * we must lock them as rmdir() would.
820 */ 820 */
821 mutex_lock(&dentry->d_inode->i_mutex); 821 mutex_lock(&d_inode(dentry)->i_mutex);
822 configfs_remove_dir(item); 822 configfs_remove_dir(item);
823 dentry->d_inode->i_flags |= S_DEAD; 823 d_inode(dentry)->i_flags |= S_DEAD;
824 dont_mount(dentry); 824 dont_mount(dentry);
825 mutex_unlock(&dentry->d_inode->i_mutex); 825 mutex_unlock(&d_inode(dentry)->i_mutex);
826 d_delete(dentry); 826 d_delete(dentry);
827 } 827 }
828 } 828 }
@@ -858,16 +858,16 @@ static int configfs_attach_group(struct config_item *parent_item,
858 * We must also lock the inode to remove it safely in case of 858 * We must also lock the inode to remove it safely in case of
859 * error, as rmdir() would. 859 * error, as rmdir() would.
860 */ 860 */
861 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 861 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
862 configfs_adjust_dir_dirent_depth_before_populate(sd); 862 configfs_adjust_dir_dirent_depth_before_populate(sd);
863 ret = populate_groups(to_config_group(item)); 863 ret = populate_groups(to_config_group(item));
864 if (ret) { 864 if (ret) {
865 configfs_detach_item(item); 865 configfs_detach_item(item);
866 dentry->d_inode->i_flags |= S_DEAD; 866 d_inode(dentry)->i_flags |= S_DEAD;
867 dont_mount(dentry); 867 dont_mount(dentry);
868 } 868 }
869 configfs_adjust_dir_dirent_depth_after_populate(sd); 869 configfs_adjust_dir_dirent_depth_after_populate(sd);
870 mutex_unlock(&dentry->d_inode->i_mutex); 870 mutex_unlock(&d_inode(dentry)->i_mutex);
871 if (ret) 871 if (ret)
872 d_delete(dentry); 872 d_delete(dentry);
873 } 873 }
@@ -1075,7 +1075,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
1075 * subsystem is really registered, and so we need to lock out 1075 * subsystem is really registered, and so we need to lock out
1076 * configfs_[un]register_subsystem(). 1076 * configfs_[un]register_subsystem().
1077 */ 1077 */
1078 mutex_lock(&root->d_inode->i_mutex); 1078 mutex_lock(&d_inode(root)->i_mutex);
1079 1079
1080 root_sd = root->d_fsdata; 1080 root_sd = root->d_fsdata;
1081 1081
@@ -1111,7 +1111,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
1111out_unlock_dirent_lock: 1111out_unlock_dirent_lock:
1112 spin_unlock(&configfs_dirent_lock); 1112 spin_unlock(&configfs_dirent_lock);
1113out_unlock_fs: 1113out_unlock_fs:
1114 mutex_unlock(&root->d_inode->i_mutex); 1114 mutex_unlock(&d_inode(root)->i_mutex);
1115 1115
1116 /* 1116 /*
1117 * If we succeeded, the fs is pinned via other methods. If not, 1117 * If we succeeded, the fs is pinned via other methods. If not,
@@ -1453,11 +1453,11 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
1453 down_write(&configfs_rename_sem); 1453 down_write(&configfs_rename_sem);
1454 parent = item->parent->dentry; 1454 parent = item->parent->dentry;
1455 1455
1456 mutex_lock(&parent->d_inode->i_mutex); 1456 mutex_lock(&d_inode(parent)->i_mutex);
1457 1457
1458 new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); 1458 new_dentry = lookup_one_len(new_name, parent, strlen(new_name));
1459 if (!IS_ERR(new_dentry)) { 1459 if (!IS_ERR(new_dentry)) {
1460 if (!new_dentry->d_inode) { 1460 if (d_really_is_negative(new_dentry)) {
1461 error = config_item_set_name(item, "%s", new_name); 1461 error = config_item_set_name(item, "%s", new_name);
1462 if (!error) { 1462 if (!error) {
1463 d_add(new_dentry, NULL); 1463 d_add(new_dentry, NULL);
@@ -1469,7 +1469,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
1469 error = -EEXIST; 1469 error = -EEXIST;
1470 dput(new_dentry); 1470 dput(new_dentry);
1471 } 1471 }
1472 mutex_unlock(&parent->d_inode->i_mutex); 1472 mutex_unlock(&d_inode(parent)->i_mutex);
1473 up_write(&configfs_rename_sem); 1473 up_write(&configfs_rename_sem);
1474 1474
1475 return error; 1475 return error;
@@ -1482,7 +1482,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
1482 struct configfs_dirent * parent_sd = dentry->d_fsdata; 1482 struct configfs_dirent * parent_sd = dentry->d_fsdata;
1483 int err; 1483 int err;
1484 1484
1485 mutex_lock(&dentry->d_inode->i_mutex); 1485 mutex_lock(&d_inode(dentry)->i_mutex);
1486 /* 1486 /*
1487 * Fake invisibility if dir belongs to a group/default groups hierarchy 1487 * Fake invisibility if dir belongs to a group/default groups hierarchy
1488 * being attached 1488 * being attached
@@ -1495,7 +1495,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
1495 else 1495 else
1496 err = 0; 1496 err = 0;
1497 } 1497 }
1498 mutex_unlock(&dentry->d_inode->i_mutex); 1498 mutex_unlock(&d_inode(dentry)->i_mutex);
1499 1499
1500 return err; 1500 return err;
1501} 1501}
@@ -1505,11 +1505,11 @@ static int configfs_dir_close(struct inode *inode, struct file *file)
1505 struct dentry * dentry = file->f_path.dentry; 1505 struct dentry * dentry = file->f_path.dentry;
1506 struct configfs_dirent * cursor = file->private_data; 1506 struct configfs_dirent * cursor = file->private_data;
1507 1507
1508 mutex_lock(&dentry->d_inode->i_mutex); 1508 mutex_lock(&d_inode(dentry)->i_mutex);
1509 spin_lock(&configfs_dirent_lock); 1509 spin_lock(&configfs_dirent_lock);
1510 list_del_init(&cursor->s_sibling); 1510 list_del_init(&cursor->s_sibling);
1511 spin_unlock(&configfs_dirent_lock); 1511 spin_unlock(&configfs_dirent_lock);
1512 mutex_unlock(&dentry->d_inode->i_mutex); 1512 mutex_unlock(&d_inode(dentry)->i_mutex);
1513 1513
1514 release_configfs_dirent(cursor); 1514 release_configfs_dirent(cursor);
1515 1515
@@ -1567,7 +1567,7 @@ static int configfs_readdir(struct file *file, struct dir_context *ctx)
1567 spin_lock(&configfs_dirent_lock); 1567 spin_lock(&configfs_dirent_lock);
1568 dentry = next->s_dentry; 1568 dentry = next->s_dentry;
1569 if (dentry) 1569 if (dentry)
1570 inode = dentry->d_inode; 1570 inode = d_inode(dentry);
1571 if (inode) 1571 if (inode)
1572 ino = inode->i_ino; 1572 ino = inode->i_ino;
1573 spin_unlock(&configfs_dirent_lock); 1573 spin_unlock(&configfs_dirent_lock);
@@ -1590,7 +1590,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1590{ 1590{
1591 struct dentry * dentry = file->f_path.dentry; 1591 struct dentry * dentry = file->f_path.dentry;
1592 1592
1593 mutex_lock(&dentry->d_inode->i_mutex); 1593 mutex_lock(&d_inode(dentry)->i_mutex);
1594 switch (whence) { 1594 switch (whence) {
1595 case 1: 1595 case 1:
1596 offset += file->f_pos; 1596 offset += file->f_pos;
@@ -1598,7 +1598,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1598 if (offset >= 0) 1598 if (offset >= 0)
1599 break; 1599 break;
1600 default: 1600 default:
1601 mutex_unlock(&dentry->d_inode->i_mutex); 1601 mutex_unlock(&d_inode(dentry)->i_mutex);
1602 return -EINVAL; 1602 return -EINVAL;
1603 } 1603 }
1604 if (offset != file->f_pos) { 1604 if (offset != file->f_pos) {
@@ -1624,7 +1624,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
1624 spin_unlock(&configfs_dirent_lock); 1624 spin_unlock(&configfs_dirent_lock);
1625 } 1625 }
1626 } 1626 }
1627 mutex_unlock(&dentry->d_inode->i_mutex); 1627 mutex_unlock(&d_inode(dentry)->i_mutex);
1628 return offset; 1628 return offset;
1629} 1629}
1630 1630
@@ -1654,7 +1654,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1654 sd = root->d_fsdata; 1654 sd = root->d_fsdata;
1655 link_group(to_config_group(sd->s_element), group); 1655 link_group(to_config_group(sd->s_element), group);
1656 1656
1657 mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_PARENT); 1657 mutex_lock_nested(&d_inode(root)->i_mutex, I_MUTEX_PARENT);
1658 1658
1659 err = -ENOMEM; 1659 err = -ENOMEM;
1660 dentry = d_alloc_name(root, group->cg_item.ci_name); 1660 dentry = d_alloc_name(root, group->cg_item.ci_name);
@@ -1664,7 +1664,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1664 err = configfs_attach_group(sd->s_element, &group->cg_item, 1664 err = configfs_attach_group(sd->s_element, &group->cg_item,
1665 dentry); 1665 dentry);
1666 if (err) { 1666 if (err) {
1667 BUG_ON(dentry->d_inode); 1667 BUG_ON(d_inode(dentry));
1668 d_drop(dentry); 1668 d_drop(dentry);
1669 dput(dentry); 1669 dput(dentry);
1670 } else { 1670 } else {
@@ -1674,7 +1674,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1674 } 1674 }
1675 } 1675 }
1676 1676
1677 mutex_unlock(&root->d_inode->i_mutex); 1677 mutex_unlock(&d_inode(root)->i_mutex);
1678 1678
1679 if (err) { 1679 if (err) {
1680 unlink_group(group); 1680 unlink_group(group);
@@ -1695,9 +1695,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
1695 return; 1695 return;
1696 } 1696 }
1697 1697
1698 mutex_lock_nested(&root->d_inode->i_mutex, 1698 mutex_lock_nested(&d_inode(root)->i_mutex,
1699 I_MUTEX_PARENT); 1699 I_MUTEX_PARENT);
1700 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 1700 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
1701 mutex_lock(&configfs_symlink_mutex); 1701 mutex_lock(&configfs_symlink_mutex);
1702 spin_lock(&configfs_dirent_lock); 1702 spin_lock(&configfs_dirent_lock);
1703 if (configfs_detach_prep(dentry, NULL)) { 1703 if (configfs_detach_prep(dentry, NULL)) {
@@ -1706,13 +1706,13 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
1706 spin_unlock(&configfs_dirent_lock); 1706 spin_unlock(&configfs_dirent_lock);
1707 mutex_unlock(&configfs_symlink_mutex); 1707 mutex_unlock(&configfs_symlink_mutex);
1708 configfs_detach_group(&group->cg_item); 1708 configfs_detach_group(&group->cg_item);
1709 dentry->d_inode->i_flags |= S_DEAD; 1709 d_inode(dentry)->i_flags |= S_DEAD;
1710 dont_mount(dentry); 1710 dont_mount(dentry);
1711 mutex_unlock(&dentry->d_inode->i_mutex); 1711 mutex_unlock(&d_inode(dentry)->i_mutex);
1712 1712
1713 d_delete(dentry); 1713 d_delete(dentry);
1714 1714
1715 mutex_unlock(&root->d_inode->i_mutex); 1715 mutex_unlock(&d_inode(root)->i_mutex);
1716 1716
1717 dput(dentry); 1717 dput(dentry);
1718 1718
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 56d2cdc9ae0a..403269ffcdf3 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -326,10 +326,10 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib
326 umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; 326 umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
327 int error = 0; 327 int error = 0;
328 328
329 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); 329 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_NORMAL);
330 error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, 330 error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode,
331 CONFIGFS_ITEM_ATTR); 331 CONFIGFS_ITEM_ATTR);
332 mutex_unlock(&dir->d_inode->i_mutex); 332 mutex_unlock(&d_inode(dir)->i_mutex);
333 333
334 return error; 334 return error;
335} 335}
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 5423a6a6ecc8..8d89f5fd0331 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -56,7 +56,7 @@ static const struct inode_operations configfs_inode_operations ={
56 56
57int configfs_setattr(struct dentry * dentry, struct iattr * iattr) 57int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
58{ 58{
59 struct inode * inode = dentry->d_inode; 59 struct inode * inode = d_inode(dentry);
60 struct configfs_dirent * sd = dentry->d_fsdata; 60 struct configfs_dirent * sd = dentry->d_fsdata;
61 struct iattr * sd_iattr; 61 struct iattr * sd_iattr;
62 unsigned int ia_valid = iattr->ia_valid; 62 unsigned int ia_valid = iattr->ia_valid;
@@ -186,7 +186,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
186 if (!dentry) 186 if (!dentry)
187 return -ENOENT; 187 return -ENOENT;
188 188
189 if (dentry->d_inode) 189 if (d_really_is_positive(dentry))
190 return -EEXIST; 190 return -EEXIST;
191 191
192 sd = dentry->d_fsdata; 192 sd = dentry->d_fsdata;
@@ -194,7 +194,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
194 if (!inode) 194 if (!inode)
195 return -ENOMEM; 195 return -ENOMEM;
196 196
197 p_inode = dentry->d_parent->d_inode; 197 p_inode = d_inode(dentry->d_parent);
198 p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; 198 p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME;
199 configfs_set_inode_lock_class(sd, inode); 199 configfs_set_inode_lock_class(sd, inode);
200 200
@@ -236,11 +236,11 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent)
236 236
237 if (dentry) { 237 if (dentry) {
238 spin_lock(&dentry->d_lock); 238 spin_lock(&dentry->d_lock);
239 if (!d_unhashed(dentry) && dentry->d_inode) { 239 if (!d_unhashed(dentry) && d_really_is_positive(dentry)) {
240 dget_dlock(dentry); 240 dget_dlock(dentry);
241 __d_drop(dentry); 241 __d_drop(dentry);
242 spin_unlock(&dentry->d_lock); 242 spin_unlock(&dentry->d_lock);
243 simple_unlink(parent->d_inode, dentry); 243 simple_unlink(d_inode(parent), dentry);
244 } else 244 } else
245 spin_unlock(&dentry->d_lock); 245 spin_unlock(&dentry->d_lock);
246 } 246 }
@@ -251,11 +251,11 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
251 struct configfs_dirent * sd; 251 struct configfs_dirent * sd;
252 struct configfs_dirent * parent_sd = dir->d_fsdata; 252 struct configfs_dirent * parent_sd = dir->d_fsdata;
253 253
254 if (dir->d_inode == NULL) 254 if (d_really_is_negative(dir))
255 /* no inode means this hasn't been made visible yet */ 255 /* no inode means this hasn't been made visible yet */
256 return; 256 return;
257 257
258 mutex_lock(&dir->d_inode->i_mutex); 258 mutex_lock(&d_inode(dir)->i_mutex);
259 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { 259 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
260 if (!sd->s_element) 260 if (!sd->s_element)
261 continue; 261 continue;
@@ -268,5 +268,5 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
268 break; 268 break;
269 } 269 }
270 } 270 }
271 mutex_unlock(&dir->d_inode->i_mutex); 271 mutex_unlock(&d_inode(dir)->i_mutex);
272} 272}
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 517e64938438..830a7e76f5c6 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -45,7 +45,7 @@ const struct file_operations debugfs_file_operations = {
45 45
46static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) 46static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd)
47{ 47{
48 nd_set_link(nd, dentry->d_inode->i_private); 48 nd_set_link(nd, d_inode(dentry)->i_private);
49 return NULL; 49 return NULL;
50} 50}
51 51
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 26856ecdea5e..61dfe45fdb68 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -46,7 +46,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb)
46 46
47static inline int debugfs_positive(struct dentry *dentry) 47static inline int debugfs_positive(struct dentry *dentry)
48{ 48{
49 return dentry->d_inode && !d_unhashed(dentry); 49 return d_really_is_positive(dentry) && !d_unhashed(dentry);
50} 50}
51 51
52struct debugfs_mount_opts { 52struct debugfs_mount_opts {
@@ -124,7 +124,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
124static int debugfs_apply_options(struct super_block *sb) 124static int debugfs_apply_options(struct super_block *sb)
125{ 125{
126 struct debugfs_fs_info *fsi = sb->s_fs_info; 126 struct debugfs_fs_info *fsi = sb->s_fs_info;
127 struct inode *inode = sb->s_root->d_inode; 127 struct inode *inode = d_inode(sb->s_root);
128 struct debugfs_mount_opts *opts = &fsi->mount_opts; 128 struct debugfs_mount_opts *opts = &fsi->mount_opts;
129 129
130 inode->i_mode &= ~S_IALLUGO; 130 inode->i_mode &= ~S_IALLUGO;
@@ -188,7 +188,7 @@ static struct vfsmount *debugfs_automount(struct path *path)
188{ 188{
189 struct vfsmount *(*f)(void *); 189 struct vfsmount *(*f)(void *);
190 f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; 190 f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata;
191 return f(path->dentry->d_inode->i_private); 191 return f(d_inode(path->dentry)->i_private);
192} 192}
193 193
194static const struct dentry_operations debugfs_dops = { 194static const struct dentry_operations debugfs_dops = {
@@ -267,20 +267,20 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
267 if (!parent) 267 if (!parent)
268 parent = debugfs_mount->mnt_root; 268 parent = debugfs_mount->mnt_root;
269 269
270 mutex_lock(&parent->d_inode->i_mutex); 270 mutex_lock(&d_inode(parent)->i_mutex);
271 dentry = lookup_one_len(name, parent, strlen(name)); 271 dentry = lookup_one_len(name, parent, strlen(name));
272 if (!IS_ERR(dentry) && dentry->d_inode) { 272 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
273 dput(dentry); 273 dput(dentry);
274 dentry = ERR_PTR(-EEXIST); 274 dentry = ERR_PTR(-EEXIST);
275 } 275 }
276 if (IS_ERR(dentry)) 276 if (IS_ERR(dentry))
277 mutex_unlock(&parent->d_inode->i_mutex); 277 mutex_unlock(&d_inode(parent)->i_mutex);
278 return dentry; 278 return dentry;
279} 279}
280 280
281static struct dentry *failed_creating(struct dentry *dentry) 281static struct dentry *failed_creating(struct dentry *dentry)
282{ 282{
283 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); 283 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex);
284 dput(dentry); 284 dput(dentry);
285 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 285 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
286 return NULL; 286 return NULL;
@@ -288,7 +288,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
288 288
289static struct dentry *end_creating(struct dentry *dentry) 289static struct dentry *end_creating(struct dentry *dentry)
290{ 290{
291 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); 291 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex);
292 return dentry; 292 return dentry;
293} 293}
294 294
@@ -341,7 +341,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
341 inode->i_fop = fops ? fops : &debugfs_file_operations; 341 inode->i_fop = fops ? fops : &debugfs_file_operations;
342 inode->i_private = data; 342 inode->i_private = data;
343 d_instantiate(dentry, inode); 343 d_instantiate(dentry, inode);
344 fsnotify_create(dentry->d_parent->d_inode, dentry); 344 fsnotify_create(d_inode(dentry->d_parent), dentry);
345 return end_creating(dentry); 345 return end_creating(dentry);
346} 346}
347EXPORT_SYMBOL_GPL(debugfs_create_file); 347EXPORT_SYMBOL_GPL(debugfs_create_file);
@@ -381,7 +381,7 @@ struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
381 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); 381 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
382 382
383 if (de) 383 if (de)
384 de->d_inode->i_size = file_size; 384 d_inode(de)->i_size = file_size;
385 return de; 385 return de;
386} 386}
387EXPORT_SYMBOL_GPL(debugfs_create_file_size); 387EXPORT_SYMBOL_GPL(debugfs_create_file_size);
@@ -423,8 +423,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
423 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 423 /* directory inodes start off with i_nlink == 2 (for "." entry) */
424 inc_nlink(inode); 424 inc_nlink(inode);
425 d_instantiate(dentry, inode); 425 d_instantiate(dentry, inode);
426 inc_nlink(dentry->d_parent->d_inode); 426 inc_nlink(d_inode(dentry->d_parent));
427 fsnotify_mkdir(dentry->d_parent->d_inode, dentry); 427 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
428 return end_creating(dentry); 428 return end_creating(dentry);
429} 429}
430EXPORT_SYMBOL_GPL(debugfs_create_dir); 430EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -522,9 +522,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
522 if (debugfs_positive(dentry)) { 522 if (debugfs_positive(dentry)) {
523 dget(dentry); 523 dget(dentry);
524 if (d_is_dir(dentry)) 524 if (d_is_dir(dentry))
525 ret = simple_rmdir(parent->d_inode, dentry); 525 ret = simple_rmdir(d_inode(parent), dentry);
526 else 526 else
527 simple_unlink(parent->d_inode, dentry); 527 simple_unlink(d_inode(parent), dentry);
528 if (!ret) 528 if (!ret)
529 d_delete(dentry); 529 d_delete(dentry);
530 dput(dentry); 530 dput(dentry);
@@ -554,12 +554,12 @@ void debugfs_remove(struct dentry *dentry)
554 return; 554 return;
555 555
556 parent = dentry->d_parent; 556 parent = dentry->d_parent;
557 if (!parent || !parent->d_inode) 557 if (!parent || d_really_is_negative(parent))
558 return; 558 return;
559 559
560 mutex_lock(&parent->d_inode->i_mutex); 560 mutex_lock(&d_inode(parent)->i_mutex);
561 ret = __debugfs_remove(dentry, parent); 561 ret = __debugfs_remove(dentry, parent);
562 mutex_unlock(&parent->d_inode->i_mutex); 562 mutex_unlock(&d_inode(parent)->i_mutex);
563 if (!ret) 563 if (!ret)
564 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 564 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
565} 565}
@@ -585,12 +585,12 @@ void debugfs_remove_recursive(struct dentry *dentry)
585 return; 585 return;
586 586
587 parent = dentry->d_parent; 587 parent = dentry->d_parent;
588 if (!parent || !parent->d_inode) 588 if (!parent || d_really_is_negative(parent))
589 return; 589 return;
590 590
591 parent = dentry; 591 parent = dentry;
592 down: 592 down:
593 mutex_lock(&parent->d_inode->i_mutex); 593 mutex_lock(&d_inode(parent)->i_mutex);
594 loop: 594 loop:
595 /* 595 /*
596 * The parent->d_subdirs is protected by the d_lock. Outside that 596 * The parent->d_subdirs is protected by the d_lock. Outside that
@@ -605,7 +605,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
605 /* perhaps simple_empty(child) makes more sense */ 605 /* perhaps simple_empty(child) makes more sense */
606 if (!list_empty(&child->d_subdirs)) { 606 if (!list_empty(&child->d_subdirs)) {
607 spin_unlock(&parent->d_lock); 607 spin_unlock(&parent->d_lock);
608 mutex_unlock(&parent->d_inode->i_mutex); 608 mutex_unlock(&d_inode(parent)->i_mutex);
609 parent = child; 609 parent = child;
610 goto down; 610 goto down;
611 } 611 }
@@ -626,10 +626,10 @@ void debugfs_remove_recursive(struct dentry *dentry)
626 } 626 }
627 spin_unlock(&parent->d_lock); 627 spin_unlock(&parent->d_lock);
628 628
629 mutex_unlock(&parent->d_inode->i_mutex); 629 mutex_unlock(&d_inode(parent)->i_mutex);
630 child = parent; 630 child = parent;
631 parent = parent->d_parent; 631 parent = parent->d_parent;
632 mutex_lock(&parent->d_inode->i_mutex); 632 mutex_lock(&d_inode(parent)->i_mutex);
633 633
634 if (child != dentry) 634 if (child != dentry)
635 /* go up */ 635 /* go up */
@@ -637,7 +637,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
637 637
638 if (!__debugfs_remove(child, parent)) 638 if (!__debugfs_remove(child, parent))
639 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 639 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
640 mutex_unlock(&parent->d_inode->i_mutex); 640 mutex_unlock(&d_inode(parent)->i_mutex);
641} 641}
642EXPORT_SYMBOL_GPL(debugfs_remove_recursive); 642EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
643 643
@@ -669,27 +669,27 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
669 669
670 trap = lock_rename(new_dir, old_dir); 670 trap = lock_rename(new_dir, old_dir);
671 /* Source or destination directories don't exist? */ 671 /* Source or destination directories don't exist? */
672 if (!old_dir->d_inode || !new_dir->d_inode) 672 if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir))
673 goto exit; 673 goto exit;
674 /* Source does not exist, cyclic rename, or mountpoint? */ 674 /* Source does not exist, cyclic rename, or mountpoint? */
675 if (!old_dentry->d_inode || old_dentry == trap || 675 if (d_really_is_negative(old_dentry) || old_dentry == trap ||
676 d_mountpoint(old_dentry)) 676 d_mountpoint(old_dentry))
677 goto exit; 677 goto exit;
678 dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); 678 dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
679 /* Lookup failed, cyclic rename or target exists? */ 679 /* Lookup failed, cyclic rename or target exists? */
680 if (IS_ERR(dentry) || dentry == trap || dentry->d_inode) 680 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry))
681 goto exit; 681 goto exit;
682 682
683 old_name = fsnotify_oldname_init(old_dentry->d_name.name); 683 old_name = fsnotify_oldname_init(old_dentry->d_name.name);
684 684
685 error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, 685 error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir),
686 dentry); 686 dentry);
687 if (error) { 687 if (error) {
688 fsnotify_oldname_free(old_name); 688 fsnotify_oldname_free(old_name);
689 goto exit; 689 goto exit;
690 } 690 }
691 d_move(old_dentry, dentry); 691 d_move(old_dentry, dentry);
692 fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, 692 fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name,
693 d_is_dir(old_dentry), 693 d_is_dir(old_dentry),
694 NULL, old_dentry); 694 NULL, old_dentry);
695 fsnotify_oldname_free(old_name); 695 fsnotify_oldname_free(old_name);
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index cfe8466f7fef..add566303c68 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -253,7 +253,7 @@ static int mknod_ptmx(struct super_block *sb)
253 if (!uid_valid(root_uid) || !gid_valid(root_gid)) 253 if (!uid_valid(root_uid) || !gid_valid(root_gid))
254 return -EINVAL; 254 return -EINVAL;
255 255
256 mutex_lock(&root->d_inode->i_mutex); 256 mutex_lock(&d_inode(root)->i_mutex);
257 257
258 /* If we have already created ptmx node, return */ 258 /* If we have already created ptmx node, return */
259 if (fsi->ptmx_dentry) { 259 if (fsi->ptmx_dentry) {
@@ -290,7 +290,7 @@ static int mknod_ptmx(struct super_block *sb)
290 fsi->ptmx_dentry = dentry; 290 fsi->ptmx_dentry = dentry;
291 rc = 0; 291 rc = 0;
292out: 292out:
293 mutex_unlock(&root->d_inode->i_mutex); 293 mutex_unlock(&d_inode(root)->i_mutex);
294 return rc; 294 return rc;
295} 295}
296 296
@@ -298,7 +298,7 @@ static void update_ptmx_mode(struct pts_fs_info *fsi)
298{ 298{
299 struct inode *inode; 299 struct inode *inode;
300 if (fsi->ptmx_dentry) { 300 if (fsi->ptmx_dentry) {
301 inode = fsi->ptmx_dentry->d_inode; 301 inode = d_inode(fsi->ptmx_dentry);
302 inode->i_mode = S_IFCHR|fsi->mount_opts.ptmxmode; 302 inode->i_mode = S_IFCHR|fsi->mount_opts.ptmxmode;
303 } 303 }
304} 304}
@@ -602,18 +602,18 @@ struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
602 602
603 sprintf(s, "%d", index); 603 sprintf(s, "%d", index);
604 604
605 mutex_lock(&root->d_inode->i_mutex); 605 mutex_lock(&d_inode(root)->i_mutex);
606 606
607 dentry = d_alloc_name(root, s); 607 dentry = d_alloc_name(root, s);
608 if (dentry) { 608 if (dentry) {
609 d_add(dentry, inode); 609 d_add(dentry, inode);
610 fsnotify_create(root->d_inode, dentry); 610 fsnotify_create(d_inode(root), dentry);
611 } else { 611 } else {
612 iput(inode); 612 iput(inode);
613 inode = ERR_PTR(-ENOMEM); 613 inode = ERR_PTR(-ENOMEM);
614 } 614 }
615 615
616 mutex_unlock(&root->d_inode->i_mutex); 616 mutex_unlock(&d_inode(root)->i_mutex);
617 617
618 return inode; 618 return inode;
619} 619}
@@ -658,7 +658,7 @@ void devpts_pty_kill(struct inode *inode)
658 658
659 BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); 659 BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
660 660
661 mutex_lock(&root->d_inode->i_mutex); 661 mutex_lock(&d_inode(root)->i_mutex);
662 662
663 dentry = d_find_alias(inode); 663 dentry = d_find_alias(inode);
664 664
@@ -667,7 +667,7 @@ void devpts_pty_kill(struct inode *inode)
667 dput(dentry); /* d_alloc_name() in devpts_pty_new() */ 667 dput(dentry); /* d_alloc_name() in devpts_pty_new() */
668 dput(dentry); /* d_find_alias above */ 668 dput(dentry); /* d_find_alias above */
669 669
670 mutex_unlock(&root->d_inode->i_mutex); 670 mutex_unlock(&d_inode(root)->i_mutex);
671} 671}
672 672
673static int __init init_devpts_fs(void) 673static int __init init_devpts_fs(void)
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 719e1ce1c609..97315f2f6816 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1326,7 +1326,7 @@ static int ecryptfs_read_headers_virt(char *page_virt,
1326 if (rc) 1326 if (rc)
1327 goto out; 1327 goto out;
1328 if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED)) 1328 if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED))
1329 ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); 1329 ecryptfs_i_size_init(page_virt, d_inode(ecryptfs_dentry));
1330 offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; 1330 offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES;
1331 rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), 1331 rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset),
1332 &bytes_read); 1332 &bytes_read);
@@ -1425,7 +1425,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
1425{ 1425{
1426 int rc; 1426 int rc;
1427 char *page_virt; 1427 char *page_virt;
1428 struct inode *ecryptfs_inode = ecryptfs_dentry->d_inode; 1428 struct inode *ecryptfs_inode = d_inode(ecryptfs_dentry);
1429 struct ecryptfs_crypt_stat *crypt_stat = 1429 struct ecryptfs_crypt_stat *crypt_stat =
1430 &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; 1430 &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
1431 struct ecryptfs_mount_crypt_stat *mount_crypt_stat = 1431 struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 4000f6b3a750..8db0b464483f 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -54,11 +54,11 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
54 return -ECHILD; 54 return -ECHILD;
55 55
56 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); 56 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
57 if (dentry->d_inode) { 57 if (d_really_is_positive(dentry)) {
58 struct inode *lower_inode = 58 struct inode *lower_inode =
59 ecryptfs_inode_to_lower(dentry->d_inode); 59 ecryptfs_inode_to_lower(d_inode(dentry));
60 60
61 fsstack_copy_attr_all(dentry->d_inode, lower_inode); 61 fsstack_copy_attr_all(d_inode(dentry), lower_inode);
62 } 62 }
63 return rc; 63 return rc;
64} 64}
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index a65786e26b05..72afcc629d7b 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -130,7 +130,7 @@ struct kmem_cache *ecryptfs_file_info_cache;
130 130
131static int read_or_initialize_metadata(struct dentry *dentry) 131static int read_or_initialize_metadata(struct dentry *dentry)
132{ 132{
133 struct inode *inode = dentry->d_inode; 133 struct inode *inode = d_inode(dentry);
134 struct ecryptfs_mount_crypt_stat *mount_crypt_stat; 134 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
135 struct ecryptfs_crypt_stat *crypt_stat; 135 struct ecryptfs_crypt_stat *crypt_stat;
136 int rc; 136 int rc;
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index b08b5187f662..fc850b55db67 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -41,13 +41,13 @@ static struct dentry *lock_parent(struct dentry *dentry)
41 struct dentry *dir; 41 struct dentry *dir;
42 42
43 dir = dget_parent(dentry); 43 dir = dget_parent(dentry);
44 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT); 44 mutex_lock_nested(&(d_inode(dir)->i_mutex), I_MUTEX_PARENT);
45 return dir; 45 return dir;
46} 46}
47 47
48static void unlock_dir(struct dentry *dir) 48static void unlock_dir(struct dentry *dir)
49{ 49{
50 mutex_unlock(&dir->d_inode->i_mutex); 50 mutex_unlock(&d_inode(dir)->i_mutex);
51 dput(dir); 51 dput(dir);
52} 52}
53 53
@@ -131,7 +131,7 @@ struct inode *ecryptfs_get_inode(struct inode *lower_inode,
131static int ecryptfs_interpose(struct dentry *lower_dentry, 131static int ecryptfs_interpose(struct dentry *lower_dentry,
132 struct dentry *dentry, struct super_block *sb) 132 struct dentry *dentry, struct super_block *sb)
133{ 133{
134 struct inode *inode = ecryptfs_get_inode(lower_dentry->d_inode, sb); 134 struct inode *inode = ecryptfs_get_inode(d_inode(lower_dentry), sb);
135 135
136 if (IS_ERR(inode)) 136 if (IS_ERR(inode))
137 return PTR_ERR(inode); 137 return PTR_ERR(inode);
@@ -189,21 +189,21 @@ ecryptfs_do_create(struct inode *directory_inode,
189 189
190 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 190 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
191 lower_dir_dentry = lock_parent(lower_dentry); 191 lower_dir_dentry = lock_parent(lower_dentry);
192 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true); 192 rc = vfs_create(d_inode(lower_dir_dentry), lower_dentry, mode, true);
193 if (rc) { 193 if (rc) {
194 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 194 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
195 "rc = [%d]\n", __func__, rc); 195 "rc = [%d]\n", __func__, rc);
196 inode = ERR_PTR(rc); 196 inode = ERR_PTR(rc);
197 goto out_lock; 197 goto out_lock;
198 } 198 }
199 inode = __ecryptfs_get_inode(lower_dentry->d_inode, 199 inode = __ecryptfs_get_inode(d_inode(lower_dentry),
200 directory_inode->i_sb); 200 directory_inode->i_sb);
201 if (IS_ERR(inode)) { 201 if (IS_ERR(inode)) {
202 vfs_unlink(lower_dir_dentry->d_inode, lower_dentry, NULL); 202 vfs_unlink(d_inode(lower_dir_dentry), lower_dentry, NULL);
203 goto out_lock; 203 goto out_lock;
204 } 204 }
205 fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode); 205 fsstack_copy_attr_times(directory_inode, d_inode(lower_dir_dentry));
206 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); 206 fsstack_copy_inode_size(directory_inode, d_inode(lower_dir_dentry));
207out_lock: 207out_lock:
208 unlock_dir(lower_dir_dentry); 208 unlock_dir(lower_dir_dentry);
209 return inode; 209 return inode;
@@ -332,7 +332,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,
332 struct dentry *lower_dentry, 332 struct dentry *lower_dentry,
333 struct inode *dir_inode) 333 struct inode *dir_inode)
334{ 334{
335 struct inode *inode, *lower_inode = lower_dentry->d_inode; 335 struct inode *inode, *lower_inode = d_inode(lower_dentry);
336 struct ecryptfs_dentry_info *dentry_info; 336 struct ecryptfs_dentry_info *dentry_info;
337 struct vfsmount *lower_mnt; 337 struct vfsmount *lower_mnt;
338 int rc = 0; 338 int rc = 0;
@@ -347,14 +347,14 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,
347 } 347 }
348 348
349 lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); 349 lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
350 fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode); 350 fsstack_copy_attr_atime(dir_inode, d_inode(lower_dentry->d_parent));
351 BUG_ON(!d_count(lower_dentry)); 351 BUG_ON(!d_count(lower_dentry));
352 352
353 ecryptfs_set_dentry_private(dentry, dentry_info); 353 ecryptfs_set_dentry_private(dentry, dentry_info);
354 dentry_info->lower_path.mnt = lower_mnt; 354 dentry_info->lower_path.mnt = lower_mnt;
355 dentry_info->lower_path.dentry = lower_dentry; 355 dentry_info->lower_path.dentry = lower_dentry;
356 356
357 if (!lower_dentry->d_inode) { 357 if (d_really_is_negative(lower_dentry)) {
358 /* We want to add because we couldn't find in lower */ 358 /* We want to add because we couldn't find in lower */
359 d_add(dentry, NULL); 359 d_add(dentry, NULL);
360 return 0; 360 return 0;
@@ -400,11 +400,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
400 int rc = 0; 400 int rc = 0;
401 401
402 lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); 402 lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent);
403 mutex_lock(&lower_dir_dentry->d_inode->i_mutex); 403 mutex_lock(&d_inode(lower_dir_dentry)->i_mutex);
404 lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, 404 lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name,
405 lower_dir_dentry, 405 lower_dir_dentry,
406 ecryptfs_dentry->d_name.len); 406 ecryptfs_dentry->d_name.len);
407 mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); 407 mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex);
408 if (IS_ERR(lower_dentry)) { 408 if (IS_ERR(lower_dentry)) {
409 rc = PTR_ERR(lower_dentry); 409 rc = PTR_ERR(lower_dentry);
410 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " 410 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
@@ -412,7 +412,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
412 ecryptfs_dentry); 412 ecryptfs_dentry);
413 goto out; 413 goto out;
414 } 414 }
415 if (lower_dentry->d_inode) 415 if (d_really_is_positive(lower_dentry))
416 goto interpose; 416 goto interpose;
417 mount_crypt_stat = &ecryptfs_superblock_to_private( 417 mount_crypt_stat = &ecryptfs_superblock_to_private(
418 ecryptfs_dentry->d_sb)->mount_crypt_stat; 418 ecryptfs_dentry->d_sb)->mount_crypt_stat;
@@ -429,11 +429,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
429 "filename; rc = [%d]\n", __func__, rc); 429 "filename; rc = [%d]\n", __func__, rc);
430 goto out; 430 goto out;
431 } 431 }
432 mutex_lock(&lower_dir_dentry->d_inode->i_mutex); 432 mutex_lock(&d_inode(lower_dir_dentry)->i_mutex);
433 lower_dentry = lookup_one_len(encrypted_and_encoded_name, 433 lower_dentry = lookup_one_len(encrypted_and_encoded_name,
434 lower_dir_dentry, 434 lower_dir_dentry,
435 encrypted_and_encoded_name_size); 435 encrypted_and_encoded_name_size);
436 mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); 436 mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex);
437 if (IS_ERR(lower_dentry)) { 437 if (IS_ERR(lower_dentry)) {
438 rc = PTR_ERR(lower_dentry); 438 rc = PTR_ERR(lower_dentry);
439 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " 439 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
@@ -458,24 +458,24 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir,
458 u64 file_size_save; 458 u64 file_size_save;
459 int rc; 459 int rc;
460 460
461 file_size_save = i_size_read(old_dentry->d_inode); 461 file_size_save = i_size_read(d_inode(old_dentry));
462 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); 462 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
463 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); 463 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
464 dget(lower_old_dentry); 464 dget(lower_old_dentry);
465 dget(lower_new_dentry); 465 dget(lower_new_dentry);
466 lower_dir_dentry = lock_parent(lower_new_dentry); 466 lower_dir_dentry = lock_parent(lower_new_dentry);
467 rc = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode, 467 rc = vfs_link(lower_old_dentry, d_inode(lower_dir_dentry),
468 lower_new_dentry, NULL); 468 lower_new_dentry, NULL);
469 if (rc || !lower_new_dentry->d_inode) 469 if (rc || d_really_is_negative(lower_new_dentry))
470 goto out_lock; 470 goto out_lock;
471 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb); 471 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb);
472 if (rc) 472 if (rc)
473 goto out_lock; 473 goto out_lock;
474 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); 474 fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
475 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); 475 fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry));
476 set_nlink(old_dentry->d_inode, 476 set_nlink(d_inode(old_dentry),
477 ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink); 477 ecryptfs_inode_to_lower(d_inode(old_dentry))->i_nlink);
478 i_size_write(new_dentry->d_inode, file_size_save); 478 i_size_write(d_inode(new_dentry), file_size_save);
479out_lock: 479out_lock:
480 unlock_dir(lower_dir_dentry); 480 unlock_dir(lower_dir_dentry);
481 dput(lower_new_dentry); 481 dput(lower_new_dentry);
@@ -485,7 +485,7 @@ out_lock:
485 485
486static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) 486static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
487{ 487{
488 return ecryptfs_do_unlink(dir, dentry, dentry->d_inode); 488 return ecryptfs_do_unlink(dir, dentry, d_inode(dentry));
489} 489}
490 490
491static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, 491static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
@@ -510,20 +510,20 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
510 strlen(symname)); 510 strlen(symname));
511 if (rc) 511 if (rc)
512 goto out_lock; 512 goto out_lock;
513 rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry, 513 rc = vfs_symlink(d_inode(lower_dir_dentry), lower_dentry,
514 encoded_symname); 514 encoded_symname);
515 kfree(encoded_symname); 515 kfree(encoded_symname);
516 if (rc || !lower_dentry->d_inode) 516 if (rc || d_really_is_negative(lower_dentry))
517 goto out_lock; 517 goto out_lock;
518 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); 518 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
519 if (rc) 519 if (rc)
520 goto out_lock; 520 goto out_lock;
521 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); 521 fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
522 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); 522 fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry));
523out_lock: 523out_lock:
524 unlock_dir(lower_dir_dentry); 524 unlock_dir(lower_dir_dentry);
525 dput(lower_dentry); 525 dput(lower_dentry);
526 if (!dentry->d_inode) 526 if (d_really_is_negative(dentry))
527 d_drop(dentry); 527 d_drop(dentry);
528 return rc; 528 return rc;
529} 529}
@@ -536,18 +536,18 @@ static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
536 536
537 lower_dentry = ecryptfs_dentry_to_lower(dentry); 537 lower_dentry = ecryptfs_dentry_to_lower(dentry);
538 lower_dir_dentry = lock_parent(lower_dentry); 538 lower_dir_dentry = lock_parent(lower_dentry);
539 rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode); 539 rc = vfs_mkdir(d_inode(lower_dir_dentry), lower_dentry, mode);
540 if (rc || !lower_dentry->d_inode) 540 if (rc || d_really_is_negative(lower_dentry))
541 goto out; 541 goto out;
542 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); 542 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
543 if (rc) 543 if (rc)
544 goto out; 544 goto out;
545 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); 545 fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
546 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); 546 fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry));
547 set_nlink(dir, lower_dir_dentry->d_inode->i_nlink); 547 set_nlink(dir, d_inode(lower_dir_dentry)->i_nlink);
548out: 548out:
549 unlock_dir(lower_dir_dentry); 549 unlock_dir(lower_dir_dentry);
550 if (!dentry->d_inode) 550 if (d_really_is_negative(dentry))
551 d_drop(dentry); 551 d_drop(dentry);
552 return rc; 552 return rc;
553} 553}
@@ -562,12 +562,12 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
562 dget(dentry); 562 dget(dentry);
563 lower_dir_dentry = lock_parent(lower_dentry); 563 lower_dir_dentry = lock_parent(lower_dentry);
564 dget(lower_dentry); 564 dget(lower_dentry);
565 rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); 565 rc = vfs_rmdir(d_inode(lower_dir_dentry), lower_dentry);
566 dput(lower_dentry); 566 dput(lower_dentry);
567 if (!rc && dentry->d_inode) 567 if (!rc && d_really_is_positive(dentry))
568 clear_nlink(dentry->d_inode); 568 clear_nlink(d_inode(dentry));
569 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); 569 fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
570 set_nlink(dir, lower_dir_dentry->d_inode->i_nlink); 570 set_nlink(dir, d_inode(lower_dir_dentry)->i_nlink);
571 unlock_dir(lower_dir_dentry); 571 unlock_dir(lower_dir_dentry);
572 if (!rc) 572 if (!rc)
573 d_drop(dentry); 573 d_drop(dentry);
@@ -584,17 +584,17 @@ ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev
584 584
585 lower_dentry = ecryptfs_dentry_to_lower(dentry); 585 lower_dentry = ecryptfs_dentry_to_lower(dentry);
586 lower_dir_dentry = lock_parent(lower_dentry); 586 lower_dir_dentry = lock_parent(lower_dentry);
587 rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev); 587 rc = vfs_mknod(d_inode(lower_dir_dentry), lower_dentry, mode, dev);
588 if (rc || !lower_dentry->d_inode) 588 if (rc || d_really_is_negative(lower_dentry))
589 goto out; 589 goto out;
590 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); 590 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
591 if (rc) 591 if (rc)
592 goto out; 592 goto out;
593 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); 593 fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry));
594 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); 594 fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry));
595out: 595out:
596 unlock_dir(lower_dir_dentry); 596 unlock_dir(lower_dir_dentry);
597 if (!dentry->d_inode) 597 if (d_really_is_negative(dentry))
598 d_drop(dentry); 598 d_drop(dentry);
599 return rc; 599 return rc;
600} 600}
@@ -617,7 +617,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
617 dget(lower_new_dentry); 617 dget(lower_new_dentry);
618 lower_old_dir_dentry = dget_parent(lower_old_dentry); 618 lower_old_dir_dentry = dget_parent(lower_old_dentry);
619 lower_new_dir_dentry = dget_parent(lower_new_dentry); 619 lower_new_dir_dentry = dget_parent(lower_new_dentry);
620 target_inode = new_dentry->d_inode; 620 target_inode = d_inode(new_dentry);
621 trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); 621 trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
622 /* source should not be ancestor of target */ 622 /* source should not be ancestor of target */
623 if (trap == lower_old_dentry) { 623 if (trap == lower_old_dentry) {
@@ -629,17 +629,17 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
629 rc = -ENOTEMPTY; 629 rc = -ENOTEMPTY;
630 goto out_lock; 630 goto out_lock;
631 } 631 }
632 rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, 632 rc = vfs_rename(d_inode(lower_old_dir_dentry), lower_old_dentry,
633 lower_new_dir_dentry->d_inode, lower_new_dentry, 633 d_inode(lower_new_dir_dentry), lower_new_dentry,
634 NULL, 0); 634 NULL, 0);
635 if (rc) 635 if (rc)
636 goto out_lock; 636 goto out_lock;
637 if (target_inode) 637 if (target_inode)
638 fsstack_copy_attr_all(target_inode, 638 fsstack_copy_attr_all(target_inode,
639 ecryptfs_inode_to_lower(target_inode)); 639 ecryptfs_inode_to_lower(target_inode));
640 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode); 640 fsstack_copy_attr_all(new_dir, d_inode(lower_new_dir_dentry));
641 if (new_dir != old_dir) 641 if (new_dir != old_dir)
642 fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); 642 fsstack_copy_attr_all(old_dir, d_inode(lower_old_dir_dentry));
643out_lock: 643out_lock:
644 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); 644 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
645 dput(lower_new_dir_dentry); 645 dput(lower_new_dir_dentry);
@@ -662,7 +662,7 @@ static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz)
662 return ERR_PTR(-ENOMEM); 662 return ERR_PTR(-ENOMEM);
663 old_fs = get_fs(); 663 old_fs = get_fs();
664 set_fs(get_ds()); 664 set_fs(get_ds());
665 rc = lower_dentry->d_inode->i_op->readlink(lower_dentry, 665 rc = d_inode(lower_dentry)->i_op->readlink(lower_dentry,
666 (char __user *)lower_buf, 666 (char __user *)lower_buf,
667 PATH_MAX); 667 PATH_MAX);
668 set_fs(old_fs); 668 set_fs(old_fs);
@@ -681,8 +681,8 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
681 char *buf = ecryptfs_readlink_lower(dentry, &len); 681 char *buf = ecryptfs_readlink_lower(dentry, &len);
682 if (IS_ERR(buf)) 682 if (IS_ERR(buf))
683 goto out; 683 goto out;
684 fsstack_copy_attr_atime(dentry->d_inode, 684 fsstack_copy_attr_atime(d_inode(dentry),
685 ecryptfs_dentry_to_lower(dentry)->d_inode); 685 d_inode(ecryptfs_dentry_to_lower(dentry)));
686 buf[len] = '\0'; 686 buf[len] = '\0';
687out: 687out:
688 nd_set_link(nd, buf); 688 nd_set_link(nd, buf);
@@ -738,7 +738,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
738 struct iattr *lower_ia) 738 struct iattr *lower_ia)
739{ 739{
740 int rc = 0; 740 int rc = 0;
741 struct inode *inode = dentry->d_inode; 741 struct inode *inode = d_inode(dentry);
742 struct ecryptfs_crypt_stat *crypt_stat; 742 struct ecryptfs_crypt_stat *crypt_stat;
743 loff_t i_size = i_size_read(inode); 743 loff_t i_size = i_size_read(inode);
744 loff_t lower_size_before_truncate; 744 loff_t lower_size_before_truncate;
@@ -751,7 +751,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
751 rc = ecryptfs_get_lower_file(dentry, inode); 751 rc = ecryptfs_get_lower_file(dentry, inode);
752 if (rc) 752 if (rc)
753 return rc; 753 return rc;
754 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 754 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat;
755 /* Switch on growing or shrinking file */ 755 /* Switch on growing or shrinking file */
756 if (ia->ia_size > i_size) { 756 if (ia->ia_size > i_size) {
757 char zero[] = { 0x00 }; 757 char zero[] = { 0x00 };
@@ -858,7 +858,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
858 struct iattr lower_ia = { .ia_valid = 0 }; 858 struct iattr lower_ia = { .ia_valid = 0 };
859 int rc; 859 int rc;
860 860
861 rc = ecryptfs_inode_newsize_ok(dentry->d_inode, new_length); 861 rc = ecryptfs_inode_newsize_ok(d_inode(dentry), new_length);
862 if (rc) 862 if (rc)
863 return rc; 863 return rc;
864 864
@@ -866,9 +866,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
866 if (!rc && lower_ia.ia_valid & ATTR_SIZE) { 866 if (!rc && lower_ia.ia_valid & ATTR_SIZE) {
867 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); 867 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
868 868
869 mutex_lock(&lower_dentry->d_inode->i_mutex); 869 mutex_lock(&d_inode(lower_dentry)->i_mutex);
870 rc = notify_change(lower_dentry, &lower_ia, NULL); 870 rc = notify_change(lower_dentry, &lower_ia, NULL);
871 mutex_unlock(&lower_dentry->d_inode->i_mutex); 871 mutex_unlock(&d_inode(lower_dentry)->i_mutex);
872 } 872 }
873 return rc; 873 return rc;
874} 874}
@@ -900,10 +900,10 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
900 struct inode *lower_inode; 900 struct inode *lower_inode;
901 struct ecryptfs_crypt_stat *crypt_stat; 901 struct ecryptfs_crypt_stat *crypt_stat;
902 902
903 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 903 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat;
904 if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) 904 if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
905 ecryptfs_init_crypt_stat(crypt_stat); 905 ecryptfs_init_crypt_stat(crypt_stat);
906 inode = dentry->d_inode; 906 inode = d_inode(dentry);
907 lower_inode = ecryptfs_inode_to_lower(inode); 907 lower_inode = ecryptfs_inode_to_lower(inode);
908 lower_dentry = ecryptfs_dentry_to_lower(dentry); 908 lower_dentry = ecryptfs_dentry_to_lower(dentry);
909 mutex_lock(&crypt_stat->cs_mutex); 909 mutex_lock(&crypt_stat->cs_mutex);
@@ -967,9 +967,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
967 if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) 967 if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
968 lower_ia.ia_valid &= ~ATTR_MODE; 968 lower_ia.ia_valid &= ~ATTR_MODE;
969 969
970 mutex_lock(&lower_dentry->d_inode->i_mutex); 970 mutex_lock(&d_inode(lower_dentry)->i_mutex);
971 rc = notify_change(lower_dentry, &lower_ia, NULL); 971 rc = notify_change(lower_dentry, &lower_ia, NULL);
972 mutex_unlock(&lower_dentry->d_inode->i_mutex); 972 mutex_unlock(&d_inode(lower_dentry)->i_mutex);
973out: 973out:
974 fsstack_copy_attr_all(inode, lower_inode); 974 fsstack_copy_attr_all(inode, lower_inode);
975 return rc; 975 return rc;
@@ -983,7 +983,7 @@ static int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry,
983 983
984 mount_crypt_stat = &ecryptfs_superblock_to_private( 984 mount_crypt_stat = &ecryptfs_superblock_to_private(
985 dentry->d_sb)->mount_crypt_stat; 985 dentry->d_sb)->mount_crypt_stat;
986 generic_fillattr(dentry->d_inode, stat); 986 generic_fillattr(d_inode(dentry), stat);
987 if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { 987 if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) {
988 char *target; 988 char *target;
989 size_t targetsiz; 989 size_t targetsiz;
@@ -1007,9 +1007,9 @@ static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1007 1007
1008 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat); 1008 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat);
1009 if (!rc) { 1009 if (!rc) {
1010 fsstack_copy_attr_all(dentry->d_inode, 1010 fsstack_copy_attr_all(d_inode(dentry),
1011 ecryptfs_inode_to_lower(dentry->d_inode)); 1011 ecryptfs_inode_to_lower(d_inode(dentry)));
1012 generic_fillattr(dentry->d_inode, stat); 1012 generic_fillattr(d_inode(dentry), stat);
1013 stat->blocks = lower_stat.blocks; 1013 stat->blocks = lower_stat.blocks;
1014 } 1014 }
1015 return rc; 1015 return rc;
@@ -1023,14 +1023,14 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1023 struct dentry *lower_dentry; 1023 struct dentry *lower_dentry;
1024 1024
1025 lower_dentry = ecryptfs_dentry_to_lower(dentry); 1025 lower_dentry = ecryptfs_dentry_to_lower(dentry);
1026 if (!lower_dentry->d_inode->i_op->setxattr) { 1026 if (!d_inode(lower_dentry)->i_op->setxattr) {
1027 rc = -EOPNOTSUPP; 1027 rc = -EOPNOTSUPP;
1028 goto out; 1028 goto out;
1029 } 1029 }
1030 1030
1031 rc = vfs_setxattr(lower_dentry, name, value, size, flags); 1031 rc = vfs_setxattr(lower_dentry, name, value, size, flags);
1032 if (!rc && dentry->d_inode) 1032 if (!rc && d_really_is_positive(dentry))
1033 fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode); 1033 fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry));
1034out: 1034out:
1035 return rc; 1035 return rc;
1036} 1036}
@@ -1041,14 +1041,14 @@ ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name,
1041{ 1041{
1042 int rc = 0; 1042 int rc = 0;
1043 1043
1044 if (!lower_dentry->d_inode->i_op->getxattr) { 1044 if (!d_inode(lower_dentry)->i_op->getxattr) {
1045 rc = -EOPNOTSUPP; 1045 rc = -EOPNOTSUPP;
1046 goto out; 1046 goto out;
1047 } 1047 }
1048 mutex_lock(&lower_dentry->d_inode->i_mutex); 1048 mutex_lock(&d_inode(lower_dentry)->i_mutex);
1049 rc = lower_dentry->d_inode->i_op->getxattr(lower_dentry, name, value, 1049 rc = d_inode(lower_dentry)->i_op->getxattr(lower_dentry, name, value,
1050 size); 1050 size);
1051 mutex_unlock(&lower_dentry->d_inode->i_mutex); 1051 mutex_unlock(&d_inode(lower_dentry)->i_mutex);
1052out: 1052out:
1053 return rc; 1053 return rc;
1054} 1054}
@@ -1068,13 +1068,13 @@ ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size)
1068 struct dentry *lower_dentry; 1068 struct dentry *lower_dentry;
1069 1069
1070 lower_dentry = ecryptfs_dentry_to_lower(dentry); 1070 lower_dentry = ecryptfs_dentry_to_lower(dentry);
1071 if (!lower_dentry->d_inode->i_op->listxattr) { 1071 if (!d_inode(lower_dentry)->i_op->listxattr) {
1072 rc = -EOPNOTSUPP; 1072 rc = -EOPNOTSUPP;
1073 goto out; 1073 goto out;
1074 } 1074 }
1075 mutex_lock(&lower_dentry->d_inode->i_mutex); 1075 mutex_lock(&d_inode(lower_dentry)->i_mutex);
1076 rc = lower_dentry->d_inode->i_op->listxattr(lower_dentry, list, size); 1076 rc = d_inode(lower_dentry)->i_op->listxattr(lower_dentry, list, size);
1077 mutex_unlock(&lower_dentry->d_inode->i_mutex); 1077 mutex_unlock(&d_inode(lower_dentry)->i_mutex);
1078out: 1078out:
1079 return rc; 1079 return rc;
1080} 1080}
@@ -1085,13 +1085,13 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name)
1085 struct dentry *lower_dentry; 1085 struct dentry *lower_dentry;
1086 1086
1087 lower_dentry = ecryptfs_dentry_to_lower(dentry); 1087 lower_dentry = ecryptfs_dentry_to_lower(dentry);
1088 if (!lower_dentry->d_inode->i_op->removexattr) { 1088 if (!d_inode(lower_dentry)->i_op->removexattr) {
1089 rc = -EOPNOTSUPP; 1089 rc = -EOPNOTSUPP;
1090 goto out; 1090 goto out;
1091 } 1091 }
1092 mutex_lock(&lower_dentry->d_inode->i_mutex); 1092 mutex_lock(&d_inode(lower_dentry)->i_mutex);
1093 rc = lower_dentry->d_inode->i_op->removexattr(lower_dentry, name); 1093 rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name);
1094 mutex_unlock(&lower_dentry->d_inode->i_mutex); 1094 mutex_unlock(&d_inode(lower_dentry)->i_mutex);
1095out: 1095out:
1096 return rc; 1096 return rc;
1097} 1097}
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index f1ea610362c6..866bb18efefe 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -144,7 +144,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
144 /* Corresponding dput() and mntput() are done when the 144 /* Corresponding dput() and mntput() are done when the
145 * lower file is fput() when all eCryptfs files for the inode are 145 * lower file is fput() when all eCryptfs files for the inode are
146 * released. */ 146 * released. */
147 flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; 147 flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR;
148 (*lower_file) = dentry_open(&req.path, flags, cred); 148 (*lower_file) = dentry_open(&req.path, flags, cred);
149 if (!IS_ERR(*lower_file)) 149 if (!IS_ERR(*lower_file))
150 goto out; 150 goto out;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index c095d3264259..4f4d0474bee9 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -546,11 +546,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
546 goto out_free; 546 goto out_free;
547 } 547 }
548 548
549 if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) { 549 if (check_ruid && !uid_eq(d_inode(path.dentry)->i_uid, current_uid())) {
550 rc = -EPERM; 550 rc = -EPERM;
551 printk(KERN_ERR "Mount of device (uid: %d) not owned by " 551 printk(KERN_ERR "Mount of device (uid: %d) not owned by "
552 "requested user (uid: %d)\n", 552 "requested user (uid: %d)\n",
553 i_uid_read(path.dentry->d_inode), 553 i_uid_read(d_inode(path.dentry)),
554 from_kuid(&init_user_ns, current_uid())); 554 from_kuid(&init_user_ns, current_uid()));
555 goto out_free; 555 goto out_free;
556 } 556 }
@@ -584,7 +584,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
584 goto out_free; 584 goto out_free;
585 } 585 }
586 586
587 inode = ecryptfs_get_inode(path.dentry->d_inode, s); 587 inode = ecryptfs_get_inode(d_inode(path.dentry), s);
588 rc = PTR_ERR(inode); 588 rc = PTR_ERR(inode);
589 if (IS_ERR(inode)) 589 if (IS_ERR(inode))
590 goto out_free; 590 goto out_free;
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 4626976794e7..cf208522998e 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -420,7 +420,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
420 void *xattr_virt; 420 void *xattr_virt;
421 struct dentry *lower_dentry = 421 struct dentry *lower_dentry =
422 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry; 422 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry;
423 struct inode *lower_inode = lower_dentry->d_inode; 423 struct inode *lower_inode = d_inode(lower_dentry);
424 int rc; 424 int rc;
425 425
426 if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) { 426 if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) {
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 07ab49745e31..3381b9da9ee6 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -145,12 +145,12 @@ out:
145 145
146static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) 146static int efivarfs_unlink(struct inode *dir, struct dentry *dentry)
147{ 147{
148 struct efivar_entry *var = dentry->d_inode->i_private; 148 struct efivar_entry *var = d_inode(dentry)->i_private;
149 149
150 if (efivar_entry_delete(var)) 150 if (efivar_entry_delete(var))
151 return -EINVAL; 151 return -EINVAL;
152 152
153 drop_nlink(dentry->d_inode); 153 drop_nlink(d_inode(dentry));
154 dput(dentry); 154 dput(dentry);
155 return 0; 155 return 0;
156}; 156};
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index ddbce42548c9..59fedbcf8798 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -144,7 +144,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
144 144
145 name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; 145 name[len + EFI_VARIABLE_GUID_LEN+1] = '\0';
146 146
147 inode = efivarfs_get_inode(sb, root->d_inode, S_IFREG | 0644, 0); 147 inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0644, 0);
148 if (!inode) 148 if (!inode)
149 goto fail_name; 149 goto fail_name;
150 150
diff --git a/fs/efs/namei.c b/fs/efs/namei.c
index bbee8f063dfa..40ba9cc41bf7 100644
--- a/fs/efs/namei.c
+++ b/fs/efs/namei.c
@@ -111,9 +111,9 @@ struct dentry *efs_get_parent(struct dentry *child)
111 struct dentry *parent = ERR_PTR(-ENOENT); 111 struct dentry *parent = ERR_PTR(-ENOENT);
112 efs_ino_t ino; 112 efs_ino_t ino;
113 113
114 ino = efs_find_entry(child->d_inode, "..", 2); 114 ino = efs_find_entry(d_inode(child), "..", 2);
115 if (ino) 115 if (ino)
116 parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino)); 116 parent = d_obtain_alias(efs_iget(d_inode(child)->i_sb, ino));
117 117
118 return parent; 118 return parent;
119} 119}
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index d7defd557601..4deb0b05b011 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -379,7 +379,7 @@ ino_t exofs_parent_ino(struct dentry *child)
379 struct exofs_dir_entry *de; 379 struct exofs_dir_entry *de;
380 ino_t ino; 380 ino_t ino;
381 381
382 de = exofs_dotdot(child->d_inode, &page); 382 de = exofs_dotdot(d_inode(child), &page);
383 if (!de) 383 if (!de)
384 return 0; 384 return 0;
385 385
@@ -429,7 +429,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de,
429 429
430int exofs_add_link(struct dentry *dentry, struct inode *inode) 430int exofs_add_link(struct dentry *dentry, struct inode *inode)
431{ 431{
432 struct inode *dir = dentry->d_parent->d_inode; 432 struct inode *dir = d_inode(dentry->d_parent);
433 const unsigned char *name = dentry->d_name.name; 433 const unsigned char *name = dentry->d_name.name;
434 int namelen = dentry->d_name.len; 434 int namelen = dentry->d_name.len;
435 unsigned chunk_size = exofs_chunk_size(dir); 435 unsigned chunk_size = exofs_chunk_size(dir);
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 35073aaec6e0..786e4cc8c889 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1028,7 +1028,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)
1028 */ 1028 */
1029int exofs_setattr(struct dentry *dentry, struct iattr *iattr) 1029int exofs_setattr(struct dentry *dentry, struct iattr *iattr)
1030{ 1030{
1031 struct inode *inode = dentry->d_inode; 1031 struct inode *inode = d_inode(dentry);
1032 int error; 1032 int error;
1033 1033
1034 /* if we are about to modify an object, and it hasn't been 1034 /* if we are about to modify an object, and it hasn't been
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
index 28907460e8fa..5ae25e431191 100644
--- a/fs/exofs/namei.c
+++ b/fs/exofs/namei.c
@@ -141,7 +141,7 @@ out_fail:
141static int exofs_link(struct dentry *old_dentry, struct inode *dir, 141static int exofs_link(struct dentry *old_dentry, struct inode *dir,
142 struct dentry *dentry) 142 struct dentry *dentry)
143{ 143{
144 struct inode *inode = old_dentry->d_inode; 144 struct inode *inode = d_inode(old_dentry);
145 145
146 inode->i_ctime = CURRENT_TIME; 146 inode->i_ctime = CURRENT_TIME;
147 inode_inc_link_count(inode); 147 inode_inc_link_count(inode);
@@ -191,7 +191,7 @@ out_dir:
191 191
192static int exofs_unlink(struct inode *dir, struct dentry *dentry) 192static int exofs_unlink(struct inode *dir, struct dentry *dentry)
193{ 193{
194 struct inode *inode = dentry->d_inode; 194 struct inode *inode = d_inode(dentry);
195 struct exofs_dir_entry *de; 195 struct exofs_dir_entry *de;
196 struct page *page; 196 struct page *page;
197 int err = -ENOENT; 197 int err = -ENOENT;
@@ -213,7 +213,7 @@ out:
213 213
214static int exofs_rmdir(struct inode *dir, struct dentry *dentry) 214static int exofs_rmdir(struct inode *dir, struct dentry *dentry)
215{ 215{
216 struct inode *inode = dentry->d_inode; 216 struct inode *inode = d_inode(dentry);
217 int err = -ENOTEMPTY; 217 int err = -ENOTEMPTY;
218 218
219 if (exofs_empty_dir(inode)) { 219 if (exofs_empty_dir(inode)) {
@@ -230,8 +230,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry)
230static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, 230static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
231 struct inode *new_dir, struct dentry *new_dentry) 231 struct inode *new_dir, struct dentry *new_dentry)
232{ 232{
233 struct inode *old_inode = old_dentry->d_inode; 233 struct inode *old_inode = d_inode(old_dentry);
234 struct inode *new_inode = new_dentry->d_inode; 234 struct inode *new_inode = d_inode(new_dentry);
235 struct page *dir_page = NULL; 235 struct page *dir_page = NULL;
236 struct exofs_dir_entry *dir_de = NULL; 236 struct exofs_dir_entry *dir_de = NULL;
237 struct page *old_page; 237 struct page *old_page;
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index fcc2e565f540..b795c567b5e1 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -958,7 +958,7 @@ static struct dentry *exofs_get_parent(struct dentry *child)
958 if (!ino) 958 if (!ino)
959 return ERR_PTR(-ESTALE); 959 return ERR_PTR(-ESTALE);
960 960
961 return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino)); 961 return d_obtain_alias(exofs_iget(d_inode(child)->i_sb, ino));
962} 962}
963 963
964static struct inode *exofs_nfs_get_inode(struct super_block *sb, 964static struct inode *exofs_nfs_get_inode(struct super_block *sb,
diff --git a/fs/exofs/symlink.c b/fs/exofs/symlink.c
index 832e2624b80b..6f6f3a4c1365 100644
--- a/fs/exofs/symlink.c
+++ b/fs/exofs/symlink.c
@@ -37,7 +37,7 @@
37 37
38static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd) 38static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd)
39{ 39{
40 struct exofs_i_info *oi = exofs_i(dentry->d_inode); 40 struct exofs_i_info *oi = exofs_i(d_inode(dentry));
41 41
42 nd_set_link(nd, (char *)oi->i_data); 42 nd_set_link(nd, (char *)oi->i_data);
43 return NULL; 43 return NULL;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 6e1d4ab09d72..796b491e6978 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -486,7 +486,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
486 */ 486 */
487int ext2_add_link (struct dentry *dentry, struct inode *inode) 487int ext2_add_link (struct dentry *dentry, struct inode *inode)
488{ 488{
489 struct inode *dir = dentry->d_parent->d_inode; 489 struct inode *dir = d_inode(dentry->d_parent);
490 const char *name = dentry->d_name.name; 490 const char *name = dentry->d_name.name;
491 int namelen = dentry->d_name.len; 491 int namelen = dentry->d_name.len;
492 unsigned chunk_size = ext2_chunk_size(dir); 492 unsigned chunk_size = ext2_chunk_size(dir);
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 6c14bb8322fa..5c04a0ddea80 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -278,7 +278,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
278 avefreeb = free_blocks / ngroups; 278 avefreeb = free_blocks / ngroups;
279 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); 279 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
280 280
281 if ((parent == sb->s_root->d_inode) || 281 if ((parent == d_inode(sb->s_root)) ||
282 (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { 282 (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
283 struct ext2_group_desc *best_desc = NULL; 283 struct ext2_group_desc *best_desc = NULL;
284 int best_ndir = inodes_per_group; 284 int best_ndir = inodes_per_group;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index e1abf75e994c..99a747cacf58 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1547,7 +1547,7 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
1547 1547
1548int ext2_setattr(struct dentry *dentry, struct iattr *iattr) 1548int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
1549{ 1549{
1550 struct inode *inode = dentry->d_inode; 1550 struct inode *inode = d_inode(dentry);
1551 int error; 1551 int error;
1552 1552
1553 error = inode_change_ok(inode, iattr); 1553 error = inode_change_ok(inode, iattr);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 148f6e3789ea..eee075d0b0cb 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -79,10 +79,10 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
79struct dentry *ext2_get_parent(struct dentry *child) 79struct dentry *ext2_get_parent(struct dentry *child)
80{ 80{
81 struct qstr dotdot = QSTR_INIT("..", 2); 81 struct qstr dotdot = QSTR_INIT("..", 2);
82 unsigned long ino = ext2_inode_by_name(child->d_inode, &dotdot); 82 unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot);
83 if (!ino) 83 if (!ino)
84 return ERR_PTR(-ENOENT); 84 return ERR_PTR(-ENOENT);
85 return d_obtain_alias(ext2_iget(child->d_inode->i_sb, ino)); 85 return d_obtain_alias(ext2_iget(d_inode(child)->i_sb, ino));
86} 86}
87 87
88/* 88/*
@@ -214,7 +214,7 @@ out_fail:
214static int ext2_link (struct dentry * old_dentry, struct inode * dir, 214static int ext2_link (struct dentry * old_dentry, struct inode * dir,
215 struct dentry *dentry) 215 struct dentry *dentry)
216{ 216{
217 struct inode *inode = old_dentry->d_inode; 217 struct inode *inode = d_inode(old_dentry);
218 int err; 218 int err;
219 219
220 dquot_initialize(dir); 220 dquot_initialize(dir);
@@ -281,7 +281,7 @@ out_dir:
281 281
282static int ext2_unlink(struct inode * dir, struct dentry *dentry) 282static int ext2_unlink(struct inode * dir, struct dentry *dentry)
283{ 283{
284 struct inode * inode = dentry->d_inode; 284 struct inode * inode = d_inode(dentry);
285 struct ext2_dir_entry_2 * de; 285 struct ext2_dir_entry_2 * de;
286 struct page * page; 286 struct page * page;
287 int err = -ENOENT; 287 int err = -ENOENT;
@@ -305,7 +305,7 @@ out:
305 305
306static int ext2_rmdir (struct inode * dir, struct dentry *dentry) 306static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
307{ 307{
308 struct inode * inode = dentry->d_inode; 308 struct inode * inode = d_inode(dentry);
309 int err = -ENOTEMPTY; 309 int err = -ENOTEMPTY;
310 310
311 if (ext2_empty_dir(inode)) { 311 if (ext2_empty_dir(inode)) {
@@ -322,8 +322,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
322static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, 322static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
323 struct inode * new_dir, struct dentry * new_dentry ) 323 struct inode * new_dir, struct dentry * new_dentry )
324{ 324{
325 struct inode * old_inode = old_dentry->d_inode; 325 struct inode * old_inode = d_inode(old_dentry);
326 struct inode * new_inode = new_dentry->d_inode; 326 struct inode * new_inode = d_inode(new_dentry);
327 struct page * dir_page = NULL; 327 struct page * dir_page = NULL;
328 struct ext2_dir_entry_2 * dir_de = NULL; 328 struct ext2_dir_entry_2 * dir_de = NULL;
329 struct page * old_page; 329 struct page * old_page;
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index 565cf817bbf1..20608f17c2e5 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -23,7 +23,7 @@
23 23
24static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd) 24static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd)
25{ 25{
26 struct ext2_inode_info *ei = EXT2_I(dentry->d_inode); 26 struct ext2_inode_info *ei = EXT2_I(d_inode(dentry));
27 nd_set_link(nd, (char *)ei->i_data); 27 nd_set_link(nd, (char *)ei->i_data);
28 return NULL; 28 return NULL;
29} 29}
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 91426141c33a..0b6bfd3a398b 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -243,7 +243,7 @@ cleanup:
243static int 243static int
244ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) 244ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
245{ 245{
246 struct inode *inode = dentry->d_inode; 246 struct inode *inode = d_inode(dentry);
247 struct buffer_head *bh = NULL; 247 struct buffer_head *bh = NULL;
248 struct ext2_xattr_entry *entry; 248 struct ext2_xattr_entry *entry;
249 char *end; 249 char *end;
@@ -319,7 +319,7 @@ cleanup:
319/* 319/*
320 * Inode operation listxattr() 320 * Inode operation listxattr()
321 * 321 *
322 * dentry->d_inode->i_mutex: don't care 322 * d_inode(dentry)->i_mutex: don't care
323 */ 323 */
324ssize_t 324ssize_t
325ext2_listxattr(struct dentry *dentry, char *buffer, size_t size) 325ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c
index c0ebc4db8849..702fc6840246 100644
--- a/fs/ext2/xattr_security.c
+++ b/fs/ext2/xattr_security.c
@@ -28,7 +28,7 @@ ext2_xattr_security_get(struct dentry *dentry, const char *name,
28{ 28{
29 if (strcmp(name, "") == 0) 29 if (strcmp(name, "") == 0)
30 return -EINVAL; 30 return -EINVAL;
31 return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name, 31 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name,
32 buffer, size); 32 buffer, size);
33} 33}
34 34
@@ -38,7 +38,7 @@ ext2_xattr_security_set(struct dentry *dentry, const char *name,
38{ 38{
39 if (strcmp(name, "") == 0) 39 if (strcmp(name, "") == 0)
40 return -EINVAL; 40 return -EINVAL;
41 return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name, 41 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name,
42 value, size, flags); 42 value, size, flags);
43} 43}
44 44
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c
index 7e192574c001..42b6e9874bcc 100644
--- a/fs/ext2/xattr_trusted.c
+++ b/fs/ext2/xattr_trusted.c
@@ -32,7 +32,7 @@ ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
32{ 32{
33 if (strcmp(name, "") == 0) 33 if (strcmp(name, "") == 0)
34 return -EINVAL; 34 return -EINVAL;
35 return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name, 35 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name,
36 buffer, size); 36 buffer, size);
37} 37}
38 38
@@ -42,7 +42,7 @@ ext2_xattr_trusted_set(struct dentry *dentry, const char *name,
42{ 42{
43 if (strcmp(name, "") == 0) 43 if (strcmp(name, "") == 0)
44 return -EINVAL; 44 return -EINVAL;
45 return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name, 45 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name,
46 value, size, flags); 46 value, size, flags);
47} 47}
48 48
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index f470e44c4b8d..ecdc4605192c 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -36,7 +36,7 @@ ext2_xattr_user_get(struct dentry *dentry, const char *name,
36 return -EINVAL; 36 return -EINVAL;
37 if (!test_opt(dentry->d_sb, XATTR_USER)) 37 if (!test_opt(dentry->d_sb, XATTR_USER))
38 return -EOPNOTSUPP; 38 return -EOPNOTSUPP;
39 return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_USER, 39 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER,
40 name, buffer, size); 40 name, buffer, size);
41} 41}
42 42
@@ -49,7 +49,7 @@ ext2_xattr_user_set(struct dentry *dentry, const char *name,
49 if (!test_opt(dentry->d_sb, XATTR_USER)) 49 if (!test_opt(dentry->d_sb, XATTR_USER))
50 return -EOPNOTSUPP; 50 return -EOPNOTSUPP;
51 51
52 return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_USER, 52 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER,
53 name, value, size, flags); 53 name, value, size, flags);
54} 54}
55 55
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index a1b810230cc5..3ad242e5840e 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -210,7 +210,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
210 avefreeb = freeb / ngroups; 210 avefreeb = freeb / ngroups;
211 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); 211 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
212 212
213 if ((parent == sb->s_root->d_inode) || 213 if ((parent == d_inode(sb->s_root)) ||
214 (EXT3_I(parent)->i_flags & EXT3_TOPDIR_FL)) { 214 (EXT3_I(parent)->i_flags & EXT3_TOPDIR_FL)) {
215 int best_ndir = inodes_per_group; 215 int best_ndir = inodes_per_group;
216 int best_group = -1; 216 int best_group = -1;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 13c0868c7160..2ee2dc4351d1 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -3240,7 +3240,7 @@ int ext3_write_inode(struct inode *inode, struct writeback_control *wbc)
3240 */ 3240 */
3241int ext3_setattr(struct dentry *dentry, struct iattr *attr) 3241int ext3_setattr(struct dentry *dentry, struct iattr *attr)
3242{ 3242{
3243 struct inode *inode = dentry->d_inode; 3243 struct inode *inode = d_inode(dentry);
3244 int error, rc = 0; 3244 int error, rc = 0;
3245 const unsigned int ia_valid = attr->ia_valid; 3245 const unsigned int ia_valid = attr->ia_valid;
3246 3246
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index f197736dccfa..4264b9bd0002 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1049,19 +1049,19 @@ struct dentry *ext3_get_parent(struct dentry *child)
1049 struct ext3_dir_entry_2 * de; 1049 struct ext3_dir_entry_2 * de;
1050 struct buffer_head *bh; 1050 struct buffer_head *bh;
1051 1051
1052 bh = ext3_find_entry(child->d_inode, &dotdot, &de); 1052 bh = ext3_find_entry(d_inode(child), &dotdot, &de);
1053 if (!bh) 1053 if (!bh)
1054 return ERR_PTR(-ENOENT); 1054 return ERR_PTR(-ENOENT);
1055 ino = le32_to_cpu(de->inode); 1055 ino = le32_to_cpu(de->inode);
1056 brelse(bh); 1056 brelse(bh);
1057 1057
1058 if (!ext3_valid_inum(child->d_inode->i_sb, ino)) { 1058 if (!ext3_valid_inum(d_inode(child)->i_sb, ino)) {
1059 ext3_error(child->d_inode->i_sb, "ext3_get_parent", 1059 ext3_error(d_inode(child)->i_sb, "ext3_get_parent",
1060 "bad inode number: %lu", ino); 1060 "bad inode number: %lu", ino);
1061 return ERR_PTR(-EIO); 1061 return ERR_PTR(-EIO);
1062 } 1062 }
1063 1063
1064 return d_obtain_alias(ext3_iget(child->d_inode->i_sb, ino)); 1064 return d_obtain_alias(ext3_iget(d_inode(child)->i_sb, ino));
1065} 1065}
1066 1066
1067#define S_SHIFT 12 1067#define S_SHIFT 12
@@ -1243,7 +1243,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1243 struct inode *inode, struct ext3_dir_entry_2 *de, 1243 struct inode *inode, struct ext3_dir_entry_2 *de,
1244 struct buffer_head * bh) 1244 struct buffer_head * bh)
1245{ 1245{
1246 struct inode *dir = dentry->d_parent->d_inode; 1246 struct inode *dir = d_inode(dentry->d_parent);
1247 const char *name = dentry->d_name.name; 1247 const char *name = dentry->d_name.name;
1248 int namelen = dentry->d_name.len; 1248 int namelen = dentry->d_name.len;
1249 unsigned long offset = 0; 1249 unsigned long offset = 0;
@@ -1330,7 +1330,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1330static int make_indexed_dir(handle_t *handle, struct dentry *dentry, 1330static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1331 struct inode *inode, struct buffer_head *bh) 1331 struct inode *inode, struct buffer_head *bh)
1332{ 1332{
1333 struct inode *dir = dentry->d_parent->d_inode; 1333 struct inode *dir = d_inode(dentry->d_parent);
1334 const char *name = dentry->d_name.name; 1334 const char *name = dentry->d_name.name;
1335 int namelen = dentry->d_name.len; 1335 int namelen = dentry->d_name.len;
1336 struct buffer_head *bh2; 1336 struct buffer_head *bh2;
@@ -1435,7 +1435,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1435static int ext3_add_entry (handle_t *handle, struct dentry *dentry, 1435static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1436 struct inode *inode) 1436 struct inode *inode)
1437{ 1437{
1438 struct inode *dir = dentry->d_parent->d_inode; 1438 struct inode *dir = d_inode(dentry->d_parent);
1439 struct buffer_head * bh; 1439 struct buffer_head * bh;
1440 struct ext3_dir_entry_2 *de; 1440 struct ext3_dir_entry_2 *de;
1441 struct super_block * sb; 1441 struct super_block * sb;
@@ -1489,7 +1489,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
1489 struct dx_entry *entries, *at; 1489 struct dx_entry *entries, *at;
1490 struct dx_hash_info hinfo; 1490 struct dx_hash_info hinfo;
1491 struct buffer_head * bh; 1491 struct buffer_head * bh;
1492 struct inode *dir = dentry->d_parent->d_inode; 1492 struct inode *dir = d_inode(dentry->d_parent);
1493 struct super_block * sb = dir->i_sb; 1493 struct super_block * sb = dir->i_sb;
1494 struct ext3_dir_entry_2 *de; 1494 struct ext3_dir_entry_2 *de;
1495 int err; 1495 int err;
@@ -2111,7 +2111,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
2111 /* Initialize quotas before so that eventual writes go in 2111 /* Initialize quotas before so that eventual writes go in
2112 * separate transaction */ 2112 * separate transaction */
2113 dquot_initialize(dir); 2113 dquot_initialize(dir);
2114 dquot_initialize(dentry->d_inode); 2114 dquot_initialize(d_inode(dentry));
2115 2115
2116 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); 2116 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
2117 if (IS_ERR(handle)) 2117 if (IS_ERR(handle))
@@ -2125,7 +2125,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
2125 if (IS_DIRSYNC(dir)) 2125 if (IS_DIRSYNC(dir))
2126 handle->h_sync = 1; 2126 handle->h_sync = 1;
2127 2127
2128 inode = dentry->d_inode; 2128 inode = d_inode(dentry);
2129 2129
2130 retval = -EIO; 2130 retval = -EIO;
2131 if (le32_to_cpu(de->inode) != inode->i_ino) 2131 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -2173,7 +2173,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
2173 /* Initialize quotas before so that eventual writes go 2173 /* Initialize quotas before so that eventual writes go
2174 * in separate transaction */ 2174 * in separate transaction */
2175 dquot_initialize(dir); 2175 dquot_initialize(dir);
2176 dquot_initialize(dentry->d_inode); 2176 dquot_initialize(d_inode(dentry));
2177 2177
2178 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); 2178 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
2179 if (IS_ERR(handle)) 2179 if (IS_ERR(handle))
@@ -2187,7 +2187,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
2187 if (!bh) 2187 if (!bh)
2188 goto end_unlink; 2188 goto end_unlink;
2189 2189
2190 inode = dentry->d_inode; 2190 inode = d_inode(dentry);
2191 2191
2192 retval = -EIO; 2192 retval = -EIO;
2193 if (le32_to_cpu(de->inode) != inode->i_ino) 2193 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -2328,7 +2328,7 @@ static int ext3_link (struct dentry * old_dentry,
2328 struct inode * dir, struct dentry *dentry) 2328 struct inode * dir, struct dentry *dentry)
2329{ 2329{
2330 handle_t *handle; 2330 handle_t *handle;
2331 struct inode *inode = old_dentry->d_inode; 2331 struct inode *inode = d_inode(old_dentry);
2332 int err, retries = 0; 2332 int err, retries = 0;
2333 2333
2334 if (inode->i_nlink >= EXT3_LINK_MAX) 2334 if (inode->i_nlink >= EXT3_LINK_MAX)
@@ -2391,8 +2391,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2391 2391
2392 /* Initialize quotas before so that eventual writes go 2392 /* Initialize quotas before so that eventual writes go
2393 * in separate transaction */ 2393 * in separate transaction */
2394 if (new_dentry->d_inode) 2394 if (d_really_is_positive(new_dentry))
2395 dquot_initialize(new_dentry->d_inode); 2395 dquot_initialize(d_inode(new_dentry));
2396 handle = ext3_journal_start(old_dir, 2 * 2396 handle = ext3_journal_start(old_dir, 2 *
2397 EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + 2397 EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) +
2398 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); 2398 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2);
@@ -2409,12 +2409,12 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2409 * and merrily kill the link to whatever was created under the 2409 * and merrily kill the link to whatever was created under the
2410 * same name. Goodbye sticky bit ;-< 2410 * same name. Goodbye sticky bit ;-<
2411 */ 2411 */
2412 old_inode = old_dentry->d_inode; 2412 old_inode = d_inode(old_dentry);
2413 retval = -ENOENT; 2413 retval = -ENOENT;
2414 if (!old_bh || le32_to_cpu(old_de->inode) != old_inode->i_ino) 2414 if (!old_bh || le32_to_cpu(old_de->inode) != old_inode->i_ino)
2415 goto end_rename; 2415 goto end_rename;
2416 2416
2417 new_inode = new_dentry->d_inode; 2417 new_inode = d_inode(new_dentry);
2418 new_bh = ext3_find_entry(new_dir, &new_dentry->d_name, &new_de); 2418 new_bh = ext3_find_entry(new_dir, &new_dentry->d_name, &new_de);
2419 if (new_bh) { 2419 if (new_bh) {
2420 if (!new_inode) { 2420 if (!new_inode) {
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index d4dbf3c259b3..30abbab2c65b 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1170,7 +1170,7 @@ static int parse_options (char *options, struct super_block *sb,
1170 return 0; 1170 return 0;
1171 } 1171 }
1172 1172
1173 journal_inode = path.dentry->d_inode; 1173 journal_inode = d_inode(path.dentry);
1174 if (!S_ISBLK(journal_inode->i_mode)) { 1174 if (!S_ISBLK(journal_inode->i_mode)) {
1175 ext3_msg(sb, KERN_ERR, "error: journal path %s " 1175 ext3_msg(sb, KERN_ERR, "error: journal path %s "
1176 "is not a block device", journal_path); 1176 "is not a block device", journal_path);
@@ -2947,7 +2947,7 @@ static int ext3_write_info(struct super_block *sb, int type)
2947 handle_t *handle; 2947 handle_t *handle;
2948 2948
2949 /* Data block + inode block */ 2949 /* Data block + inode block */
2950 handle = ext3_journal_start(sb->s_root->d_inode, 2); 2950 handle = ext3_journal_start(d_inode(sb->s_root), 2);
2951 if (IS_ERR(handle)) 2951 if (IS_ERR(handle))
2952 return PTR_ERR(handle); 2952 return PTR_ERR(handle);
2953 ret = dquot_commit_info(sb, type); 2953 ret = dquot_commit_info(sb, type);
@@ -2994,7 +2994,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2994 * When we journal data on quota file, we have to flush journal to see 2994 * When we journal data on quota file, we have to flush journal to see
2995 * all updates to the file when we bypass pagecache... 2995 * all updates to the file when we bypass pagecache...
2996 */ 2996 */
2997 if (ext3_should_journal_data(path->dentry->d_inode)) { 2997 if (ext3_should_journal_data(d_inode(path->dentry))) {
2998 /* 2998 /*
2999 * We don't need to lock updates but journal_flush() could 2999 * We don't need to lock updates but journal_flush() could
3000 * otherwise be livelocked... 3000 * otherwise be livelocked...
diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c
index 6b01c3eab1f3..ea96df3c58db 100644
--- a/fs/ext3/symlink.c
+++ b/fs/ext3/symlink.c
@@ -23,7 +23,7 @@
23 23
24static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) 24static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
25{ 25{
26 struct ext3_inode_info *ei = EXT3_I(dentry->d_inode); 26 struct ext3_inode_info *ei = EXT3_I(d_inode(dentry));
27 nd_set_link(nd, (char*)ei->i_data); 27 nd_set_link(nd, (char*)ei->i_data);
28 return NULL; 28 return NULL;
29} 29}
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index c6874be6d58b..a5591d721b55 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -137,7 +137,7 @@ ext3_xattr_handler(int name_index)
137/* 137/*
138 * Inode operation listxattr() 138 * Inode operation listxattr()
139 * 139 *
140 * dentry->d_inode->i_mutex: don't care 140 * d_inode(dentry)->i_mutex: don't care
141 */ 141 */
142ssize_t 142ssize_t
143ext3_listxattr(struct dentry *dentry, char *buffer, size_t size) 143ext3_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -355,7 +355,7 @@ ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry,
355static int 355static int
356ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) 356ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
357{ 357{
358 struct inode *inode = dentry->d_inode; 358 struct inode *inode = d_inode(dentry);
359 struct buffer_head *bh = NULL; 359 struct buffer_head *bh = NULL;
360 int error; 360 int error;
361 361
@@ -391,7 +391,7 @@ cleanup:
391static int 391static int
392ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) 392ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
393{ 393{
394 struct inode *inode = dentry->d_inode; 394 struct inode *inode = d_inode(dentry);
395 struct ext3_xattr_ibody_header *header; 395 struct ext3_xattr_ibody_header *header;
396 struct ext3_inode *raw_inode; 396 struct ext3_inode *raw_inode;
397 struct ext3_iloc iloc; 397 struct ext3_iloc iloc;
@@ -432,7 +432,7 @@ ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
432{ 432{
433 int i_error, b_error; 433 int i_error, b_error;
434 434
435 down_read(&EXT3_I(dentry->d_inode)->xattr_sem); 435 down_read(&EXT3_I(d_inode(dentry))->xattr_sem);
436 i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size); 436 i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size);
437 if (i_error < 0) { 437 if (i_error < 0) {
438 b_error = 0; 438 b_error = 0;
@@ -445,7 +445,7 @@ ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
445 if (b_error < 0) 445 if (b_error < 0)
446 i_error = 0; 446 i_error = 0;
447 } 447 }
448 up_read(&EXT3_I(dentry->d_inode)->xattr_sem); 448 up_read(&EXT3_I(d_inode(dentry))->xattr_sem);
449 return i_error + b_error; 449 return i_error + b_error;
450} 450}
451 451
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c
index 722c2bf9645d..c9506d5e3b13 100644
--- a/fs/ext3/xattr_security.c
+++ b/fs/ext3/xattr_security.c
@@ -29,7 +29,7 @@ ext3_xattr_security_get(struct dentry *dentry, const char *name,
29{ 29{
30 if (strcmp(name, "") == 0) 30 if (strcmp(name, "") == 0)
31 return -EINVAL; 31 return -EINVAL;
32 return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, 32 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY,
33 name, buffer, size); 33 name, buffer, size);
34} 34}
35 35
@@ -39,7 +39,7 @@ ext3_xattr_security_set(struct dentry *dentry, const char *name,
39{ 39{
40 if (strcmp(name, "") == 0) 40 if (strcmp(name, "") == 0)
41 return -EINVAL; 41 return -EINVAL;
42 return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, 42 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY,
43 name, value, size, flags); 43 name, value, size, flags);
44} 44}
45 45
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c
index d75727cc67fa..206cc66dc285 100644
--- a/fs/ext3/xattr_trusted.c
+++ b/fs/ext3/xattr_trusted.c
@@ -32,7 +32,7 @@ ext3_xattr_trusted_get(struct dentry *dentry, const char *name,
32{ 32{
33 if (strcmp(name, "") == 0) 33 if (strcmp(name, "") == 0)
34 return -EINVAL; 34 return -EINVAL;
35 return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, 35 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED,
36 name, buffer, size); 36 name, buffer, size);
37} 37}
38 38
@@ -42,7 +42,7 @@ ext3_xattr_trusted_set(struct dentry *dentry, const char *name,
42{ 42{
43 if (strcmp(name, "") == 0) 43 if (strcmp(name, "") == 0)
44 return -EINVAL; 44 return -EINVAL;
45 return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, name, 45 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, name,
46 value, size, flags); 46 value, size, flags);
47} 47}
48 48
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c
index 5612af3567e0..021508ad1616 100644
--- a/fs/ext3/xattr_user.c
+++ b/fs/ext3/xattr_user.c
@@ -34,7 +34,7 @@ ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer,
34 return -EINVAL; 34 return -EINVAL;
35 if (!test_opt(dentry->d_sb, XATTR_USER)) 35 if (!test_opt(dentry->d_sb, XATTR_USER))
36 return -EOPNOTSUPP; 36 return -EOPNOTSUPP;
37 return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_USER, 37 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_USER,
38 name, buffer, size); 38 name, buffer, size);
39} 39}
40 40
@@ -46,7 +46,7 @@ ext3_xattr_user_set(struct dentry *dentry, const char *name,
46 return -EINVAL; 46 return -EINVAL;
47 if (!test_opt(dentry->d_sb, XATTR_USER)) 47 if (!test_opt(dentry->d_sb, XATTR_USER))
48 return -EOPNOTSUPP; 48 return -EOPNOTSUPP;
49 return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_USER, 49 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_USER,
50 name, value, size, flags); 50 name, value, size, flags);
51} 51}
52 52
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index a8bc47f75fa0..3ceedea099ea 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -56,7 +56,7 @@ static int ext4_sync_parent(struct inode *inode)
56 dentry = d_find_any_alias(inode); 56 dentry = d_find_any_alias(inode);
57 if (!dentry) 57 if (!dentry)
58 break; 58 break;
59 next = igrab(dentry->d_parent->d_inode); 59 next = igrab(d_inode(dentry->d_parent));
60 dput(dentry); 60 dput(dentry);
61 if (!next) 61 if (!next)
62 break; 62 break;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index ac644c31ca67..d8d4f2929cbd 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -444,7 +444,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
444 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); 444 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
445 445
446 if (S_ISDIR(mode) && 446 if (S_ISDIR(mode) &&
447 ((parent == sb->s_root->d_inode) || 447 ((parent == d_inode(sb->s_root)) ||
448 (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { 448 (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) {
449 int best_ndir = inodes_per_group; 449 int best_ndir = inodes_per_group;
450 int ret = -1; 450 int ret = -1;
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 4b143febf21f..f696948c548b 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -998,7 +998,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
998 struct ext4_iloc *iloc, 998 struct ext4_iloc *iloc,
999 void *inline_start, int inline_size) 999 void *inline_start, int inline_size)
1000{ 1000{
1001 struct inode *dir = dentry->d_parent->d_inode; 1001 struct inode *dir = d_inode(dentry->d_parent);
1002 const char *name = dentry->d_name.name; 1002 const char *name = dentry->d_name.name;
1003 int namelen = dentry->d_name.len; 1003 int namelen = dentry->d_name.len;
1004 int err; 1004 int err;
@@ -1251,7 +1251,7 @@ int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry,
1251 int ret, inline_size; 1251 int ret, inline_size;
1252 void *inline_start; 1252 void *inline_start;
1253 struct ext4_iloc iloc; 1253 struct ext4_iloc iloc;
1254 struct inode *dir = dentry->d_parent->d_inode; 1254 struct inode *dir = d_inode(dentry->d_parent);
1255 1255
1256 ret = ext4_get_inode_loc(dir, &iloc); 1256 ret = ext4_get_inode_loc(dir, &iloc);
1257 if (ret) 1257 if (ret)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 42c942a950e1..063052e4aa8b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4524,7 +4524,7 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
4524 */ 4524 */
4525int ext4_setattr(struct dentry *dentry, struct iattr *attr) 4525int ext4_setattr(struct dentry *dentry, struct iattr *attr)
4526{ 4526{
4527 struct inode *inode = dentry->d_inode; 4527 struct inode *inode = d_inode(dentry);
4528 int error, rc = 0; 4528 int error, rc = 0;
4529 int orphan = 0; 4529 int orphan = 0;
4530 const unsigned int ia_valid = attr->ia_valid; 4530 const unsigned int ia_valid = attr->ia_valid;
@@ -4672,7 +4672,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
4672 struct inode *inode; 4672 struct inode *inode;
4673 unsigned long long delalloc_blocks; 4673 unsigned long long delalloc_blocks;
4674 4674
4675 inode = dentry->d_inode; 4675 inode = d_inode(dentry);
4676 generic_fillattr(inode, stat); 4676 generic_fillattr(inode, stat);
4677 4677
4678 /* 4678 /*
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index 3cb267aee802..b52374e42102 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -475,7 +475,7 @@ int ext4_ext_migrate(struct inode *inode)
475 EXT4_INODES_PER_GROUP(inode->i_sb)) + 1; 475 EXT4_INODES_PER_GROUP(inode->i_sb)) + 1;
476 owner[0] = i_uid_read(inode); 476 owner[0] = i_uid_read(inode);
477 owner[1] = i_gid_read(inode); 477 owner[1] = i_gid_read(inode);
478 tmp_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, 478 tmp_inode = ext4_new_inode(handle, d_inode(inode->i_sb->s_root),
479 S_IFREG, NULL, goal, owner); 479 S_IFREG, NULL, goal, owner);
480 if (IS_ERR(tmp_inode)) { 480 if (IS_ERR(tmp_inode)) {
481 retval = PTR_ERR(tmp_inode); 481 retval = PTR_ERR(tmp_inode);
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 28fe71a2904c..e086eebe335e 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1429,7 +1429,7 @@ struct dentry *ext4_get_parent(struct dentry *child)
1429 struct ext4_dir_entry_2 * de; 1429 struct ext4_dir_entry_2 * de;
1430 struct buffer_head *bh; 1430 struct buffer_head *bh;
1431 1431
1432 bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); 1432 bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL);
1433 if (IS_ERR(bh)) 1433 if (IS_ERR(bh))
1434 return (struct dentry *) bh; 1434 return (struct dentry *) bh;
1435 if (!bh) 1435 if (!bh)
@@ -1437,13 +1437,13 @@ struct dentry *ext4_get_parent(struct dentry *child)
1437 ino = le32_to_cpu(de->inode); 1437 ino = le32_to_cpu(de->inode);
1438 brelse(bh); 1438 brelse(bh);
1439 1439
1440 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { 1440 if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) {
1441 EXT4_ERROR_INODE(child->d_inode, 1441 EXT4_ERROR_INODE(d_inode(child),
1442 "bad parent inode number: %u", ino); 1442 "bad parent inode number: %u", ino);
1443 return ERR_PTR(-EIO); 1443 return ERR_PTR(-EIO);
1444 } 1444 }
1445 1445
1446 return d_obtain_alias(ext4_iget_normal(child->d_inode->i_sb, ino)); 1446 return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino));
1447} 1447}
1448 1448
1449/* 1449/*
@@ -1676,7 +1676,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1676 struct inode *inode, struct ext4_dir_entry_2 *de, 1676 struct inode *inode, struct ext4_dir_entry_2 *de,
1677 struct buffer_head *bh) 1677 struct buffer_head *bh)
1678{ 1678{
1679 struct inode *dir = dentry->d_parent->d_inode; 1679 struct inode *dir = d_inode(dentry->d_parent);
1680 const char *name = dentry->d_name.name; 1680 const char *name = dentry->d_name.name;
1681 int namelen = dentry->d_name.len; 1681 int namelen = dentry->d_name.len;
1682 unsigned int blocksize = dir->i_sb->s_blocksize; 1682 unsigned int blocksize = dir->i_sb->s_blocksize;
@@ -1732,7 +1732,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1732static int make_indexed_dir(handle_t *handle, struct dentry *dentry, 1732static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1733 struct inode *inode, struct buffer_head *bh) 1733 struct inode *inode, struct buffer_head *bh)
1734{ 1734{
1735 struct inode *dir = dentry->d_parent->d_inode; 1735 struct inode *dir = d_inode(dentry->d_parent);
1736 const char *name = dentry->d_name.name; 1736 const char *name = dentry->d_name.name;
1737 int namelen = dentry->d_name.len; 1737 int namelen = dentry->d_name.len;
1738 struct buffer_head *bh2; 1738 struct buffer_head *bh2;
@@ -1864,7 +1864,7 @@ out_frames:
1864static int ext4_add_entry(handle_t *handle, struct dentry *dentry, 1864static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1865 struct inode *inode) 1865 struct inode *inode)
1866{ 1866{
1867 struct inode *dir = dentry->d_parent->d_inode; 1867 struct inode *dir = d_inode(dentry->d_parent);
1868 struct buffer_head *bh; 1868 struct buffer_head *bh;
1869 struct ext4_dir_entry_2 *de; 1869 struct ext4_dir_entry_2 *de;
1870 struct ext4_dir_entry_tail *t; 1870 struct ext4_dir_entry_tail *t;
@@ -1947,7 +1947,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1947 struct dx_entry *entries, *at; 1947 struct dx_entry *entries, *at;
1948 struct dx_hash_info hinfo; 1948 struct dx_hash_info hinfo;
1949 struct buffer_head *bh; 1949 struct buffer_head *bh;
1950 struct inode *dir = dentry->d_parent->d_inode; 1950 struct inode *dir = d_inode(dentry->d_parent);
1951 struct super_block *sb = dir->i_sb; 1951 struct super_block *sb = dir->i_sb;
1952 struct ext4_dir_entry_2 *de; 1952 struct ext4_dir_entry_2 *de;
1953 int err; 1953 int err;
@@ -2708,7 +2708,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
2708 /* Initialize quotas before so that eventual writes go in 2708 /* Initialize quotas before so that eventual writes go in
2709 * separate transaction */ 2709 * separate transaction */
2710 dquot_initialize(dir); 2710 dquot_initialize(dir);
2711 dquot_initialize(dentry->d_inode); 2711 dquot_initialize(d_inode(dentry));
2712 2712
2713 retval = -ENOENT; 2713 retval = -ENOENT;
2714 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); 2714 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
@@ -2717,7 +2717,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
2717 if (!bh) 2717 if (!bh)
2718 goto end_rmdir; 2718 goto end_rmdir;
2719 2719
2720 inode = dentry->d_inode; 2720 inode = d_inode(dentry);
2721 2721
2722 retval = -EIO; 2722 retval = -EIO;
2723 if (le32_to_cpu(de->inode) != inode->i_ino) 2723 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -2777,7 +2777,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2777 /* Initialize quotas before so that eventual writes go 2777 /* Initialize quotas before so that eventual writes go
2778 * in separate transaction */ 2778 * in separate transaction */
2779 dquot_initialize(dir); 2779 dquot_initialize(dir);
2780 dquot_initialize(dentry->d_inode); 2780 dquot_initialize(d_inode(dentry));
2781 2781
2782 retval = -ENOENT; 2782 retval = -ENOENT;
2783 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); 2783 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
@@ -2786,7 +2786,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2786 if (!bh) 2786 if (!bh)
2787 goto end_unlink; 2787 goto end_unlink;
2788 2788
2789 inode = dentry->d_inode; 2789 inode = d_inode(dentry);
2790 2790
2791 retval = -EIO; 2791 retval = -EIO;
2792 if (le32_to_cpu(de->inode) != inode->i_ino) 2792 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -2938,7 +2938,7 @@ static int ext4_link(struct dentry *old_dentry,
2938 struct inode *dir, struct dentry *dentry) 2938 struct inode *dir, struct dentry *dentry)
2939{ 2939{
2940 handle_t *handle; 2940 handle_t *handle;
2941 struct inode *inode = old_dentry->d_inode; 2941 struct inode *inode = d_inode(old_dentry);
2942 int err, retries = 0; 2942 int err, retries = 0;
2943 2943
2944 if (inode->i_nlink >= EXT4_LINK_MAX) 2944 if (inode->i_nlink >= EXT4_LINK_MAX)
@@ -3210,12 +3210,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
3210 struct ext4_renament old = { 3210 struct ext4_renament old = {
3211 .dir = old_dir, 3211 .dir = old_dir,
3212 .dentry = old_dentry, 3212 .dentry = old_dentry,
3213 .inode = old_dentry->d_inode, 3213 .inode = d_inode(old_dentry),
3214 }; 3214 };
3215 struct ext4_renament new = { 3215 struct ext4_renament new = {
3216 .dir = new_dir, 3216 .dir = new_dir,
3217 .dentry = new_dentry, 3217 .dentry = new_dentry,
3218 .inode = new_dentry->d_inode, 3218 .inode = d_inode(new_dentry),
3219 }; 3219 };
3220 int force_reread; 3220 int force_reread;
3221 int retval; 3221 int retval;
@@ -3391,12 +3391,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
3391 struct ext4_renament old = { 3391 struct ext4_renament old = {
3392 .dir = old_dir, 3392 .dir = old_dir,
3393 .dentry = old_dentry, 3393 .dentry = old_dentry,
3394 .inode = old_dentry->d_inode, 3394 .inode = d_inode(old_dentry),
3395 }; 3395 };
3396 struct ext4_renament new = { 3396 struct ext4_renament new = {
3397 .dir = new_dir, 3397 .dir = new_dir,
3398 .dentry = new_dentry, 3398 .dentry = new_dentry,
3399 .inode = new_dentry->d_inode, 3399 .inode = d_inode(new_dentry),
3400 }; 3400 };
3401 u8 new_file_type; 3401 u8 new_file_type;
3402 int retval; 3402 int retval;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e061e66c8280..386ba41fa17b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1568,7 +1568,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1568 return -1; 1568 return -1;
1569 } 1569 }
1570 1570
1571 journal_inode = path.dentry->d_inode; 1571 journal_inode = d_inode(path.dentry);
1572 if (!S_ISBLK(journal_inode->i_mode)) { 1572 if (!S_ISBLK(journal_inode->i_mode)) {
1573 ext4_msg(sb, KERN_ERR, "error: journal path %s " 1573 ext4_msg(sb, KERN_ERR, "error: journal path %s "
1574 "is not a block device", journal_path); 1574 "is not a block device", journal_path);
@@ -5199,7 +5199,7 @@ static int ext4_write_info(struct super_block *sb, int type)
5199 handle_t *handle; 5199 handle_t *handle;
5200 5200
5201 /* Data block + inode block */ 5201 /* Data block + inode block */
5202 handle = ext4_journal_start(sb->s_root->d_inode, EXT4_HT_QUOTA, 2); 5202 handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2);
5203 if (IS_ERR(handle)) 5203 if (IS_ERR(handle))
5204 return PTR_ERR(handle); 5204 return PTR_ERR(handle);
5205 ret = dquot_commit_info(sb, type); 5205 ret = dquot_commit_info(sb, type);
@@ -5247,7 +5247,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
5247 * all updates to the file when we bypass pagecache... 5247 * all updates to the file when we bypass pagecache...
5248 */ 5248 */
5249 if (EXT4_SB(sb)->s_journal && 5249 if (EXT4_SB(sb)->s_journal &&
5250 ext4_should_journal_data(path->dentry->d_inode)) { 5250 ext4_should_journal_data(d_inode(path->dentry))) {
5251 /* 5251 /*
5252 * We don't need to lock updates but journal_flush() could 5252 * We don't need to lock updates but journal_flush() could
5253 * otherwise be livelocked... 5253 * otherwise be livelocked...
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
index ff3711932018..57f50091b8d1 100644
--- a/fs/ext4/symlink.c
+++ b/fs/ext4/symlink.c
@@ -25,7 +25,7 @@
25 25
26static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) 26static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
27{ 27{
28 struct ext4_inode_info *ei = EXT4_I(dentry->d_inode); 28 struct ext4_inode_info *ei = EXT4_I(d_inode(dentry));
29 nd_set_link(nd, (char *) ei->i_data); 29 nd_set_link(nd, (char *) ei->i_data);
30 return NULL; 30 return NULL;
31} 31}
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 1e09fc77395c..19935320f7b4 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -179,7 +179,7 @@ ext4_xattr_handler(int name_index)
179/* 179/*
180 * Inode operation listxattr() 180 * Inode operation listxattr()
181 * 181 *
182 * dentry->d_inode->i_mutex: don't care 182 * d_inode(dentry)->i_mutex: don't care
183 */ 183 */
184ssize_t 184ssize_t
185ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) 185ext4_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -424,7 +424,7 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
424static int 424static int
425ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) 425ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
426{ 426{
427 struct inode *inode = dentry->d_inode; 427 struct inode *inode = d_inode(dentry);
428 struct buffer_head *bh = NULL; 428 struct buffer_head *bh = NULL;
429 int error; 429 int error;
430 struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); 430 struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
@@ -461,7 +461,7 @@ cleanup:
461static int 461static int
462ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) 462ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
463{ 463{
464 struct inode *inode = dentry->d_inode; 464 struct inode *inode = d_inode(dentry);
465 struct ext4_xattr_ibody_header *header; 465 struct ext4_xattr_ibody_header *header;
466 struct ext4_inode *raw_inode; 466 struct ext4_inode *raw_inode;
467 struct ext4_iloc iloc; 467 struct ext4_iloc iloc;
@@ -502,7 +502,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
502{ 502{
503 int ret, ret2; 503 int ret, ret2;
504 504
505 down_read(&EXT4_I(dentry->d_inode)->xattr_sem); 505 down_read(&EXT4_I(d_inode(dentry))->xattr_sem);
506 ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size); 506 ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
507 if (ret < 0) 507 if (ret < 0)
508 goto errout; 508 goto errout;
@@ -515,7 +515,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
515 goto errout; 515 goto errout;
516 ret += ret2; 516 ret += ret2;
517errout: 517errout:
518 up_read(&EXT4_I(dentry->d_inode)->xattr_sem); 518 up_read(&EXT4_I(d_inode(dentry))->xattr_sem);
519 return ret; 519 return ret;
520} 520}
521 521
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index d2a200624af5..95d90e0560f0 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -33,7 +33,7 @@ ext4_xattr_security_get(struct dentry *dentry, const char *name,
33{ 33{
34 if (strcmp(name, "") == 0) 34 if (strcmp(name, "") == 0)
35 return -EINVAL; 35 return -EINVAL;
36 return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_SECURITY, 36 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY,
37 name, buffer, size); 37 name, buffer, size);
38} 38}
39 39
@@ -43,7 +43,7 @@ ext4_xattr_security_set(struct dentry *dentry, const char *name,
43{ 43{
44 if (strcmp(name, "") == 0) 44 if (strcmp(name, "") == 0)
45 return -EINVAL; 45 return -EINVAL;
46 return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_SECURITY, 46 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY,
47 name, value, size, flags); 47 name, value, size, flags);
48} 48}
49 49
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index 95f1f4ab59a4..891ee2ddfbd6 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -36,7 +36,7 @@ ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
36{ 36{
37 if (strcmp(name, "") == 0) 37 if (strcmp(name, "") == 0)
38 return -EINVAL; 38 return -EINVAL;
39 return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_TRUSTED, 39 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED,
40 name, buffer, size); 40 name, buffer, size);
41} 41}
42 42
@@ -46,7 +46,7 @@ ext4_xattr_trusted_set(struct dentry *dentry, const char *name,
46{ 46{
47 if (strcmp(name, "") == 0) 47 if (strcmp(name, "") == 0)
48 return -EINVAL; 48 return -EINVAL;
49 return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_TRUSTED, 49 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED,
50 name, value, size, flags); 50 name, value, size, flags);
51} 51}
52 52
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index 0edb7611ffbe..6ed932b3c043 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -37,7 +37,7 @@ ext4_xattr_user_get(struct dentry *dentry, const char *name,
37 return -EINVAL; 37 return -EINVAL;
38 if (!test_opt(dentry->d_sb, XATTR_USER)) 38 if (!test_opt(dentry->d_sb, XATTR_USER))
39 return -EOPNOTSUPP; 39 return -EOPNOTSUPP;
40 return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_USER, 40 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER,
41 name, buffer, size); 41 name, buffer, size);
42} 42}
43 43
@@ -49,7 +49,7 @@ ext4_xattr_user_set(struct dentry *dentry, const char *name,
49 return -EINVAL; 49 return -EINVAL;
50 if (!test_opt(dentry->d_sb, XATTR_USER)) 50 if (!test_opt(dentry->d_sb, XATTR_USER))
51 return -EOPNOTSUPP; 51 return -EOPNOTSUPP;
52 return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_USER, 52 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER,
53 name, value, size, flags); 53 name, value, size, flags);
54} 54}
55 55
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 7fa3313ab0e2..02e4ab3e7d4d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1391,7 +1391,7 @@ bool f2fs_empty_dir(struct inode *);
1391 1391
1392static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) 1392static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode)
1393{ 1393{
1394 return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, 1394 return __f2fs_add_link(d_inode(dentry->d_parent), &dentry->d_name,
1395 inode); 1395 inode);
1396} 1396}
1397 1397
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index df6a0596eccf..71a74f1e2bfb 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -562,7 +562,7 @@ void f2fs_truncate(struct inode *inode)
562int f2fs_getattr(struct vfsmount *mnt, 562int f2fs_getattr(struct vfsmount *mnt,
563 struct dentry *dentry, struct kstat *stat) 563 struct dentry *dentry, struct kstat *stat)
564{ 564{
565 struct inode *inode = dentry->d_inode; 565 struct inode *inode = d_inode(dentry);
566 generic_fillattr(inode, stat); 566 generic_fillattr(inode, stat);
567 stat->blocks <<= 3; 567 stat->blocks <<= 3;
568 return 0; 568 return 0;
@@ -601,7 +601,7 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
601 601
602int f2fs_setattr(struct dentry *dentry, struct iattr *attr) 602int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
603{ 603{
604 struct inode *inode = dentry->d_inode; 604 struct inode *inode = d_inode(dentry);
605 struct f2fs_inode_info *fi = F2FS_I(inode); 605 struct f2fs_inode_info *fi = F2FS_I(inode);
606 int err; 606 int err;
607 607
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index e79639a9787a..ed7404706ca4 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -150,7 +150,7 @@ out:
150static int f2fs_link(struct dentry *old_dentry, struct inode *dir, 150static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
151 struct dentry *dentry) 151 struct dentry *dentry)
152{ 152{
153 struct inode *inode = old_dentry->d_inode; 153 struct inode *inode = d_inode(old_dentry);
154 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 154 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
155 int err; 155 int err;
156 156
@@ -181,10 +181,10 @@ out:
181struct dentry *f2fs_get_parent(struct dentry *child) 181struct dentry *f2fs_get_parent(struct dentry *child)
182{ 182{
183 struct qstr dotdot = QSTR_INIT("..", 2); 183 struct qstr dotdot = QSTR_INIT("..", 2);
184 unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot); 184 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot);
185 if (!ino) 185 if (!ino)
186 return ERR_PTR(-ENOENT); 186 return ERR_PTR(-ENOENT);
187 return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino)); 187 return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino));
188} 188}
189 189
190static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, 190static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
@@ -214,7 +214,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
214static int f2fs_unlink(struct inode *dir, struct dentry *dentry) 214static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
215{ 215{
216 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 216 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
217 struct inode *inode = dentry->d_inode; 217 struct inode *inode = d_inode(dentry);
218 struct f2fs_dir_entry *de; 218 struct f2fs_dir_entry *de;
219 struct page *page; 219 struct page *page;
220 int err = -ENOENT; 220 int err = -ENOENT;
@@ -326,7 +326,7 @@ out_fail:
326 326
327static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) 327static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
328{ 328{
329 struct inode *inode = dentry->d_inode; 329 struct inode *inode = d_inode(dentry);
330 if (f2fs_empty_dir(inode)) 330 if (f2fs_empty_dir(inode))
331 return f2fs_unlink(dir, dentry); 331 return f2fs_unlink(dir, dentry);
332 return -ENOTEMPTY; 332 return -ENOTEMPTY;
@@ -374,8 +374,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
374 struct inode *new_dir, struct dentry *new_dentry) 374 struct inode *new_dir, struct dentry *new_dentry)
375{ 375{
376 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 376 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
377 struct inode *old_inode = old_dentry->d_inode; 377 struct inode *old_inode = d_inode(old_dentry);
378 struct inode *new_inode = new_dentry->d_inode; 378 struct inode *new_inode = d_inode(new_dentry);
379 struct page *old_dir_page; 379 struct page *old_dir_page;
380 struct page *old_page, *new_page; 380 struct page *old_page, *new_page;
381 struct f2fs_dir_entry *old_dir_entry = NULL; 381 struct f2fs_dir_entry *old_dir_entry = NULL;
@@ -501,8 +501,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
501 struct inode *new_dir, struct dentry *new_dentry) 501 struct inode *new_dir, struct dentry *new_dentry)
502{ 502{
503 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 503 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
504 struct inode *old_inode = old_dentry->d_inode; 504 struct inode *old_inode = d_inode(old_dentry);
505 struct inode *new_inode = new_dentry->d_inode; 505 struct inode *new_inode = d_inode(new_dentry);
506 struct page *old_dir_page, *new_dir_page; 506 struct page *old_dir_page, *new_dir_page;
507 struct page *old_page, *new_page; 507 struct page *old_page, *new_page;
508 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL; 508 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL;
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 5072bf9ae0ef..62c82f35087e 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -83,7 +83,7 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
83 } 83 }
84 if (strcmp(name, "") == 0) 84 if (strcmp(name, "") == 0)
85 return -EINVAL; 85 return -EINVAL;
86 return f2fs_getxattr(dentry->d_inode, type, name, buffer, size, NULL); 86 return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL);
87} 87}
88 88
89static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, 89static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
@@ -108,7 +108,7 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
108 if (strcmp(name, "") == 0) 108 if (strcmp(name, "") == 0)
109 return -EINVAL; 109 return -EINVAL;
110 110
111 return f2fs_setxattr(dentry->d_inode, type, name, 111 return f2fs_setxattr(d_inode(dentry), type, name,
112 value, size, NULL, flags); 112 value, size, NULL, flags);
113} 113}
114 114
@@ -130,7 +130,7 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
130static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, 130static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
131 void *buffer, size_t size, int type) 131 void *buffer, size_t size, int type)
132{ 132{
133 struct inode *inode = dentry->d_inode; 133 struct inode *inode = d_inode(dentry);
134 134
135 if (strcmp(name, "") != 0) 135 if (strcmp(name, "") != 0)
136 return -EINVAL; 136 return -EINVAL;
@@ -142,7 +142,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
142static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, 142static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
143 const void *value, size_t size, int flags, int type) 143 const void *value, size_t size, int flags, int type)
144{ 144{
145 struct inode *inode = dentry->d_inode; 145 struct inode *inode = d_inode(dentry);
146 146
147 if (strcmp(name, "") != 0) 147 if (strcmp(name, "") != 0)
148 return -EINVAL; 148 return -EINVAL;
@@ -442,7 +442,7 @@ cleanup:
442 442
443ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) 443ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
444{ 444{
445 struct inode *inode = dentry->d_inode; 445 struct inode *inode = d_inode(dentry);
446 struct f2fs_xattr_entry *entry; 446 struct f2fs_xattr_entry *entry;
447 void *base_addr; 447 void *base_addr;
448 int error = 0; 448 int error = 0;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 1e98d333879f..54646829e08e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -309,7 +309,7 @@ void fat_truncate_blocks(struct inode *inode, loff_t offset)
309 309
310int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 310int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
311{ 311{
312 struct inode *inode = dentry->d_inode; 312 struct inode *inode = d_inode(dentry);
313 generic_fillattr(inode, stat); 313 generic_fillattr(inode, stat);
314 stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; 314 stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size;
315 315
@@ -381,7 +381,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
381int fat_setattr(struct dentry *dentry, struct iattr *attr) 381int fat_setattr(struct dentry *dentry, struct iattr *attr)
382{ 382{
383 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); 383 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
384 struct inode *inode = dentry->d_inode; 384 struct inode *inode = d_inode(dentry);
385 unsigned int ia_valid; 385 unsigned int ia_valid;
386 int error; 386 int error;
387 387
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index a783b0e1272a..e68e794c71d2 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -310,7 +310,7 @@ out:
310static int msdos_rmdir(struct inode *dir, struct dentry *dentry) 310static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
311{ 311{
312 struct super_block *sb = dir->i_sb; 312 struct super_block *sb = dir->i_sb;
313 struct inode *inode = dentry->d_inode; 313 struct inode *inode = d_inode(dentry);
314 struct fat_slot_info sinfo; 314 struct fat_slot_info sinfo;
315 int err; 315 int err;
316 316
@@ -404,7 +404,7 @@ out:
404/***** Unlink a file */ 404/***** Unlink a file */
405static int msdos_unlink(struct inode *dir, struct dentry *dentry) 405static int msdos_unlink(struct inode *dir, struct dentry *dentry)
406{ 406{
407 struct inode *inode = dentry->d_inode; 407 struct inode *inode = d_inode(dentry);
408 struct super_block *sb = inode->i_sb; 408 struct super_block *sb = inode->i_sb;
409 struct fat_slot_info sinfo; 409 struct fat_slot_info sinfo;
410 int err; 410 int err;
@@ -442,8 +442,8 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
442 int err, old_attrs, is_dir, update_dotdot, corrupt = 0; 442 int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
443 443
444 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 444 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
445 old_inode = old_dentry->d_inode; 445 old_inode = d_inode(old_dentry);
446 new_inode = new_dentry->d_inode; 446 new_inode = d_inode(new_dentry);
447 447
448 err = fat_scan(old_dir, old_name, &old_sinfo); 448 err = fat_scan(old_dir, old_name, &old_sinfo);
449 if (err) { 449 if (err) {
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index b8b92c2f9683..af400ab27d48 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -35,7 +35,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
35{ 35{
36 int ret = 1; 36 int ret = 1;
37 spin_lock(&dentry->d_lock); 37 spin_lock(&dentry->d_lock);
38 if (dentry->d_time != dentry->d_parent->d_inode->i_version) 38 if (dentry->d_time != d_inode(dentry->d_parent)->i_version)
39 ret = 0; 39 ret = 0;
40 spin_unlock(&dentry->d_lock); 40 spin_unlock(&dentry->d_lock);
41 return ret; 41 return ret;
@@ -47,7 +47,7 @@ static int vfat_revalidate(struct dentry *dentry, unsigned int flags)
47 return -ECHILD; 47 return -ECHILD;
48 48
49 /* This is not negative dentry. Always valid. */ 49 /* This is not negative dentry. Always valid. */
50 if (dentry->d_inode) 50 if (d_really_is_positive(dentry))
51 return 1; 51 return 1;
52 return vfat_revalidate_shortname(dentry); 52 return vfat_revalidate_shortname(dentry);
53} 53}
@@ -67,7 +67,7 @@ static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags)
67 * positive dentry isn't good idea. So it's unsupported like 67 * positive dentry isn't good idea. So it's unsupported like
68 * rename("filename", "FILENAME") for now. 68 * rename("filename", "FILENAME") for now.
69 */ 69 */
70 if (dentry->d_inode) 70 if (d_really_is_positive(dentry))
71 return 1; 71 return 1;
72 72
73 /* 73 /*
@@ -803,7 +803,7 @@ out:
803 803
804static int vfat_rmdir(struct inode *dir, struct dentry *dentry) 804static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
805{ 805{
806 struct inode *inode = dentry->d_inode; 806 struct inode *inode = d_inode(dentry);
807 struct super_block *sb = dir->i_sb; 807 struct super_block *sb = dir->i_sb;
808 struct fat_slot_info sinfo; 808 struct fat_slot_info sinfo;
809 int err; 809 int err;
@@ -834,7 +834,7 @@ out:
834 834
835static int vfat_unlink(struct inode *dir, struct dentry *dentry) 835static int vfat_unlink(struct inode *dir, struct dentry *dentry)
836{ 836{
837 struct inode *inode = dentry->d_inode; 837 struct inode *inode = d_inode(dentry);
838 struct super_block *sb = dir->i_sb; 838 struct super_block *sb = dir->i_sb;
839 struct fat_slot_info sinfo; 839 struct fat_slot_info sinfo;
840 int err; 840 int err;
@@ -917,8 +917,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
917 struct super_block *sb = old_dir->i_sb; 917 struct super_block *sb = old_dir->i_sb;
918 918
919 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 919 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
920 old_inode = old_dentry->d_inode; 920 old_inode = d_inode(old_dentry);
921 new_inode = new_dentry->d_inode; 921 new_inode = d_inode(new_dentry);
922 mutex_lock(&MSDOS_SB(sb)->s_lock); 922 mutex_lock(&MSDOS_SB(sb)->s_lock);
923 err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); 923 err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo);
924 if (err) 924 if (err)
diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
index 93e14933dcb6..eb192656fba2 100644
--- a/fs/fat/nfs.c
+++ b/fs/fat/nfs.c
@@ -266,7 +266,7 @@ struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart)
266 * Find the parent for a directory that is not currently connected to 266 * Find the parent for a directory that is not currently connected to
267 * the filesystem root. 267 * the filesystem root.
268 * 268 *
269 * On entry, the caller holds child_dir->d_inode->i_mutex. 269 * On entry, the caller holds d_inode(child_dir)->i_mutex.
270 */ 270 */
271static struct dentry *fat_get_parent(struct dentry *child_dir) 271static struct dentry *fat_get_parent(struct dentry *child_dir)
272{ 272{
@@ -276,7 +276,7 @@ static struct dentry *fat_get_parent(struct dentry *child_dir)
276 struct inode *parent_inode = NULL; 276 struct inode *parent_inode = NULL;
277 struct msdos_sb_info *sbi = MSDOS_SB(sb); 277 struct msdos_sb_info *sbi = MSDOS_SB(sb);
278 278
279 if (!fat_get_dotdot_entry(child_dir->d_inode, &bh, &de)) { 279 if (!fat_get_dotdot_entry(d_inode(child_dir), &bh, &de)) {
280 int parent_logstart = fat_get_start(sbi, de); 280 int parent_logstart = fat_get_start(sbi, de);
281 parent_inode = fat_dget(sb, parent_logstart); 281 parent_inode = fat_dget(sb, parent_logstart);
282 if (!parent_inode && sbi->options.nfs == FAT_NFS_NOSTALE_RO) 282 if (!parent_inode && sbi->options.nfs == FAT_NFS_NOSTALE_RO)
diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c
index c36aeaf92e41..8b9229e2ca5c 100644
--- a/fs/freevxfs/vxfs_immed.c
+++ b/fs/freevxfs/vxfs_immed.c
@@ -76,7 +76,7 @@ const struct address_space_operations vxfs_immed_aops = {
76static void * 76static void *
77vxfs_immed_follow_link(struct dentry *dp, struct nameidata *np) 77vxfs_immed_follow_link(struct dentry *dp, struct nameidata *np)
78{ 78{
79 struct vxfs_inode_info *vip = VXFS_INO(dp->d_inode); 79 struct vxfs_inode_info *vip = VXFS_INO(d_inode(dp));
80 nd_set_link(np, vip->vii_immed.vi_immed); 80 nd_set_link(np, vip->vii_immed.vi_immed);
81 return NULL; 81 return NULL;
82} 82}
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 205e0d5d5307..f863ac6647ac 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -244,7 +244,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)
244 return 0; 244 return 0;
245 245
246 parent = fuse_control_sb->s_root; 246 parent = fuse_control_sb->s_root;
247 inc_nlink(parent->d_inode); 247 inc_nlink(d_inode(parent));
248 sprintf(name, "%u", fc->dev); 248 sprintf(name, "%u", fc->dev);
249 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, 249 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2,
250 &simple_dir_inode_operations, 250 &simple_dir_inode_operations,
@@ -283,11 +283,11 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc)
283 283
284 for (i = fc->ctl_ndents - 1; i >= 0; i--) { 284 for (i = fc->ctl_ndents - 1; i >= 0; i--) {
285 struct dentry *dentry = fc->ctl_dentry[i]; 285 struct dentry *dentry = fc->ctl_dentry[i];
286 dentry->d_inode->i_private = NULL; 286 d_inode(dentry)->i_private = NULL;
287 d_drop(dentry); 287 d_drop(dentry);
288 dput(dentry); 288 dput(dentry);
289 } 289 }
290 drop_nlink(fuse_control_sb->s_root->d_inode); 290 drop_nlink(d_inode(fuse_control_sb->s_root));
291} 291}
292 292
293static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) 293static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 1545b711ddcf..0572bca49f15 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -192,7 +192,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
192 struct fuse_inode *fi; 192 struct fuse_inode *fi;
193 int ret; 193 int ret;
194 194
195 inode = ACCESS_ONCE(entry->d_inode); 195 inode = d_inode_rcu(entry);
196 if (inode && is_bad_inode(inode)) 196 if (inode && is_bad_inode(inode))
197 goto invalid; 197 goto invalid;
198 else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || 198 else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
@@ -220,7 +220,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
220 attr_version = fuse_get_attr_version(fc); 220 attr_version = fuse_get_attr_version(fc);
221 221
222 parent = dget_parent(entry); 222 parent = dget_parent(entry);
223 fuse_lookup_init(fc, &args, get_node_id(parent->d_inode), 223 fuse_lookup_init(fc, &args, get_node_id(d_inode(parent)),
224 &entry->d_name, &outarg); 224 &entry->d_name, &outarg);
225 ret = fuse_simple_request(fc, &args); 225 ret = fuse_simple_request(fc, &args);
226 dput(parent); 226 dput(parent);
@@ -254,7 +254,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
254 return -ECHILD; 254 return -ECHILD;
255 } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) { 255 } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) {
256 parent = dget_parent(entry); 256 parent = dget_parent(entry);
257 fuse_advise_use_readdirplus(parent->d_inode); 257 fuse_advise_use_readdirplus(d_inode(parent));
258 dput(parent); 258 dput(parent);
259 } 259 }
260 } 260 }
@@ -487,7 +487,7 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
487 entry = res; 487 entry = res;
488 } 488 }
489 489
490 if (!(flags & O_CREAT) || entry->d_inode) 490 if (!(flags & O_CREAT) || d_really_is_positive(entry))
491 goto no_open; 491 goto no_open;
492 492
493 /* Only creates */ 493 /* Only creates */
@@ -653,7 +653,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
653 args.in.args[0].value = entry->d_name.name; 653 args.in.args[0].value = entry->d_name.name;
654 err = fuse_simple_request(fc, &args); 654 err = fuse_simple_request(fc, &args);
655 if (!err) { 655 if (!err) {
656 struct inode *inode = entry->d_inode; 656 struct inode *inode = d_inode(entry);
657 struct fuse_inode *fi = get_fuse_inode(inode); 657 struct fuse_inode *fi = get_fuse_inode(inode);
658 658
659 spin_lock(&fc->lock); 659 spin_lock(&fc->lock);
@@ -689,7 +689,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
689 args.in.args[0].value = entry->d_name.name; 689 args.in.args[0].value = entry->d_name.name;
690 err = fuse_simple_request(fc, &args); 690 err = fuse_simple_request(fc, &args);
691 if (!err) { 691 if (!err) {
692 clear_nlink(entry->d_inode); 692 clear_nlink(d_inode(entry));
693 fuse_invalidate_attr(dir); 693 fuse_invalidate_attr(dir);
694 fuse_invalidate_entry_cache(entry); 694 fuse_invalidate_entry_cache(entry);
695 } else if (err == -EINTR) 695 } else if (err == -EINTR)
@@ -721,12 +721,12 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
721 err = fuse_simple_request(fc, &args); 721 err = fuse_simple_request(fc, &args);
722 if (!err) { 722 if (!err) {
723 /* ctime changes */ 723 /* ctime changes */
724 fuse_invalidate_attr(oldent->d_inode); 724 fuse_invalidate_attr(d_inode(oldent));
725 fuse_update_ctime(oldent->d_inode); 725 fuse_update_ctime(d_inode(oldent));
726 726
727 if (flags & RENAME_EXCHANGE) { 727 if (flags & RENAME_EXCHANGE) {
728 fuse_invalidate_attr(newent->d_inode); 728 fuse_invalidate_attr(d_inode(newent));
729 fuse_update_ctime(newent->d_inode); 729 fuse_update_ctime(d_inode(newent));
730 } 730 }
731 731
732 fuse_invalidate_attr(olddir); 732 fuse_invalidate_attr(olddir);
@@ -734,10 +734,10 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
734 fuse_invalidate_attr(newdir); 734 fuse_invalidate_attr(newdir);
735 735
736 /* newent will end up negative */ 736 /* newent will end up negative */
737 if (!(flags & RENAME_EXCHANGE) && newent->d_inode) { 737 if (!(flags & RENAME_EXCHANGE) && d_really_is_positive(newent)) {
738 fuse_invalidate_attr(newent->d_inode); 738 fuse_invalidate_attr(d_inode(newent));
739 fuse_invalidate_entry_cache(newent); 739 fuse_invalidate_entry_cache(newent);
740 fuse_update_ctime(newent->d_inode); 740 fuse_update_ctime(d_inode(newent));
741 } 741 }
742 } else if (err == -EINTR) { 742 } else if (err == -EINTR) {
743 /* If request was interrupted, DEITY only knows if the 743 /* If request was interrupted, DEITY only knows if the
@@ -746,7 +746,7 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
746 directory), then there can be inconsistency between 746 directory), then there can be inconsistency between
747 the dcache and the real filesystem. Tough luck. */ 747 the dcache and the real filesystem. Tough luck. */
748 fuse_invalidate_entry(oldent); 748 fuse_invalidate_entry(oldent);
749 if (newent->d_inode) 749 if (d_really_is_positive(newent))
750 fuse_invalidate_entry(newent); 750 fuse_invalidate_entry(newent);
751 } 751 }
752 752
@@ -788,7 +788,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
788{ 788{
789 int err; 789 int err;
790 struct fuse_link_in inarg; 790 struct fuse_link_in inarg;
791 struct inode *inode = entry->d_inode; 791 struct inode *inode = d_inode(entry);
792 struct fuse_conn *fc = get_fuse_conn(inode); 792 struct fuse_conn *fc = get_fuse_conn(inode);
793 FUSE_ARGS(args); 793 FUSE_ARGS(args);
794 794
@@ -961,9 +961,9 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
961 fuse_invalidate_attr(parent); 961 fuse_invalidate_attr(parent);
962 fuse_invalidate_entry(entry); 962 fuse_invalidate_entry(entry);
963 963
964 if (child_nodeid != 0 && entry->d_inode) { 964 if (child_nodeid != 0 && d_really_is_positive(entry)) {
965 mutex_lock(&entry->d_inode->i_mutex); 965 mutex_lock(&d_inode(entry)->i_mutex);
966 if (get_node_id(entry->d_inode) != child_nodeid) { 966 if (get_node_id(d_inode(entry)) != child_nodeid) {
967 err = -ENOENT; 967 err = -ENOENT;
968 goto badentry; 968 goto badentry;
969 } 969 }
@@ -977,13 +977,13 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
977 err = -ENOTEMPTY; 977 err = -ENOTEMPTY;
978 goto badentry; 978 goto badentry;
979 } 979 }
980 entry->d_inode->i_flags |= S_DEAD; 980 d_inode(entry)->i_flags |= S_DEAD;
981 } 981 }
982 dont_mount(entry); 982 dont_mount(entry);
983 clear_nlink(entry->d_inode); 983 clear_nlink(d_inode(entry));
984 err = 0; 984 err = 0;
985 badentry: 985 badentry:
986 mutex_unlock(&entry->d_inode->i_mutex); 986 mutex_unlock(&d_inode(entry)->i_mutex);
987 if (!err) 987 if (!err)
988 d_delete(entry); 988 d_delete(entry);
989 } else { 989 } else {
@@ -1169,7 +1169,7 @@ static int fuse_direntplus_link(struct file *file,
1169 struct qstr name = QSTR_INIT(dirent->name, dirent->namelen); 1169 struct qstr name = QSTR_INIT(dirent->name, dirent->namelen);
1170 struct dentry *dentry; 1170 struct dentry *dentry;
1171 struct dentry *alias; 1171 struct dentry *alias;
1172 struct inode *dir = parent->d_inode; 1172 struct inode *dir = d_inode(parent);
1173 struct fuse_conn *fc; 1173 struct fuse_conn *fc;
1174 struct inode *inode; 1174 struct inode *inode;
1175 1175
@@ -1205,7 +1205,7 @@ static int fuse_direntplus_link(struct file *file,
1205 name.hash = full_name_hash(name.name, name.len); 1205 name.hash = full_name_hash(name.name, name.len);
1206 dentry = d_lookup(parent, &name); 1206 dentry = d_lookup(parent, &name);
1207 if (dentry) { 1207 if (dentry) {
1208 inode = dentry->d_inode; 1208 inode = d_inode(dentry);
1209 if (!inode) { 1209 if (!inode) {
1210 d_drop(dentry); 1210 d_drop(dentry);
1211 } else if (get_node_id(inode) != o->nodeid || 1211 } else if (get_node_id(inode) != o->nodeid ||
@@ -1367,7 +1367,7 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx)
1367 1367
1368static char *read_link(struct dentry *dentry) 1368static char *read_link(struct dentry *dentry)
1369{ 1369{
1370 struct inode *inode = dentry->d_inode; 1370 struct inode *inode = d_inode(dentry);
1371 struct fuse_conn *fc = get_fuse_conn(inode); 1371 struct fuse_conn *fc = get_fuse_conn(inode);
1372 FUSE_ARGS(args); 1372 FUSE_ARGS(args);
1373 char *link; 1373 char *link;
@@ -1712,7 +1712,7 @@ error:
1712 1712
1713static int fuse_setattr(struct dentry *entry, struct iattr *attr) 1713static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1714{ 1714{
1715 struct inode *inode = entry->d_inode; 1715 struct inode *inode = d_inode(entry);
1716 1716
1717 if (!fuse_allow_current_process(get_fuse_conn(inode))) 1717 if (!fuse_allow_current_process(get_fuse_conn(inode)))
1718 return -EACCES; 1718 return -EACCES;
@@ -1726,7 +1726,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1726static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, 1726static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1727 struct kstat *stat) 1727 struct kstat *stat)
1728{ 1728{
1729 struct inode *inode = entry->d_inode; 1729 struct inode *inode = d_inode(entry);
1730 struct fuse_conn *fc = get_fuse_conn(inode); 1730 struct fuse_conn *fc = get_fuse_conn(inode);
1731 1731
1732 if (!fuse_allow_current_process(fc)) 1732 if (!fuse_allow_current_process(fc))
@@ -1738,7 +1738,7 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1738static int fuse_setxattr(struct dentry *entry, const char *name, 1738static int fuse_setxattr(struct dentry *entry, const char *name,
1739 const void *value, size_t size, int flags) 1739 const void *value, size_t size, int flags)
1740{ 1740{
1741 struct inode *inode = entry->d_inode; 1741 struct inode *inode = d_inode(entry);
1742 struct fuse_conn *fc = get_fuse_conn(inode); 1742 struct fuse_conn *fc = get_fuse_conn(inode);
1743 FUSE_ARGS(args); 1743 FUSE_ARGS(args);
1744 struct fuse_setxattr_in inarg; 1744 struct fuse_setxattr_in inarg;
@@ -1774,7 +1774,7 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
1774static ssize_t fuse_getxattr(struct dentry *entry, const char *name, 1774static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
1775 void *value, size_t size) 1775 void *value, size_t size)
1776{ 1776{
1777 struct inode *inode = entry->d_inode; 1777 struct inode *inode = d_inode(entry);
1778 struct fuse_conn *fc = get_fuse_conn(inode); 1778 struct fuse_conn *fc = get_fuse_conn(inode);
1779 FUSE_ARGS(args); 1779 FUSE_ARGS(args);
1780 struct fuse_getxattr_in inarg; 1780 struct fuse_getxattr_in inarg;
@@ -1815,7 +1815,7 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
1815 1815
1816static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) 1816static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1817{ 1817{
1818 struct inode *inode = entry->d_inode; 1818 struct inode *inode = d_inode(entry);
1819 struct fuse_conn *fc = get_fuse_conn(inode); 1819 struct fuse_conn *fc = get_fuse_conn(inode);
1820 FUSE_ARGS(args); 1820 FUSE_ARGS(args);
1821 struct fuse_getxattr_in inarg; 1821 struct fuse_getxattr_in inarg;
@@ -1857,7 +1857,7 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1857 1857
1858static int fuse_removexattr(struct dentry *entry, const char *name) 1858static int fuse_removexattr(struct dentry *entry, const char *name)
1859{ 1859{
1860 struct inode *inode = entry->d_inode; 1860 struct inode *inode = d_inode(entry);
1861 struct fuse_conn *fc = get_fuse_conn(inode); 1861 struct fuse_conn *fc = get_fuse_conn(inode);
1862 FUSE_ARGS(args); 1862 FUSE_ARGS(args);
1863 int err; 1863 int err;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index e8799c11424b..082ac1c97f39 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -421,7 +421,7 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
421 memset(&outarg, 0, sizeof(outarg)); 421 memset(&outarg, 0, sizeof(outarg));
422 args.in.numargs = 0; 422 args.in.numargs = 0;
423 args.in.h.opcode = FUSE_STATFS; 423 args.in.h.opcode = FUSE_STATFS;
424 args.in.h.nodeid = get_node_id(dentry->d_inode); 424 args.in.h.nodeid = get_node_id(d_inode(dentry));
425 args.out.numargs = 1; 425 args.out.numargs = 1;
426 args.out.args[0].size = sizeof(outarg); 426 args.out.args[0].size = sizeof(outarg);
427 args.out.args[0].value = &outarg; 427 args.out.args[0].value = &outarg;
@@ -740,7 +740,7 @@ static struct dentry *fuse_fh_to_parent(struct super_block *sb,
740 740
741static struct dentry *fuse_get_parent(struct dentry *child) 741static struct dentry *fuse_get_parent(struct dentry *child)
742{ 742{
743 struct inode *child_inode = child->d_inode; 743 struct inode *child_inode = d_inode(child);
744 struct fuse_conn *fc = get_fuse_conn(child_inode); 744 struct fuse_conn *fc = get_fuse_conn(child_inode);
745 struct inode *inode; 745 struct inode *inode;
746 struct dentry *parent; 746 struct dentry *parent;
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c
index 589f4ea9381c..30822b148f3e 100644
--- a/fs/gfs2/dentry.c
+++ b/fs/gfs2/dentry.c
@@ -48,9 +48,9 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags)
48 return -ECHILD; 48 return -ECHILD;
49 49
50 parent = dget_parent(dentry); 50 parent = dget_parent(dentry);
51 sdp = GFS2_SB(parent->d_inode); 51 sdp = GFS2_SB(d_inode(parent));
52 dip = GFS2_I(parent->d_inode); 52 dip = GFS2_I(d_inode(parent));
53 inode = dentry->d_inode; 53 inode = d_inode(dentry);
54 54
55 if (inode) { 55 if (inode) {
56 if (is_bad_inode(inode)) 56 if (is_bad_inode(inode))
@@ -68,7 +68,7 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags)
68 goto fail; 68 goto fail;
69 } 69 }
70 70
71 error = gfs2_dir_check(parent->d_inode, &dentry->d_name, ip); 71 error = gfs2_dir_check(d_inode(parent), &dentry->d_name, ip);
72 switch (error) { 72 switch (error) {
73 case 0: 73 case 0:
74 if (!inode) 74 if (!inode)
@@ -113,10 +113,10 @@ static int gfs2_dentry_delete(const struct dentry *dentry)
113{ 113{
114 struct gfs2_inode *ginode; 114 struct gfs2_inode *ginode;
115 115
116 if (!dentry->d_inode) 116 if (d_really_is_negative(dentry))
117 return 0; 117 return 0;
118 118
119 ginode = GFS2_I(dentry->d_inode); 119 ginode = GFS2_I(d_inode(dentry));
120 if (!ginode->i_iopen_gh.gh_gl) 120 if (!ginode->i_iopen_gh.gh_gl)
121 return 0; 121 return 0;
122 122
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c
index c41d255b6a7b..5d15e9498b48 100644
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -49,7 +49,7 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len,
49 fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); 49 fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF);
50 *len = GFS2_SMALL_FH_SIZE; 50 *len = GFS2_SMALL_FH_SIZE;
51 51
52 if (!parent || inode == sb->s_root->d_inode) 52 if (!parent || inode == d_inode(sb->s_root))
53 return *len; 53 return *len;
54 54
55 ip = GFS2_I(parent); 55 ip = GFS2_I(parent);
@@ -88,8 +88,8 @@ static int get_name_filldir(struct dir_context *ctx, const char *name,
88static int gfs2_get_name(struct dentry *parent, char *name, 88static int gfs2_get_name(struct dentry *parent, char *name,
89 struct dentry *child) 89 struct dentry *child)
90{ 90{
91 struct inode *dir = parent->d_inode; 91 struct inode *dir = d_inode(parent);
92 struct inode *inode = child->d_inode; 92 struct inode *inode = d_inode(child);
93 struct gfs2_inode *dip, *ip; 93 struct gfs2_inode *dip, *ip;
94 struct get_name_filldir gnfd = { 94 struct get_name_filldir gnfd = {
95 .ctx.actor = get_name_filldir, 95 .ctx.actor = get_name_filldir,
@@ -128,7 +128,7 @@ static int gfs2_get_name(struct dentry *parent, char *name,
128 128
129static struct dentry *gfs2_get_parent(struct dentry *child) 129static struct dentry *gfs2_get_parent(struct dentry *child)
130{ 130{
131 return d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1)); 131 return d_obtain_alias(gfs2_lookupi(d_inode(child), &gfs2_qdotdot, 1));
132} 132}
133 133
134static struct dentry *gfs2_get_dentry(struct super_block *sb, 134static struct dentry *gfs2_get_dentry(struct super_block *sb,
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 73c72253faac..e301850255d1 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -295,7 +295,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
295 295
296 if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) || 296 if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) ||
297 (name->len == 2 && memcmp(name->name, "..", 2) == 0 && 297 (name->len == 2 && memcmp(name->name, "..", 2) == 0 &&
298 dir == sb->s_root->d_inode)) { 298 dir == d_inode(sb->s_root))) {
299 igrab(dir); 299 igrab(dir);
300 return dir; 300 return dir;
301 } 301 }
@@ -687,7 +687,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
687 } 687 }
688 gfs2_set_inode_flags(inode); 688 gfs2_set_inode_flags(inode);
689 689
690 if ((GFS2_I(sdp->sd_root_dir->d_inode) == dip) || 690 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) ||
691 (dip->i_diskflags & GFS2_DIF_TOPDIR)) 691 (dip->i_diskflags & GFS2_DIF_TOPDIR))
692 aflags |= GFS2_AF_ORLOV; 692 aflags |= GFS2_AF_ORLOV;
693 693
@@ -888,7 +888,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
888{ 888{
889 struct gfs2_inode *dip = GFS2_I(dir); 889 struct gfs2_inode *dip = GFS2_I(dir);
890 struct gfs2_sbd *sdp = GFS2_SB(dir); 890 struct gfs2_sbd *sdp = GFS2_SB(dir);
891 struct inode *inode = old_dentry->d_inode; 891 struct inode *inode = d_inode(old_dentry);
892 struct gfs2_inode *ip = GFS2_I(inode); 892 struct gfs2_inode *ip = GFS2_I(inode);
893 struct gfs2_holder ghs[2]; 893 struct gfs2_holder ghs[2];
894 struct buffer_head *dibh; 894 struct buffer_head *dibh;
@@ -1055,7 +1055,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1055static int gfs2_unlink_inode(struct gfs2_inode *dip, 1055static int gfs2_unlink_inode(struct gfs2_inode *dip,
1056 const struct dentry *dentry) 1056 const struct dentry *dentry)
1057{ 1057{
1058 struct inode *inode = dentry->d_inode; 1058 struct inode *inode = d_inode(dentry);
1059 struct gfs2_inode *ip = GFS2_I(inode); 1059 struct gfs2_inode *ip = GFS2_I(inode);
1060 int error; 1060 int error;
1061 1061
@@ -1091,7 +1091,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
1091{ 1091{
1092 struct gfs2_inode *dip = GFS2_I(dir); 1092 struct gfs2_inode *dip = GFS2_I(dir);
1093 struct gfs2_sbd *sdp = GFS2_SB(dir); 1093 struct gfs2_sbd *sdp = GFS2_SB(dir);
1094 struct inode *inode = dentry->d_inode; 1094 struct inode *inode = d_inode(dentry);
1095 struct gfs2_inode *ip = GFS2_I(inode); 1095 struct gfs2_inode *ip = GFS2_I(inode);
1096 struct gfs2_holder ghs[3]; 1096 struct gfs2_holder ghs[3];
1097 struct gfs2_rgrpd *rgd; 1097 struct gfs2_rgrpd *rgd;
@@ -1241,7 +1241,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
1241 return PTR_ERR(d); 1241 return PTR_ERR(d);
1242 if (d != NULL) 1242 if (d != NULL)
1243 dentry = d; 1243 dentry = d;
1244 if (dentry->d_inode) { 1244 if (d_really_is_positive(dentry)) {
1245 if (!(*opened & FILE_OPENED)) 1245 if (!(*opened & FILE_OPENED))
1246 return finish_no_open(file, d); 1246 return finish_no_open(file, d);
1247 dput(d); 1247 dput(d);
@@ -1282,7 +1282,7 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
1282 error = -EINVAL; 1282 error = -EINVAL;
1283 break; 1283 break;
1284 } 1284 }
1285 if (dir == sb->s_root->d_inode) { 1285 if (dir == d_inode(sb->s_root)) {
1286 error = 0; 1286 error = 0;
1287 break; 1287 break;
1288 } 1288 }
@@ -1321,7 +1321,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1321{ 1321{
1322 struct gfs2_inode *odip = GFS2_I(odir); 1322 struct gfs2_inode *odip = GFS2_I(odir);
1323 struct gfs2_inode *ndip = GFS2_I(ndir); 1323 struct gfs2_inode *ndip = GFS2_I(ndir);
1324 struct gfs2_inode *ip = GFS2_I(odentry->d_inode); 1324 struct gfs2_inode *ip = GFS2_I(d_inode(odentry));
1325 struct gfs2_inode *nip = NULL; 1325 struct gfs2_inode *nip = NULL;
1326 struct gfs2_sbd *sdp = GFS2_SB(odir); 1326 struct gfs2_sbd *sdp = GFS2_SB(odir);
1327 struct gfs2_holder ghs[5], r_gh = { .gh_gl = NULL, }; 1327 struct gfs2_holder ghs[5], r_gh = { .gh_gl = NULL, };
@@ -1332,8 +1332,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1332 unsigned int x; 1332 unsigned int x;
1333 int error; 1333 int error;
1334 1334
1335 if (ndentry->d_inode) { 1335 if (d_really_is_positive(ndentry)) {
1336 nip = GFS2_I(ndentry->d_inode); 1336 nip = GFS2_I(d_inode(ndentry));
1337 if (ip == nip) 1337 if (ip == nip)
1338 return 0; 1338 return 0;
1339 } 1339 }
@@ -1457,7 +1457,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1457 /* Check out the dir to be renamed */ 1457 /* Check out the dir to be renamed */
1458 1458
1459 if (dir_rename) { 1459 if (dir_rename) {
1460 error = gfs2_permission(odentry->d_inode, MAY_WRITE); 1460 error = gfs2_permission(d_inode(odentry), MAY_WRITE);
1461 if (error) 1461 if (error)
1462 goto out_gunlock; 1462 goto out_gunlock;
1463 } 1463 }
@@ -1550,7 +1550,7 @@ out:
1550 1550
1551static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) 1551static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
1552{ 1552{
1553 struct gfs2_inode *ip = GFS2_I(dentry->d_inode); 1553 struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
1554 struct gfs2_holder i_gh; 1554 struct gfs2_holder i_gh;
1555 struct buffer_head *dibh; 1555 struct buffer_head *dibh;
1556 unsigned int size; 1556 unsigned int size;
@@ -1740,7 +1740,7 @@ out:
1740 1740
1741static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) 1741static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1742{ 1742{
1743 struct inode *inode = dentry->d_inode; 1743 struct inode *inode = d_inode(dentry);
1744 struct gfs2_inode *ip = GFS2_I(inode); 1744 struct gfs2_inode *ip = GFS2_I(inode);
1745 struct gfs2_holder i_gh; 1745 struct gfs2_holder i_gh;
1746 int error; 1746 int error;
@@ -1796,7 +1796,7 @@ out:
1796static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, 1796static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1797 struct kstat *stat) 1797 struct kstat *stat)
1798{ 1798{
1799 struct inode *inode = dentry->d_inode; 1799 struct inode *inode = d_inode(dentry);
1800 struct gfs2_inode *ip = GFS2_I(inode); 1800 struct gfs2_inode *ip = GFS2_I(inode);
1801 struct gfs2_holder gh; 1801 struct gfs2_holder gh;
1802 int error; 1802 int error;
@@ -1819,7 +1819,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1819static int gfs2_setxattr(struct dentry *dentry, const char *name, 1819static int gfs2_setxattr(struct dentry *dentry, const char *name,
1820 const void *data, size_t size, int flags) 1820 const void *data, size_t size, int flags)
1821{ 1821{
1822 struct inode *inode = dentry->d_inode; 1822 struct inode *inode = d_inode(dentry);
1823 struct gfs2_inode *ip = GFS2_I(inode); 1823 struct gfs2_inode *ip = GFS2_I(inode);
1824 struct gfs2_holder gh; 1824 struct gfs2_holder gh;
1825 int ret; 1825 int ret;
@@ -1839,7 +1839,7 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
1839static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, 1839static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1840 void *data, size_t size) 1840 void *data, size_t size)
1841{ 1841{
1842 struct inode *inode = dentry->d_inode; 1842 struct inode *inode = d_inode(dentry);
1843 struct gfs2_inode *ip = GFS2_I(inode); 1843 struct gfs2_inode *ip = GFS2_I(inode);
1844 struct gfs2_holder gh; 1844 struct gfs2_holder gh;
1845 int ret; 1845 int ret;
@@ -1860,7 +1860,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1860 1860
1861static int gfs2_removexattr(struct dentry *dentry, const char *name) 1861static int gfs2_removexattr(struct dentry *dentry, const char *name)
1862{ 1862{
1863 struct inode *inode = dentry->d_inode; 1863 struct inode *inode = d_inode(dentry);
1864 struct gfs2_inode *ip = GFS2_I(inode); 1864 struct gfs2_inode *ip = GFS2_I(inode);
1865 struct gfs2_holder gh; 1865 struct gfs2_holder gh;
1866 int ret; 1866 int ret;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index efc8e254787c..35b49f44c72f 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -647,7 +647,7 @@ out_unlock:
647 647
648static int init_journal(struct gfs2_sbd *sdp, int undo) 648static int init_journal(struct gfs2_sbd *sdp, int undo)
649{ 649{
650 struct inode *master = sdp->sd_master_dir->d_inode; 650 struct inode *master = d_inode(sdp->sd_master_dir);
651 struct gfs2_holder ji_gh; 651 struct gfs2_holder ji_gh;
652 struct gfs2_inode *ip; 652 struct gfs2_inode *ip;
653 int jindex = 1; 653 int jindex = 1;
@@ -782,7 +782,7 @@ static struct lock_class_key gfs2_quota_imutex_key;
782static int init_inodes(struct gfs2_sbd *sdp, int undo) 782static int init_inodes(struct gfs2_sbd *sdp, int undo)
783{ 783{
784 int error = 0; 784 int error = 0;
785 struct inode *master = sdp->sd_master_dir->d_inode; 785 struct inode *master = d_inode(sdp->sd_master_dir);
786 786
787 if (undo) 787 if (undo)
788 goto fail_qinode; 788 goto fail_qinode;
@@ -848,7 +848,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
848 char buf[30]; 848 char buf[30];
849 int error = 0; 849 int error = 0;
850 struct gfs2_inode *ip; 850 struct gfs2_inode *ip;
851 struct inode *master = sdp->sd_master_dir->d_inode; 851 struct inode *master = d_inode(sdp->sd_master_dir);
852 852
853 if (sdp->sd_args.ar_spectator) 853 if (sdp->sd_args.ar_spectator)
854 return 0; 854 return 0;
@@ -1357,7 +1357,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
1357 return ERR_PTR(error); 1357 return ERR_PTR(error);
1358 } 1358 }
1359 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, 1359 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
1360 path.dentry->d_inode->i_sb->s_bdev); 1360 d_inode(path.dentry)->i_sb->s_bdev);
1361 path_put(&path); 1361 path_put(&path);
1362 if (IS_ERR(s)) { 1362 if (IS_ERR(s)) {
1363 pr_warn("gfs2 mount does not exist\n"); 1363 pr_warn("gfs2 mount does not exist\n");
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 1666382b198d..859c6edbf81a 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1171,7 +1171,7 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s
1171 1171
1172static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf) 1172static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
1173{ 1173{
1174 struct super_block *sb = dentry->d_inode->i_sb; 1174 struct super_block *sb = d_inode(dentry)->i_sb;
1175 struct gfs2_sbd *sdp = sb->s_fs_info; 1175 struct gfs2_sbd *sdp = sb->s_fs_info;
1176 struct gfs2_statfs_change_host sc; 1176 struct gfs2_statfs_change_host sc;
1177 int error; 1177 int error;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 0b81f783f787..40a8e53b2293 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -420,7 +420,7 @@ static int ea_list_i(struct gfs2_inode *ip, struct buffer_head *bh,
420 420
421ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) 421ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
422{ 422{
423 struct gfs2_inode *ip = GFS2_I(dentry->d_inode); 423 struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
424 struct gfs2_ea_request er; 424 struct gfs2_ea_request er;
425 struct gfs2_holder i_gh; 425 struct gfs2_holder i_gh;
426 int error; 426 int error;
@@ -586,7 +586,7 @@ out:
586static int gfs2_xattr_get(struct dentry *dentry, const char *name, 586static int gfs2_xattr_get(struct dentry *dentry, const char *name,
587 void *buffer, size_t size, int type) 587 void *buffer, size_t size, int type)
588{ 588{
589 struct gfs2_inode *ip = GFS2_I(dentry->d_inode); 589 struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
590 struct gfs2_ea_location el; 590 struct gfs2_ea_location el;
591 int error; 591 int error;
592 592
@@ -1230,7 +1230,7 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
1230static int gfs2_xattr_set(struct dentry *dentry, const char *name, 1230static int gfs2_xattr_set(struct dentry *dentry, const char *name,
1231 const void *value, size_t size, int flags, int type) 1231 const void *value, size_t size, int flags, int type)
1232{ 1232{
1233 return __gfs2_xattr_set(dentry->d_inode, name, value, 1233 return __gfs2_xattr_set(d_inode(dentry), name, value,
1234 size, flags, type); 1234 size, flags, type);
1235} 1235}
1236 1236
diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c
index e057ec542a6a..8d931b157bbe 100644
--- a/fs/hfs/attr.c
+++ b/fs/hfs/attr.c
@@ -16,7 +16,7 @@
16int hfs_setxattr(struct dentry *dentry, const char *name, 16int hfs_setxattr(struct dentry *dentry, const char *name,
17 const void *value, size_t size, int flags) 17 const void *value, size_t size, int flags)
18{ 18{
19 struct inode *inode = dentry->d_inode; 19 struct inode *inode = d_inode(dentry);
20 struct hfs_find_data fd; 20 struct hfs_find_data fd;
21 hfs_cat_rec rec; 21 hfs_cat_rec rec;
22 struct hfs_cat_file *file; 22 struct hfs_cat_file *file;
@@ -59,7 +59,7 @@ out:
59ssize_t hfs_getxattr(struct dentry *dentry, const char *name, 59ssize_t hfs_getxattr(struct dentry *dentry, const char *name,
60 void *value, size_t size) 60 void *value, size_t size)
61{ 61{
62 struct inode *inode = dentry->d_inode; 62 struct inode *inode = d_inode(dentry);
63 struct hfs_find_data fd; 63 struct hfs_find_data fd;
64 hfs_cat_rec rec; 64 hfs_cat_rec rec;
65 struct hfs_cat_file *file; 65 struct hfs_cat_file *file;
@@ -105,7 +105,7 @@ out:
105 105
106ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size) 106ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
107{ 107{
108 struct inode *inode = dentry->d_inode; 108 struct inode *inode = d_inode(dentry);
109 109
110 if (!S_ISREG(inode->i_mode) || HFS_IS_RSRC(inode)) 110 if (!S_ISREG(inode->i_mode) || HFS_IS_RSRC(inode))
111 return -EOPNOTSUPP; 111 return -EOPNOTSUPP;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 145566851e7a..eb2bbca945c5 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -253,7 +253,7 @@ static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
253 */ 253 */
254static int hfs_remove(struct inode *dir, struct dentry *dentry) 254static int hfs_remove(struct inode *dir, struct dentry *dentry)
255{ 255{
256 struct inode *inode = dentry->d_inode; 256 struct inode *inode = d_inode(dentry);
257 int res; 257 int res;
258 258
259 if (S_ISDIR(inode->i_mode) && inode->i_size != 2) 259 if (S_ISDIR(inode->i_mode) && inode->i_size != 2)
@@ -285,18 +285,18 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
285 int res; 285 int res;
286 286
287 /* Unlink destination if it already exists */ 287 /* Unlink destination if it already exists */
288 if (new_dentry->d_inode) { 288 if (d_really_is_positive(new_dentry)) {
289 res = hfs_remove(new_dir, new_dentry); 289 res = hfs_remove(new_dir, new_dentry);
290 if (res) 290 if (res)
291 return res; 291 return res;
292 } 292 }
293 293
294 res = hfs_cat_move(old_dentry->d_inode->i_ino, 294 res = hfs_cat_move(d_inode(old_dentry)->i_ino,
295 old_dir, &old_dentry->d_name, 295 old_dir, &old_dentry->d_name,
296 new_dir, &new_dentry->d_name); 296 new_dir, &new_dentry->d_name);
297 if (!res) 297 if (!res)
298 hfs_cat_build_key(old_dir->i_sb, 298 hfs_cat_build_key(old_dir->i_sb,
299 (btree_key *)&HFS_I(old_dentry->d_inode)->cat_key, 299 (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key,
300 new_dir->i_ino, &new_dentry->d_name); 300 new_dir->i_ino, &new_dentry->d_name);
301 return res; 301 return res;
302} 302}
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 75fd5d873c19..b99ebddb10cb 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -600,7 +600,7 @@ static int hfs_file_release(struct inode *inode, struct file *file)
600 600
601int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) 601int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
602{ 602{
603 struct inode *inode = dentry->d_inode; 603 struct inode *inode = d_inode(dentry);
604 struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); 604 struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
605 int error; 605 int error;
606 606
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c
index 91b91fd3a901..2875961fdc10 100644
--- a/fs/hfs/sysdep.c
+++ b/fs/hfs/sysdep.c
@@ -21,7 +21,7 @@ static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags)
21 if (flags & LOOKUP_RCU) 21 if (flags & LOOKUP_RCU)
22 return -ECHILD; 22 return -ECHILD;
23 23
24 inode = dentry->d_inode; 24 inode = d_inode(dentry);
25 if(!inode) 25 if(!inode)
26 return 1; 26 return 1;
27 27
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index f0235c1640af..e7ef1c72ef3d 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -81,7 +81,7 @@ again:
81 HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)-> 81 HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->
82 create_date || 82 create_date ||
83 entry.file.create_date == 83 entry.file.create_date ==
84 HFSPLUS_I(sb->s_root->d_inode)-> 84 HFSPLUS_I(d_inode(sb->s_root))->
85 create_date) && 85 create_date) &&
86 HFSPLUS_SB(sb)->hidden_dir) { 86 HFSPLUS_SB(sb)->hidden_dir) {
87 struct qstr str; 87 struct qstr str;
@@ -296,8 +296,8 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
296 struct dentry *dst_dentry) 296 struct dentry *dst_dentry)
297{ 297{
298 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb); 298 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb);
299 struct inode *inode = src_dentry->d_inode; 299 struct inode *inode = d_inode(src_dentry);
300 struct inode *src_dir = src_dentry->d_parent->d_inode; 300 struct inode *src_dir = d_inode(src_dentry->d_parent);
301 struct qstr str; 301 struct qstr str;
302 char name[32]; 302 char name[32];
303 u32 cnid, id; 303 u32 cnid, id;
@@ -353,7 +353,7 @@ out:
353static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) 353static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
354{ 354{
355 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); 355 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
356 struct inode *inode = dentry->d_inode; 356 struct inode *inode = d_inode(dentry);
357 struct qstr str; 357 struct qstr str;
358 char name[32]; 358 char name[32];
359 u32 cnid; 359 u32 cnid;
@@ -410,7 +410,7 @@ out:
410static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) 410static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
411{ 411{
412 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); 412 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
413 struct inode *inode = dentry->d_inode; 413 struct inode *inode = d_inode(dentry);
414 int res; 414 int res;
415 415
416 if (inode->i_size != 2) 416 if (inode->i_size != 2)
@@ -529,7 +529,7 @@ static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry,
529 int res; 529 int res;
530 530
531 /* Unlink destination if it already exists */ 531 /* Unlink destination if it already exists */
532 if (new_dentry->d_inode) { 532 if (d_really_is_positive(new_dentry)) {
533 if (d_is_dir(new_dentry)) 533 if (d_is_dir(new_dentry))
534 res = hfsplus_rmdir(new_dir, new_dentry); 534 res = hfsplus_rmdir(new_dir, new_dentry);
535 else 535 else
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index a43811f90935..8ad4c594898b 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -243,7 +243,7 @@ static int hfsplus_file_release(struct inode *inode, struct file *file)
243 243
244static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) 244static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
245{ 245{
246 struct inode *inode = dentry->d_inode; 246 struct inode *inode = d_inode(dentry);
247 int error; 247 int error;
248 248
249 error = inode_change_ok(inode, attr); 249 error = inode_change_ok(inode, attr);
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index d3ff5cc317d7..ac807073c453 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -26,7 +26,7 @@
26static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags) 26static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
27{ 27{
28 struct dentry *dentry = file->f_path.dentry; 28 struct dentry *dentry = file->f_path.dentry;
29 struct inode *inode = dentry->d_inode; 29 struct inode *inode = d_inode(dentry);
30 struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); 30 struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
31 struct hfsplus_vh *vh = sbi->s_vhdr; 31 struct hfsplus_vh *vh = sbi->s_vhdr;
32 struct hfsplus_vh *bvh = sbi->s_backup_vhdr; 32 struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index d98094a9f476..964d922f647e 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -574,7 +574,7 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry,
574 char *buffer, size_t size) 574 char *buffer, size_t size)
575{ 575{
576 ssize_t res = 0; 576 ssize_t res = 0;
577 struct inode *inode = dentry->d_inode; 577 struct inode *inode = d_inode(dentry);
578 struct hfs_find_data fd; 578 struct hfs_find_data fd;
579 u16 entry_type; 579 u16 entry_type;
580 u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)]; 580 u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)];
@@ -642,7 +642,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
642{ 642{
643 ssize_t err; 643 ssize_t err;
644 ssize_t res = 0; 644 ssize_t res = 0;
645 struct inode *inode = dentry->d_inode; 645 struct inode *inode = d_inode(dentry);
646 struct hfs_find_data fd; 646 struct hfs_find_data fd;
647 u16 key_len = 0; 647 u16 key_len = 0;
648 struct hfsplus_attr_key attr_key; 648 struct hfsplus_attr_key attr_key;
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index 288530cf80b5..a1629cfe37d3 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -24,7 +24,7 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
24static inline int hfsplus_setxattr(struct dentry *dentry, const char *name, 24static inline int hfsplus_setxattr(struct dentry *dentry, const char *name,
25 const void *value, size_t size, int flags) 25 const void *value, size_t size, int flags)
26{ 26{
27 return __hfsplus_setxattr(dentry->d_inode, name, value, size, flags); 27 return __hfsplus_setxattr(d_inode(dentry), name, value, size, flags);
28} 28}
29 29
30ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, 30ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
@@ -35,7 +35,7 @@ static inline ssize_t hfsplus_getxattr(struct dentry *dentry,
35 void *value, 35 void *value,
36 size_t size) 36 size_t size)
37{ 37{
38 return __hfsplus_getxattr(dentry->d_inode, name, value, size); 38 return __hfsplus_getxattr(d_inode(dentry), name, value, size);
39} 39}
40 40
41ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); 41ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e021188ca110..b827aa4248d4 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -795,7 +795,7 @@ static int hostfs_permission(struct inode *ino, int desired)
795 795
796static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) 796static int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
797{ 797{
798 struct inode *inode = dentry->d_inode; 798 struct inode *inode = d_inode(dentry);
799 struct hostfs_iattr attrs; 799 struct hostfs_iattr attrs;
800 char *name; 800 char *name;
801 int err; 801 int err;
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 7ce4b74234a1..933c73780813 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -257,7 +257,7 @@ void hpfs_write_inode_nolock(struct inode *i)
257 257
258int hpfs_setattr(struct dentry *dentry, struct iattr *attr) 258int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
259{ 259{
260 struct inode *inode = dentry->d_inode; 260 struct inode *inode = d_inode(dentry);
261 int error = -EINVAL; 261 int error = -EINVAL;
262 262
263 hpfs_lock(inode->i_sb); 263 hpfs_lock(inode->i_sb);
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index bdbc2c3080a4..a0872f239f04 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -359,7 +359,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
359 unsigned len = dentry->d_name.len; 359 unsigned len = dentry->d_name.len;
360 struct quad_buffer_head qbh; 360 struct quad_buffer_head qbh;
361 struct hpfs_dirent *de; 361 struct hpfs_dirent *de;
362 struct inode *inode = dentry->d_inode; 362 struct inode *inode = d_inode(dentry);
363 dnode_secno dno; 363 dnode_secno dno;
364 int r; 364 int r;
365 int rep = 0; 365 int rep = 0;
@@ -433,7 +433,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
433 unsigned len = dentry->d_name.len; 433 unsigned len = dentry->d_name.len;
434 struct quad_buffer_head qbh; 434 struct quad_buffer_head qbh;
435 struct hpfs_dirent *de; 435 struct hpfs_dirent *de;
436 struct inode *inode = dentry->d_inode; 436 struct inode *inode = d_inode(dentry);
437 dnode_secno dno; 437 dnode_secno dno;
438 int n_items = 0; 438 int n_items = 0;
439 int err; 439 int err;
@@ -522,8 +522,8 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
522 unsigned old_len = old_dentry->d_name.len; 522 unsigned old_len = old_dentry->d_name.len;
523 const unsigned char *new_name = new_dentry->d_name.name; 523 const unsigned char *new_name = new_dentry->d_name.name;
524 unsigned new_len = new_dentry->d_name.len; 524 unsigned new_len = new_dentry->d_name.len;
525 struct inode *i = old_dentry->d_inode; 525 struct inode *i = d_inode(old_dentry);
526 struct inode *new_inode = new_dentry->d_inode; 526 struct inode *new_inode = d_inode(new_dentry);
527 struct quad_buffer_head qbh, qbh1; 527 struct quad_buffer_head qbh, qbh1;
528 struct hpfs_dirent *dep, *nde; 528 struct hpfs_dirent *dep, *nde;
529 struct hpfs_dirent de; 529 struct hpfs_dirent de;
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 043ac9d77262..fa2bd5366ecf 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -153,9 +153,9 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
153 return ERR_PTR(-ENOENT); 153 return ERR_PTR(-ENOENT);
154 154
155 parent = HPPFS_I(ino)->proc_dentry; 155 parent = HPPFS_I(ino)->proc_dentry;
156 mutex_lock(&parent->d_inode->i_mutex); 156 mutex_lock(&d_inode(parent)->i_mutex);
157 proc_dentry = lookup_one_len(name->name, parent, name->len); 157 proc_dentry = lookup_one_len(name->name, parent, name->len);
158 mutex_unlock(&parent->d_inode->i_mutex); 158 mutex_unlock(&d_inode(parent)->i_mutex);
159 159
160 if (IS_ERR(proc_dentry)) 160 if (IS_ERR(proc_dentry))
161 return proc_dentry; 161 return proc_dentry;
@@ -637,25 +637,25 @@ static const struct super_operations hppfs_sbops = {
637static int hppfs_readlink(struct dentry *dentry, char __user *buffer, 637static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
638 int buflen) 638 int buflen)
639{ 639{
640 struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 640 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry;
641 return proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, 641 return d_inode(proc_dentry)->i_op->readlink(proc_dentry, buffer,
642 buflen); 642 buflen);
643} 643}
644 644
645static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) 645static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
646{ 646{
647 struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 647 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry;
648 648
649 return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd); 649 return d_inode(proc_dentry)->i_op->follow_link(proc_dentry, nd);
650} 650}
651 651
652static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd, 652static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd,
653 void *cookie) 653 void *cookie)
654{ 654{
655 struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 655 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry;
656 656
657 if (proc_dentry->d_inode->i_op->put_link) 657 if (d_inode(proc_dentry)->i_op->put_link)
658 proc_dentry->d_inode->i_op->put_link(proc_dentry, nd, cookie); 658 d_inode(proc_dentry)->i_op->put_link(proc_dentry, nd, cookie);
659} 659}
660 660
661static const struct inode_operations hppfs_dir_iops = { 661static const struct inode_operations hppfs_dir_iops = {
@@ -670,7 +670,7 @@ static const struct inode_operations hppfs_link_iops = {
670 670
671static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) 671static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
672{ 672{
673 struct inode *proc_ino = dentry->d_inode; 673 struct inode *proc_ino = d_inode(dentry);
674 struct inode *inode = new_inode(sb); 674 struct inode *inode = new_inode(sb);
675 675
676 if (!inode) { 676 if (!inode) {
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 8c2dad629e7c..7a20dbfd1e38 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -391,7 +391,7 @@ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
391 391
392static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) 392static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
393{ 393{
394 struct inode *inode = dentry->d_inode; 394 struct inode *inode = d_inode(dentry);
395 struct hstate *h = hstate_inode(inode); 395 struct hstate *h = hstate_inode(inode);
396 int error; 396 int error;
397 unsigned int ia_valid = attr->ia_valid; 397 unsigned int ia_valid = attr->ia_valid;
@@ -585,7 +585,7 @@ static int hugetlbfs_migrate_page(struct address_space *mapping,
585static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) 585static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
586{ 586{
587 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); 587 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb);
588 struct hstate *h = hstate_inode(dentry->d_inode); 588 struct hstate *h = hstate_inode(d_inode(dentry));
589 589
590 buf->f_type = HUGETLBFS_MAGIC; 590 buf->f_type = HUGETLBFS_MAGIC;
591 buf->f_bsize = huge_page_size(h); 591 buf->f_bsize = huge_page_size(h);
diff --git a/fs/isofs/export.c b/fs/isofs/export.c
index 12088d8de3fa..0c5f721b4e91 100644
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -44,7 +44,7 @@ static struct dentry *isofs_export_get_parent(struct dentry *child)
44{ 44{
45 unsigned long parent_block = 0; 45 unsigned long parent_block = 0;
46 unsigned long parent_offset = 0; 46 unsigned long parent_offset = 0;
47 struct inode *child_inode = child->d_inode; 47 struct inode *child_inode = d_inode(child);
48 struct iso_inode_info *e_child_inode = ISOFS_I(child_inode); 48 struct iso_inode_info *e_child_inode = ISOFS_I(child_inode);
49 struct iso_directory_record *de = NULL; 49 struct iso_directory_record *de = NULL;
50 struct buffer_head * bh = NULL; 50 struct buffer_head * bh = NULL;
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index f21b6fb5e4c4..1ba5c97943b8 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -224,14 +224,14 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
224{ 224{
225 struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); 225 struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
226 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 226 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
227 struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(dentry->d_inode); 227 struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode(dentry));
228 int ret; 228 int ret;
229 uint32_t now = get_seconds(); 229 uint32_t now = get_seconds();
230 230
231 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, 231 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
232 dentry->d_name.len, dead_f, now); 232 dentry->d_name.len, dead_f, now);
233 if (dead_f->inocache) 233 if (dead_f->inocache)
234 set_nlink(dentry->d_inode, dead_f->inocache->pino_nlink); 234 set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink);
235 if (!ret) 235 if (!ret)
236 dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 236 dir_i->i_mtime = dir_i->i_ctime = ITIME(now);
237 return ret; 237 return ret;
@@ -241,8 +241,8 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
241 241
242static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry) 242static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry)
243{ 243{
244 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dentry->d_inode->i_sb); 244 struct jffs2_sb_info *c = JFFS2_SB_INFO(d_inode(old_dentry)->i_sb);
245 struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); 245 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry));
246 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 246 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
247 int ret; 247 int ret;
248 uint8_t type; 248 uint8_t type;
@@ -256,7 +256,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
256 return -EPERM; 256 return -EPERM;
257 257
258 /* XXX: This is ugly */ 258 /* XXX: This is ugly */
259 type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12; 259 type = (d_inode(old_dentry)->i_mode & S_IFMT) >> 12;
260 if (!type) type = DT_REG; 260 if (!type) type = DT_REG;
261 261
262 now = get_seconds(); 262 now = get_seconds();
@@ -264,11 +264,11 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
264 264
265 if (!ret) { 265 if (!ret) {
266 mutex_lock(&f->sem); 266 mutex_lock(&f->sem);
267 set_nlink(old_dentry->d_inode, ++f->inocache->pino_nlink); 267 set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink);
268 mutex_unlock(&f->sem); 268 mutex_unlock(&f->sem);
269 d_instantiate(dentry, old_dentry->d_inode); 269 d_instantiate(dentry, d_inode(old_dentry));
270 dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 270 dir_i->i_mtime = dir_i->i_ctime = ITIME(now);
271 ihold(old_dentry->d_inode); 271 ihold(d_inode(old_dentry));
272 } 272 }
273 return ret; 273 return ret;
274} 274}
@@ -585,7 +585,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
585{ 585{
586 struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); 586 struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
587 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 587 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
588 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); 588 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry));
589 struct jffs2_full_dirent *fd; 589 struct jffs2_full_dirent *fd;
590 int ret; 590 int ret;
591 uint32_t now = get_seconds(); 591 uint32_t now = get_seconds();
@@ -599,7 +599,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
599 dentry->d_name.len, f, now); 599 dentry->d_name.len, f, now);
600 if (!ret) { 600 if (!ret) {
601 dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 601 dir_i->i_mtime = dir_i->i_ctime = ITIME(now);
602 clear_nlink(dentry->d_inode); 602 clear_nlink(d_inode(dentry));
603 drop_nlink(dir_i); 603 drop_nlink(dir_i);
604 } 604 }
605 return ret; 605 return ret;
@@ -770,8 +770,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
770 * the VFS can't check whether the victim is empty. The filesystem 770 * the VFS can't check whether the victim is empty. The filesystem
771 * needs to do that for itself. 771 * needs to do that for itself.
772 */ 772 */
773 if (new_dentry->d_inode) { 773 if (d_really_is_positive(new_dentry)) {
774 victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); 774 victim_f = JFFS2_INODE_INFO(d_inode(new_dentry));
775 if (d_is_dir(new_dentry)) { 775 if (d_is_dir(new_dentry)) {
776 struct jffs2_full_dirent *fd; 776 struct jffs2_full_dirent *fd;
777 777
@@ -794,12 +794,12 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
794 /* Make a hard link */ 794 /* Make a hard link */
795 795
796 /* XXX: This is ugly */ 796 /* XXX: This is ugly */
797 type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12; 797 type = (d_inode(old_dentry)->i_mode & S_IFMT) >> 12;
798 if (!type) type = DT_REG; 798 if (!type) type = DT_REG;
799 799
800 now = get_seconds(); 800 now = get_seconds();
801 ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), 801 ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i),
802 old_dentry->d_inode->i_ino, type, 802 d_inode(old_dentry)->i_ino, type,
803 new_dentry->d_name.name, new_dentry->d_name.len, now); 803 new_dentry->d_name.name, new_dentry->d_name.len, now);
804 804
805 if (ret) 805 if (ret)
@@ -808,9 +808,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
808 if (victim_f) { 808 if (victim_f) {
809 /* There was a victim. Kill it off nicely */ 809 /* There was a victim. Kill it off nicely */
810 if (d_is_dir(new_dentry)) 810 if (d_is_dir(new_dentry))
811 clear_nlink(new_dentry->d_inode); 811 clear_nlink(d_inode(new_dentry));
812 else 812 else
813 drop_nlink(new_dentry->d_inode); 813 drop_nlink(d_inode(new_dentry));
814 /* Don't oops if the victim was a dirent pointing to an 814 /* Don't oops if the victim was a dirent pointing to an
815 inode which didn't exist. */ 815 inode which didn't exist. */
816 if (victim_f->inocache) { 816 if (victim_f->inocache) {
@@ -836,9 +836,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
836 836
837 if (ret) { 837 if (ret) {
838 /* Oh shit. We really ought to make a single node which can do both atomically */ 838 /* Oh shit. We really ought to make a single node which can do both atomically */
839 struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); 839 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry));
840 mutex_lock(&f->sem); 840 mutex_lock(&f->sem);
841 inc_nlink(old_dentry->d_inode); 841 inc_nlink(d_inode(old_dentry));
842 if (f->inocache && !d_is_dir(old_dentry)) 842 if (f->inocache && !d_is_dir(old_dentry))
843 f->inocache->pino_nlink++; 843 f->inocache->pino_nlink++;
844 mutex_unlock(&f->sem); 844 mutex_unlock(&f->sem);
@@ -846,8 +846,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
846 pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n", 846 pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n",
847 __func__, ret); 847 __func__, ret);
848 /* Might as well let the VFS know */ 848 /* Might as well let the VFS know */
849 d_instantiate(new_dentry, old_dentry->d_inode); 849 d_instantiate(new_dentry, d_inode(old_dentry));
850 ihold(old_dentry->d_inode); 850 ihold(d_inode(old_dentry));
851 new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); 851 new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now);
852 return ret; 852 return ret;
853 } 853 }
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 601afd1afddf..fe5ea080b4ec 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -190,7 +190,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
190 190
191int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) 191int jffs2_setattr(struct dentry *dentry, struct iattr *iattr)
192{ 192{
193 struct inode *inode = dentry->d_inode; 193 struct inode *inode = d_inode(dentry);
194 int rc; 194 int rc;
195 195
196 rc = inode_change_ok(inode, iattr); 196 rc = inode_change_ok(inode, iattr);
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index aca97f35b292..d4b43fb7adb1 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -54,7 +54,7 @@ static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
54 if (!strcmp(name, "")) 54 if (!strcmp(name, ""))
55 return -EINVAL; 55 return -EINVAL;
56 56
57 return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, 57 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY,
58 name, buffer, size); 58 name, buffer, size);
59} 59}
60 60
@@ -64,7 +64,7 @@ static int jffs2_security_setxattr(struct dentry *dentry, const char *name,
64 if (!strcmp(name, "")) 64 if (!strcmp(name, ""))
65 return -EINVAL; 65 return -EINVAL;
66 66
67 return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, 67 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY,
68 name, buffer, size, flags); 68 name, buffer, size, flags);
69} 69}
70 70
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 3d76f28a2ba9..d86c5e3176a1 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -140,14 +140,14 @@ static struct dentry *jffs2_get_parent(struct dentry *child)
140 140
141 BUG_ON(!d_is_dir(child)); 141 BUG_ON(!d_is_dir(child));
142 142
143 f = JFFS2_INODE_INFO(child->d_inode); 143 f = JFFS2_INODE_INFO(d_inode(child));
144 144
145 pino = f->inocache->pino_nlink; 145 pino = f->inocache->pino_nlink;
146 146
147 JFFS2_DEBUG("Parent of directory ino #%u is #%u\n", 147 JFFS2_DEBUG("Parent of directory ino #%u is #%u\n",
148 f->inocache->ino, pino); 148 f->inocache->ino, pino);
149 149
150 return d_obtain_alias(jffs2_iget(child->d_inode->i_sb, pino)); 150 return d_obtain_alias(jffs2_iget(d_inode(child)->i_sb, pino));
151} 151}
152 152
153static const struct export_operations jffs2_export_ops = { 153static const struct export_operations jffs2_export_ops = {
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c
index c7c77b0dfccd..1fefa25d0fa5 100644
--- a/fs/jffs2/symlink.c
+++ b/fs/jffs2/symlink.c
@@ -31,7 +31,7 @@ const struct inode_operations jffs2_symlink_inode_operations =
31 31
32static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) 32static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
33{ 33{
34 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); 34 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry));
35 char *p = (char *)f->target; 35 char *p = (char *)f->target;
36 36
37 /* 37 /*
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index d72817ac51f6..c4dd342d13a7 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -960,7 +960,7 @@ static const struct xattr_handler *xprefix_to_handler(int xprefix) {
960 960
961ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size) 961ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
962{ 962{
963 struct inode *inode = dentry->d_inode; 963 struct inode *inode = d_inode(dentry);
964 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 964 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
965 struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); 965 struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
966 struct jffs2_inode_cache *ic = f->inocache; 966 struct jffs2_inode_cache *ic = f->inocache;
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index 1c868194c504..ceaf9c693225 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -21,7 +21,7 @@ static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
21{ 21{
22 if (!strcmp(name, "")) 22 if (!strcmp(name, ""))
23 return -EINVAL; 23 return -EINVAL;
24 return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, 24 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED,
25 name, buffer, size); 25 name, buffer, size);
26} 26}
27 27
@@ -30,7 +30,7 @@ static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name,
30{ 30{
31 if (!strcmp(name, "")) 31 if (!strcmp(name, ""))
32 return -EINVAL; 32 return -EINVAL;
33 return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, 33 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED,
34 name, buffer, size, flags); 34 name, buffer, size, flags);
35} 35}
36 36
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c
index 916b5c966039..a71391eba514 100644
--- a/fs/jffs2/xattr_user.c
+++ b/fs/jffs2/xattr_user.c
@@ -21,7 +21,7 @@ static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
21{ 21{
22 if (!strcmp(name, "")) 22 if (!strcmp(name, ""))
23 return -EINVAL; 23 return -EINVAL;
24 return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_USER, 24 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER,
25 name, buffer, size); 25 name, buffer, size);
26} 26}
27 27
@@ -30,7 +30,7 @@ static int jffs2_user_setxattr(struct dentry *dentry, const char *name,
30{ 30{
31 if (!strcmp(name, "")) 31 if (!strcmp(name, ""))
32 return -EINVAL; 32 return -EINVAL;
33 return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_USER, 33 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER,
34 name, buffer, size, flags); 34 name, buffer, size, flags);
35} 35}
36 36
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index ae46788b9723..e98d39d75cf4 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -100,7 +100,7 @@ static int jfs_release(struct inode *inode, struct file *file)
100 100
101int jfs_setattr(struct dentry *dentry, struct iattr *iattr) 101int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
102{ 102{
103 struct inode *inode = dentry->d_inode; 103 struct inode *inode = d_inode(dentry);
104 int rc; 104 int rc;
105 105
106 rc = inode_change_ok(inode, iattr); 106 rc = inode_change_ok(inode, iattr);
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 38fdc533f4ec..66db7bc0ed10 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -346,7 +346,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
346{ 346{
347 int rc; 347 int rc;
348 tid_t tid; /* transaction id */ 348 tid_t tid; /* transaction id */
349 struct inode *ip = dentry->d_inode; 349 struct inode *ip = d_inode(dentry);
350 ino_t ino; 350 ino_t ino;
351 struct component_name dname; 351 struct component_name dname;
352 struct inode *iplist[2]; 352 struct inode *iplist[2];
@@ -472,7 +472,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
472{ 472{
473 int rc; 473 int rc;
474 tid_t tid; /* transaction id */ 474 tid_t tid; /* transaction id */
475 struct inode *ip = dentry->d_inode; 475 struct inode *ip = d_inode(dentry);
476 ino_t ino; 476 ino_t ino;
477 struct component_name dname; /* object name */ 477 struct component_name dname; /* object name */
478 struct inode *iplist[2]; 478 struct inode *iplist[2];
@@ -791,7 +791,7 @@ static int jfs_link(struct dentry *old_dentry,
791{ 791{
792 int rc; 792 int rc;
793 tid_t tid; 793 tid_t tid;
794 struct inode *ip = old_dentry->d_inode; 794 struct inode *ip = d_inode(old_dentry);
795 ino_t ino; 795 ino_t ino;
796 struct component_name dname; 796 struct component_name dname;
797 struct btstack btstack; 797 struct btstack btstack;
@@ -879,7 +879,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
879 struct component_name dname; 879 struct component_name dname;
880 int ssize; /* source pathname size */ 880 int ssize; /* source pathname size */
881 struct btstack btstack; 881 struct btstack btstack;
882 struct inode *ip = dentry->d_inode; 882 struct inode *ip = d_inode(dentry);
883 unchar *i_fastsymlink; 883 unchar *i_fastsymlink;
884 s64 xlen = 0; 884 s64 xlen = 0;
885 int bmask = 0, xsize; 885 int bmask = 0, xsize;
@@ -1086,8 +1086,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1086 dquot_initialize(old_dir); 1086 dquot_initialize(old_dir);
1087 dquot_initialize(new_dir); 1087 dquot_initialize(new_dir);
1088 1088
1089 old_ip = old_dentry->d_inode; 1089 old_ip = d_inode(old_dentry);
1090 new_ip = new_dentry->d_inode; 1090 new_ip = d_inode(new_dentry);
1091 1091
1092 if ((rc = get_UCSname(&old_dname, old_dentry))) 1092 if ((rc = get_UCSname(&old_dname, old_dentry)))
1093 goto out1; 1093 goto out1;
@@ -1500,9 +1500,9 @@ struct dentry *jfs_get_parent(struct dentry *dentry)
1500 unsigned long parent_ino; 1500 unsigned long parent_ino;
1501 1501
1502 parent_ino = 1502 parent_ino =
1503 le32_to_cpu(JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot); 1503 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot);
1504 1504
1505 return d_obtain_alias(jfs_iget(dentry->d_inode->i_sb, parent_ino)); 1505 return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino));
1506} 1506}
1507 1507
1508const struct inode_operations jfs_dir_inode_operations = { 1508const struct inode_operations jfs_dir_inode_operations = {
@@ -1578,7 +1578,7 @@ static int jfs_ci_revalidate(struct dentry *dentry, unsigned int flags)
1578 * positive dentry isn't good idea. So it's unsupported like 1578 * positive dentry isn't good idea. So it's unsupported like
1579 * rename("filename", "FILENAME") for now. 1579 * rename("filename", "FILENAME") for now.
1580 */ 1580 */
1581 if (dentry->d_inode) 1581 if (d_really_is_positive(dentry))
1582 return 1; 1582 return 1;
1583 1583
1584 /* 1584 /*
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
index 205b946d8e0d..80f42bcc4ef1 100644
--- a/fs/jfs/symlink.c
+++ b/fs/jfs/symlink.c
@@ -24,7 +24,7 @@
24 24
25static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd) 25static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
26{ 26{
27 char *s = JFS_IP(dentry->d_inode)->i_inline; 27 char *s = JFS_IP(d_inode(dentry))->i_inline;
28 nd_set_link(nd, s); 28 nd_set_link(nd, s);
29 return NULL; 29 return NULL;
30} 30}
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 46325d5c34fc..48b15a6e5558 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -849,7 +849,7 @@ int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name,
849int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, 849int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,
850 size_t value_len, int flags) 850 size_t value_len, int flags)
851{ 851{
852 struct inode *inode = dentry->d_inode; 852 struct inode *inode = d_inode(dentry);
853 struct jfs_inode_info *ji = JFS_IP(inode); 853 struct jfs_inode_info *ji = JFS_IP(inode);
854 int rc; 854 int rc;
855 tid_t tid; 855 tid_t tid;
@@ -872,7 +872,7 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,
872 872
873 tid = txBegin(inode->i_sb, 0); 873 tid = txBegin(inode->i_sb, 0);
874 mutex_lock(&ji->commit_mutex); 874 mutex_lock(&ji->commit_mutex);
875 rc = __jfs_setxattr(tid, dentry->d_inode, name, value, value_len, 875 rc = __jfs_setxattr(tid, d_inode(dentry), name, value, value_len,
876 flags); 876 flags);
877 if (!rc) 877 if (!rc)
878 rc = txCommit(tid, 1, &inode, 0); 878 rc = txCommit(tid, 1, &inode, 0);
@@ -959,7 +959,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
959 return -EOPNOTSUPP; 959 return -EOPNOTSUPP;
960 } 960 }
961 961
962 err = __jfs_getxattr(dentry->d_inode, name, data, buf_size); 962 err = __jfs_getxattr(d_inode(dentry), name, data, buf_size);
963 963
964 return err; 964 return err;
965} 965}
@@ -976,7 +976,7 @@ static inline int can_list(struct jfs_ea *ea)
976 976
977ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size) 977ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size)
978{ 978{
979 struct inode *inode = dentry->d_inode; 979 struct inode *inode = d_inode(dentry);
980 char *buffer; 980 char *buffer;
981 ssize_t size = 0; 981 ssize_t size = 0;
982 int xattr_size; 982 int xattr_size;
@@ -1029,7 +1029,7 @@ ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size)
1029 1029
1030int jfs_removexattr(struct dentry *dentry, const char *name) 1030int jfs_removexattr(struct dentry *dentry, const char *name)
1031{ 1031{
1032 struct inode *inode = dentry->d_inode; 1032 struct inode *inode = d_inode(dentry);
1033 struct jfs_inode_info *ji = JFS_IP(inode); 1033 struct jfs_inode_info *ji = JFS_IP(inode);
1034 int rc; 1034 int rc;
1035 tid_t tid; 1035 tid_t tid;
@@ -1047,7 +1047,7 @@ int jfs_removexattr(struct dentry *dentry, const char *name)
1047 1047
1048 tid = txBegin(inode->i_sb, 0); 1048 tid = txBegin(inode->i_sb, 0);
1049 mutex_lock(&ji->commit_mutex); 1049 mutex_lock(&ji->commit_mutex);
1050 rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE); 1050 rc = __jfs_setxattr(tid, d_inode(dentry), name, NULL, 0, XATTR_REPLACE);
1051 if (!rc) 1051 if (!rc)
1052 rc = txCommit(tid, 1, &inode, 0); 1052 rc = txCommit(tid, 1, &inode, 0);
1053 txEnd(tid); 1053 txEnd(tid);
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 6acc9648f986..f131fc23ffc4 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -444,7 +444,7 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
444 return -ECHILD; 444 return -ECHILD;
445 445
446 /* Always perform fresh lookup for negatives */ 446 /* Always perform fresh lookup for negatives */
447 if (!dentry->d_inode) 447 if (d_really_is_negative(dentry))
448 goto out_bad_unlocked; 448 goto out_bad_unlocked;
449 449
450 kn = dentry->d_fsdata; 450 kn = dentry->d_fsdata;
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 9000874a945b..2da8493a380b 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -111,7 +111,7 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
111 111
112int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) 112int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
113{ 113{
114 struct inode *inode = dentry->d_inode; 114 struct inode *inode = d_inode(dentry);
115 struct kernfs_node *kn = dentry->d_fsdata; 115 struct kernfs_node *kn = dentry->d_fsdata;
116 int error; 116 int error;
117 117
@@ -172,11 +172,11 @@ int kernfs_iop_setxattr(struct dentry *dentry, const char *name,
172 172
173 if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) { 173 if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) {
174 const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; 174 const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
175 error = security_inode_setsecurity(dentry->d_inode, suffix, 175 error = security_inode_setsecurity(d_inode(dentry), suffix,
176 value, size, flags); 176 value, size, flags);
177 if (error) 177 if (error)
178 return error; 178 return error;
179 error = security_inode_getsecctx(dentry->d_inode, 179 error = security_inode_getsecctx(d_inode(dentry),
180 &secdata, &secdata_len); 180 &secdata, &secdata_len);
181 if (error) 181 if (error)
182 return error; 182 return error;
@@ -271,7 +271,7 @@ int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
271 struct kstat *stat) 271 struct kstat *stat)
272{ 272{
273 struct kernfs_node *kn = dentry->d_fsdata; 273 struct kernfs_node *kn = dentry->d_fsdata;
274 struct inode *inode = dentry->d_inode; 274 struct inode *inode = d_inode(dentry);
275 275
276 mutex_lock(&kernfs_mutex); 276 mutex_lock(&kernfs_mutex);
277 kernfs_refresh_inode(kn, inode); 277 kernfs_refresh_inode(kn, inode);
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index 6bdc347008f5..4cf38f118549 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -213,7 +213,7 @@ static void abort_transaction(struct inode *inode, struct logfs_transaction *ta)
213static int logfs_unlink(struct inode *dir, struct dentry *dentry) 213static int logfs_unlink(struct inode *dir, struct dentry *dentry)
214{ 214{
215 struct logfs_super *super = logfs_super(dir->i_sb); 215 struct logfs_super *super = logfs_super(dir->i_sb);
216 struct inode *inode = dentry->d_inode; 216 struct inode *inode = d_inode(dentry);
217 struct logfs_transaction *ta; 217 struct logfs_transaction *ta;
218 struct page *page; 218 struct page *page;
219 pgoff_t index; 219 pgoff_t index;
@@ -271,7 +271,7 @@ static inline int logfs_empty_dir(struct inode *dir)
271 271
272static int logfs_rmdir(struct inode *dir, struct dentry *dentry) 272static int logfs_rmdir(struct inode *dir, struct dentry *dentry)
273{ 273{
274 struct inode *inode = dentry->d_inode; 274 struct inode *inode = d_inode(dentry);
275 275
276 if (!logfs_empty_dir(inode)) 276 if (!logfs_empty_dir(inode))
277 return -ENOTEMPTY; 277 return -ENOTEMPTY;
@@ -537,7 +537,7 @@ static int logfs_symlink(struct inode *dir, struct dentry *dentry,
537static int logfs_link(struct dentry *old_dentry, struct inode *dir, 537static int logfs_link(struct dentry *old_dentry, struct inode *dir,
538 struct dentry *dentry) 538 struct dentry *dentry)
539{ 539{
540 struct inode *inode = old_dentry->d_inode; 540 struct inode *inode = d_inode(old_dentry);
541 541
542 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 542 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
543 ihold(inode); 543 ihold(inode);
@@ -607,7 +607,7 @@ static int logfs_rename_cross(struct inode *old_dir, struct dentry *old_dentry,
607 /* 2. write target dd */ 607 /* 2. write target dd */
608 mutex_lock(&super->s_dirop_mutex); 608 mutex_lock(&super->s_dirop_mutex);
609 logfs_add_transaction(new_dir, ta); 609 logfs_add_transaction(new_dir, ta);
610 err = logfs_write_dir(new_dir, new_dentry, old_dentry->d_inode); 610 err = logfs_write_dir(new_dir, new_dentry, d_inode(old_dentry));
611 if (!err) 611 if (!err)
612 err = write_inode(new_dir); 612 err = write_inode(new_dir);
613 613
@@ -658,8 +658,8 @@ static int logfs_rename_target(struct inode *old_dir, struct dentry *old_dentry,
658 struct inode *new_dir, struct dentry *new_dentry) 658 struct inode *new_dir, struct dentry *new_dentry)
659{ 659{
660 struct logfs_super *super = logfs_super(old_dir->i_sb); 660 struct logfs_super *super = logfs_super(old_dir->i_sb);
661 struct inode *old_inode = old_dentry->d_inode; 661 struct inode *old_inode = d_inode(old_dentry);
662 struct inode *new_inode = new_dentry->d_inode; 662 struct inode *new_inode = d_inode(new_dentry);
663 int isdir = S_ISDIR(old_inode->i_mode); 663 int isdir = S_ISDIR(old_inode->i_mode);
664 struct logfs_disk_dentry dd; 664 struct logfs_disk_dentry dd;
665 struct logfs_transaction *ta; 665 struct logfs_transaction *ta;
@@ -719,7 +719,7 @@ out:
719static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, 719static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry,
720 struct inode *new_dir, struct dentry *new_dentry) 720 struct inode *new_dir, struct dentry *new_dentry)
721{ 721{
722 if (new_dentry->d_inode) 722 if (d_really_is_positive(new_dentry))
723 return logfs_rename_target(old_dir, old_dentry, 723 return logfs_rename_target(old_dir, old_dentry,
724 new_dir, new_dentry); 724 new_dir, new_dentry);
725 return logfs_rename_cross(old_dir, old_dentry, new_dir, new_dentry); 725 return logfs_rename_cross(old_dir, old_dentry, new_dir, new_dentry);
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index b2c13f739ffa..1a6f0167b16a 100644
--- a/fs/logfs/file.c
+++ b/fs/logfs/file.c
@@ -241,7 +241,7 @@ int logfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
241 241
242static int logfs_setattr(struct dentry *dentry, struct iattr *attr) 242static int logfs_setattr(struct dentry *dentry, struct iattr *attr)
243{ 243{
244 struct inode *inode = dentry->d_inode; 244 struct inode *inode = d_inode(dentry);
245 int err = 0; 245 int err = 0;
246 246
247 err = inode_change_ok(inode, attr); 247 err = inode_change_ok(inode, attr);
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index dfaf6fa9b7b5..118e4e7bc935 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -156,7 +156,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page)
156{ 156{
157 const char * name = dentry->d_name.name; 157 const char * name = dentry->d_name.name;
158 int namelen = dentry->d_name.len; 158 int namelen = dentry->d_name.len;
159 struct inode * dir = dentry->d_parent->d_inode; 159 struct inode * dir = d_inode(dentry->d_parent);
160 struct super_block * sb = dir->i_sb; 160 struct super_block * sb = dir->i_sb;
161 struct minix_sb_info * sbi = minix_sb(sb); 161 struct minix_sb_info * sbi = minix_sb(sb);
162 unsigned long n; 162 unsigned long n;
@@ -203,7 +203,7 @@ found:
203 203
204int minix_add_link(struct dentry *dentry, struct inode *inode) 204int minix_add_link(struct dentry *dentry, struct inode *inode)
205{ 205{
206 struct inode *dir = dentry->d_parent->d_inode; 206 struct inode *dir = d_inode(dentry->d_parent);
207 const char * name = dentry->d_name.name; 207 const char * name = dentry->d_name.name;
208 int namelen = dentry->d_name.len; 208 int namelen = dentry->d_name.len;
209 struct super_block * sb = dir->i_sb; 209 struct super_block * sb = dir->i_sb;
diff --git a/fs/minix/file.c b/fs/minix/file.c
index 6d63e27ec961..94f0eb9a6e2c 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -23,7 +23,7 @@ const struct file_operations minix_file_operations = {
23 23
24static int minix_setattr(struct dentry *dentry, struct iattr *attr) 24static int minix_setattr(struct dentry *dentry, struct iattr *attr)
25{ 25{
26 struct inode *inode = dentry->d_inode; 26 struct inode *inode = d_inode(dentry);
27 int error; 27 int error;
28 28
29 error = inode_change_ok(inode, attr); 29 error = inode_change_ok(inode, attr);
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 3f57af196a7d..1182d1e26a9c 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -626,8 +626,8 @@ static int minix_write_inode(struct inode *inode, struct writeback_control *wbc)
626int minix_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 626int minix_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
627{ 627{
628 struct super_block *sb = dentry->d_sb; 628 struct super_block *sb = dentry->d_sb;
629 generic_fillattr(dentry->d_inode, stat); 629 generic_fillattr(d_inode(dentry), stat);
630 if (INODE_VERSION(dentry->d_inode) == MINIX_V1) 630 if (INODE_VERSION(d_inode(dentry)) == MINIX_V1)
631 stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb); 631 stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb);
632 else 632 else
633 stat->blocks = (sb->s_blocksize / 512) * V2_minix_blocks(stat->size, sb); 633 stat->blocks = (sb->s_blocksize / 512) * V2_minix_blocks(stat->size, sb);
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index cd950e2331b6..a795a11e50c7 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -104,7 +104,7 @@ out_fail:
104static int minix_link(struct dentry * old_dentry, struct inode * dir, 104static int minix_link(struct dentry * old_dentry, struct inode * dir,
105 struct dentry *dentry) 105 struct dentry *dentry)
106{ 106{
107 struct inode *inode = old_dentry->d_inode; 107 struct inode *inode = d_inode(old_dentry);
108 108
109 inode->i_ctime = CURRENT_TIME_SEC; 109 inode->i_ctime = CURRENT_TIME_SEC;
110 inode_inc_link_count(inode); 110 inode_inc_link_count(inode);
@@ -151,7 +151,7 @@ out_dir:
151static int minix_unlink(struct inode * dir, struct dentry *dentry) 151static int minix_unlink(struct inode * dir, struct dentry *dentry)
152{ 152{
153 int err = -ENOENT; 153 int err = -ENOENT;
154 struct inode * inode = dentry->d_inode; 154 struct inode * inode = d_inode(dentry);
155 struct page * page; 155 struct page * page;
156 struct minix_dir_entry * de; 156 struct minix_dir_entry * de;
157 157
@@ -171,7 +171,7 @@ end_unlink:
171 171
172static int minix_rmdir(struct inode * dir, struct dentry *dentry) 172static int minix_rmdir(struct inode * dir, struct dentry *dentry)
173{ 173{
174 struct inode * inode = dentry->d_inode; 174 struct inode * inode = d_inode(dentry);
175 int err = -ENOTEMPTY; 175 int err = -ENOTEMPTY;
176 176
177 if (minix_empty_dir(inode)) { 177 if (minix_empty_dir(inode)) {
@@ -187,8 +187,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
187static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, 187static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
188 struct inode * new_dir, struct dentry *new_dentry) 188 struct inode * new_dir, struct dentry *new_dentry)
189{ 189{
190 struct inode * old_inode = old_dentry->d_inode; 190 struct inode * old_inode = d_inode(old_dentry);
191 struct inode * new_inode = new_dentry->d_inode; 191 struct inode * new_inode = d_inode(new_dentry);
192 struct page * dir_page = NULL; 192 struct page * dir_page = NULL;
193 struct minix_dir_entry * dir_de = NULL; 193 struct minix_dir_entry * dir_de = NULL;
194 struct page * old_page; 194 struct page * old_page;
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index e7ca827d7694..80021c709af9 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -127,7 +127,7 @@ static inline int ncp_case_sensitive(const struct inode *i)
127static int 127static int
128ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) 128ncp_hash_dentry(const struct dentry *dentry, struct qstr *this)
129{ 129{
130 struct inode *inode = ACCESS_ONCE(dentry->d_inode); 130 struct inode *inode = d_inode_rcu(dentry);
131 131
132 if (!inode) 132 if (!inode)
133 return 0; 133 return 0;
@@ -162,7 +162,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
162 if (len != name->len) 162 if (len != name->len)
163 return 1; 163 return 1;
164 164
165 pinode = ACCESS_ONCE(parent->d_inode); 165 pinode = d_inode_rcu(parent);
166 if (!pinode) 166 if (!pinode)
167 return 1; 167 return 1;
168 168
@@ -180,7 +180,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
180static int 180static int
181ncp_delete_dentry(const struct dentry * dentry) 181ncp_delete_dentry(const struct dentry * dentry)
182{ 182{
183 struct inode *inode = dentry->d_inode; 183 struct inode *inode = d_inode(dentry);
184 184
185 if (inode) { 185 if (inode) {
186 if (is_bad_inode(inode)) 186 if (is_bad_inode(inode))
@@ -224,7 +224,7 @@ ncp_force_unlink(struct inode *dir, struct dentry* dentry)
224 memset(&info, 0, sizeof(info)); 224 memset(&info, 0, sizeof(info));
225 225
226 /* remove the Read-Only flag on the NW server */ 226 /* remove the Read-Only flag on the NW server */
227 inode = dentry->d_inode; 227 inode = d_inode(dentry);
228 228
229 old_nwattr = NCP_FINFO(inode)->nwattr; 229 old_nwattr = NCP_FINFO(inode)->nwattr;
230 info.attributes = old_nwattr & ~(aRONLY|aDELETEINHIBIT|aRENAMEINHIBIT); 230 info.attributes = old_nwattr & ~(aRONLY|aDELETEINHIBIT|aRENAMEINHIBIT);
@@ -254,7 +254,7 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
254{ 254{
255 struct nw_modify_dos_info info; 255 struct nw_modify_dos_info info;
256 int res=0x90,res2; 256 int res=0x90,res2;
257 struct inode *old_inode = old_dentry->d_inode; 257 struct inode *old_inode = d_inode(old_dentry);
258 __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr; 258 __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr;
259 __le32 new_nwattr = 0; /* shut compiler warning */ 259 __le32 new_nwattr = 0; /* shut compiler warning */
260 int old_nwattr_changed = 0; 260 int old_nwattr_changed = 0;
@@ -268,8 +268,8 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
268 res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(old_inode), old_inode, NULL, DM_ATTRIBUTES, &info); 268 res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(old_inode), old_inode, NULL, DM_ATTRIBUTES, &info);
269 if (!res2) 269 if (!res2)
270 old_nwattr_changed = 1; 270 old_nwattr_changed = 1;
271 if (new_dentry && new_dentry->d_inode) { 271 if (new_dentry && d_really_is_positive(new_dentry)) {
272 new_nwattr = NCP_FINFO(new_dentry->d_inode)->nwattr; 272 new_nwattr = NCP_FINFO(d_inode(new_dentry))->nwattr;
273 info.attributes = new_nwattr & ~(aRONLY|aRENAMEINHIBIT|aDELETEINHIBIT); 273 info.attributes = new_nwattr & ~(aRONLY|aRENAMEINHIBIT|aDELETEINHIBIT);
274 res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(new_dir), new_dir, _new_name, DM_ATTRIBUTES, &info); 274 res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(new_dir), new_dir, _new_name, DM_ATTRIBUTES, &info);
275 if (!res2) 275 if (!res2)
@@ -324,9 +324,9 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
324 return -ECHILD; 324 return -ECHILD;
325 325
326 parent = dget_parent(dentry); 326 parent = dget_parent(dentry);
327 dir = parent->d_inode; 327 dir = d_inode(parent);
328 328
329 if (!dentry->d_inode) 329 if (d_really_is_negative(dentry))
330 goto finished; 330 goto finished;
331 331
332 server = NCP_SERVER(dir); 332 server = NCP_SERVER(dir);
@@ -367,7 +367,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
367 * what we remember, it's not valid any more. 367 * what we remember, it's not valid any more.
368 */ 368 */
369 if (!res) { 369 if (!res) {
370 struct inode *inode = dentry->d_inode; 370 struct inode *inode = d_inode(dentry);
371 371
372 mutex_lock(&inode->i_mutex); 372 mutex_lock(&inode->i_mutex);
373 if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) { 373 if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) {
@@ -388,7 +388,7 @@ finished:
388 388
389static time_t ncp_obtain_mtime(struct dentry *dentry) 389static time_t ncp_obtain_mtime(struct dentry *dentry)
390{ 390{
391 struct inode *inode = dentry->d_inode; 391 struct inode *inode = d_inode(dentry);
392 struct ncp_server *server = NCP_SERVER(inode); 392 struct ncp_server *server = NCP_SERVER(inode);
393 struct nw_info_struct i; 393 struct nw_info_struct i;
394 394
@@ -404,7 +404,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
404static inline void 404static inline void
405ncp_invalidate_dircache_entries(struct dentry *parent) 405ncp_invalidate_dircache_entries(struct dentry *parent)
406{ 406{
407 struct ncp_server *server = NCP_SERVER(parent->d_inode); 407 struct ncp_server *server = NCP_SERVER(d_inode(parent));
408 struct dentry *dentry; 408 struct dentry *dentry;
409 409
410 spin_lock(&parent->d_lock); 410 spin_lock(&parent->d_lock);
@@ -418,7 +418,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent)
418static int ncp_readdir(struct file *file, struct dir_context *ctx) 418static int ncp_readdir(struct file *file, struct dir_context *ctx)
419{ 419{
420 struct dentry *dentry = file->f_path.dentry; 420 struct dentry *dentry = file->f_path.dentry;
421 struct inode *inode = dentry->d_inode; 421 struct inode *inode = d_inode(dentry);
422 struct page *page = NULL; 422 struct page *page = NULL;
423 struct ncp_server *server = NCP_SERVER(inode); 423 struct ncp_server *server = NCP_SERVER(inode);
424 union ncp_dir_cache *cache = NULL; 424 union ncp_dir_cache *cache = NULL;
@@ -491,13 +491,13 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
491 goto invalid_cache; 491 goto invalid_cache;
492 } 492 }
493 spin_unlock(&dentry->d_lock); 493 spin_unlock(&dentry->d_lock);
494 if (!dent->d_inode) { 494 if (d_really_is_negative(dent)) {
495 dput(dent); 495 dput(dent);
496 goto invalid_cache; 496 goto invalid_cache;
497 } 497 }
498 over = !dir_emit(ctx, dent->d_name.name, 498 over = !dir_emit(ctx, dent->d_name.name,
499 dent->d_name.len, 499 dent->d_name.len,
500 dent->d_inode->i_ino, DT_UNKNOWN); 500 d_inode(dent)->i_ino, DT_UNKNOWN);
501 dput(dent); 501 dput(dent);
502 if (over) 502 if (over)
503 goto finished; 503 goto finished;
@@ -571,7 +571,7 @@ static void ncp_d_prune(struct dentry *dentry)
571{ 571{
572 if (!dentry->d_fsdata) /* not referenced from page cache */ 572 if (!dentry->d_fsdata) /* not referenced from page cache */
573 return; 573 return;
574 NCP_FINFO(dentry->d_parent->d_inode)->flags &= ~NCPI_DIR_CACHE; 574 NCP_FINFO(d_inode(dentry->d_parent))->flags &= ~NCPI_DIR_CACHE;
575} 575}
576 576
577static int 577static int
@@ -580,7 +580,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
580 int inval_childs) 580 int inval_childs)
581{ 581{
582 struct dentry *newdent, *dentry = file->f_path.dentry; 582 struct dentry *newdent, *dentry = file->f_path.dentry;
583 struct inode *dir = dentry->d_inode; 583 struct inode *dir = d_inode(dentry);
584 struct ncp_cache_control ctl = *ctrl; 584 struct ncp_cache_control ctl = *ctrl;
585 struct qstr qname; 585 struct qstr qname;
586 int valid = 0; 586 int valid = 0;
@@ -621,7 +621,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
621 dentry_update_name_case(newdent, &qname); 621 dentry_update_name_case(newdent, &qname);
622 } 622 }
623 623
624 if (!newdent->d_inode) { 624 if (d_really_is_negative(newdent)) {
625 struct inode *inode; 625 struct inode *inode;
626 626
627 entry->opened = 0; 627 entry->opened = 0;
@@ -637,7 +637,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
637 spin_unlock(&dentry->d_lock); 637 spin_unlock(&dentry->d_lock);
638 } 638 }
639 } else { 639 } else {
640 struct inode *inode = newdent->d_inode; 640 struct inode *inode = d_inode(newdent);
641 641
642 mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); 642 mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
643 ncp_update_inode2(inode, entry); 643 ncp_update_inode2(inode, entry);
@@ -659,10 +659,10 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
659 ctl.cache = kmap(ctl.page); 659 ctl.cache = kmap(ctl.page);
660 } 660 }
661 if (ctl.cache) { 661 if (ctl.cache) {
662 if (newdent->d_inode) { 662 if (d_really_is_positive(newdent)) {
663 newdent->d_fsdata = newdent; 663 newdent->d_fsdata = newdent;
664 ctl.cache->dentry[ctl.idx] = newdent; 664 ctl.cache->dentry[ctl.idx] = newdent;
665 ino = newdent->d_inode->i_ino; 665 ino = d_inode(newdent)->i_ino;
666 ncp_new_dentry(newdent); 666 ncp_new_dentry(newdent);
667 } 667 }
668 valid = 1; 668 valid = 1;
@@ -807,7 +807,7 @@ int ncp_conn_logged_in(struct super_block *sb)
807 } 807 }
808 dent = sb->s_root; 808 dent = sb->s_root;
809 if (dent) { 809 if (dent) {
810 struct inode* ino = dent->d_inode; 810 struct inode* ino = d_inode(dent);
811 if (ino) { 811 if (ino) {
812 ncp_update_known_namespace(server, volNumber, NULL); 812 ncp_update_known_namespace(server, volNumber, NULL);
813 NCP_FINFO(ino)->volNumber = volNumber; 813 NCP_FINFO(ino)->volNumber = volNumber;
@@ -815,7 +815,7 @@ int ncp_conn_logged_in(struct super_block *sb)
815 NCP_FINFO(ino)->DosDirNum = DosDirNum; 815 NCP_FINFO(ino)->DosDirNum = DosDirNum;
816 result = 0; 816 result = 0;
817 } else { 817 } else {
818 ncp_dbg(1, "sb->s_root->d_inode == NULL!\n"); 818 ncp_dbg(1, "d_inode(sb->s_root) == NULL!\n");
819 } 819 }
820 } else { 820 } else {
821 ncp_dbg(1, "sb->s_root == NULL!\n"); 821 ncp_dbg(1, "sb->s_root == NULL!\n");
@@ -1055,7 +1055,7 @@ out:
1055 1055
1056static int ncp_unlink(struct inode *dir, struct dentry *dentry) 1056static int ncp_unlink(struct inode *dir, struct dentry *dentry)
1057{ 1057{
1058 struct inode *inode = dentry->d_inode; 1058 struct inode *inode = d_inode(dentry);
1059 struct ncp_server *server; 1059 struct ncp_server *server;
1060 int error; 1060 int error;
1061 1061
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 01a9e16e9782..9605a2f63549 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -812,7 +812,7 @@ static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf)
812 if (!d) { 812 if (!d) {
813 goto dflt; 813 goto dflt;
814 } 814 }
815 i = d->d_inode; 815 i = d_inode(d);
816 if (!i) { 816 if (!i) {
817 goto dflt; 817 goto dflt;
818 } 818 }
@@ -865,7 +865,7 @@ dflt:;
865 865
866int ncp_notify_change(struct dentry *dentry, struct iattr *attr) 866int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
867{ 867{
868 struct inode *inode = dentry->d_inode; 868 struct inode *inode = d_inode(dentry);
869 int result = 0; 869 int result = 0;
870 __le32 info_mask; 870 __le32 info_mask;
871 struct nw_modify_dos_info info; 871 struct nw_modify_dos_info info;
@@ -878,7 +878,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
878 goto out; 878 goto out;
879 879
880 result = -EPERM; 880 result = -EPERM;
881 if (IS_DEADDIR(dentry->d_inode)) 881 if (IS_DEADDIR(d_inode(dentry)))
882 goto out; 882 goto out;
883 883
884 /* ageing the dentry to force validation */ 884 /* ageing the dentry to force validation */
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index cf7e043a9447..79b113048eac 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -376,7 +376,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
376 struct dentry* dentry = inode->i_sb->s_root; 376 struct dentry* dentry = inode->i_sb->s_root;
377 377
378 if (dentry) { 378 if (dentry) {
379 struct inode* s_inode = dentry->d_inode; 379 struct inode* s_inode = d_inode(dentry);
380 380
381 if (s_inode) { 381 if (s_inode) {
382 sr.volNumber = NCP_FINFO(s_inode)->volNumber; 382 sr.volNumber = NCP_FINFO(s_inode)->volNumber;
@@ -384,7 +384,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
384 sr.namespace = server->name_space[sr.volNumber]; 384 sr.namespace = server->name_space[sr.volNumber];
385 result = 0; 385 result = 0;
386 } else 386 } else
387 ncp_dbg(1, "s_root->d_inode==NULL\n"); 387 ncp_dbg(1, "d_inode(s_root)==NULL\n");
388 } else 388 } else
389 ncp_dbg(1, "s_root==NULL\n"); 389 ncp_dbg(1, "s_root==NULL\n");
390 } else { 390 } else {
@@ -431,7 +431,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
431 if (result == 0) { 431 if (result == 0) {
432 dentry = inode->i_sb->s_root; 432 dentry = inode->i_sb->s_root;
433 if (dentry) { 433 if (dentry) {
434 struct inode* s_inode = dentry->d_inode; 434 struct inode* s_inode = d_inode(dentry);
435 435
436 if (s_inode) { 436 if (s_inode) {
437 NCP_FINFO(s_inode)->volNumber = vnum; 437 NCP_FINFO(s_inode)->volNumber = vnum;
@@ -439,7 +439,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
439 NCP_FINFO(s_inode)->DosDirNum = dosde; 439 NCP_FINFO(s_inode)->DosDirNum = dosde;
440 server->root_setuped = 1; 440 server->root_setuped = 1;
441 } else { 441 } else {
442 ncp_dbg(1, "s_root->d_inode==NULL\n"); 442 ncp_dbg(1, "d_inode(s_root)==NULL\n");
443 result = -EIO; 443 result = -EIO;
444 } 444 }
445 } else { 445 } else {
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
index 2b502a0d7941..88dbbc9fcf4d 100644
--- a/fs/ncpfs/ncplib_kernel.c
+++ b/fs/ncpfs/ncplib_kernel.c
@@ -727,7 +727,7 @@ int
727ncp_del_file_or_subdir2(struct ncp_server *server, 727ncp_del_file_or_subdir2(struct ncp_server *server,
728 struct dentry *dentry) 728 struct dentry *dentry)
729{ 729{
730 struct inode *inode = dentry->d_inode; 730 struct inode *inode = d_inode(dentry);
731 __u8 volnum; 731 __u8 volnum;
732 __le32 dirent; 732 __le32 dirent;
733 733
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c
index 1a63bfdb4a65..421b6f91e8ec 100644
--- a/fs/ncpfs/symlink.c
+++ b/fs/ncpfs/symlink.c
@@ -156,7 +156,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
156 goto failfree; 156 goto failfree;
157 } 157 }
158 158
159 inode=dentry->d_inode; 159 inode=d_inode(dentry);
160 160
161 if (ncp_make_open(inode, O_WRONLY)) 161 if (ncp_make_open(inode, O_WRONLY))
162 goto failfree; 162 goto failfree;
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c19e16f0b2d0..1e51ecd61854 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -416,15 +416,14 @@ int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
416{ 416{
417 struct nfs_inode *nfsi; 417 struct nfs_inode *nfsi;
418 418
419 if (dentry->d_inode == NULL) 419 if (d_really_is_negative(dentry))
420 goto different; 420 return 0;
421 421
422 nfsi = NFS_I(dentry->d_inode); 422 nfsi = NFS_I(d_inode(dentry));
423 if (entry->fattr->fileid == nfsi->fileid) 423 if (entry->fattr->fileid == nfsi->fileid)
424 return 1; 424 return 1;
425 if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) 425 if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0)
426 return 1; 426 return 1;
427different:
428 return 0; 427 return 0;
429} 428}
430 429
@@ -473,7 +472,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
473 struct qstr filename = QSTR_INIT(entry->name, entry->len); 472 struct qstr filename = QSTR_INIT(entry->name, entry->len);
474 struct dentry *dentry; 473 struct dentry *dentry;
475 struct dentry *alias; 474 struct dentry *alias;
476 struct inode *dir = parent->d_inode; 475 struct inode *dir = d_inode(parent);
477 struct inode *inode; 476 struct inode *inode;
478 int status; 477 int status;
479 478
@@ -497,9 +496,9 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
497 goto out; 496 goto out;
498 if (nfs_same_file(dentry, entry)) { 497 if (nfs_same_file(dentry, entry)) {
499 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 498 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
500 status = nfs_refresh_inode(dentry->d_inode, entry->fattr); 499 status = nfs_refresh_inode(d_inode(dentry), entry->fattr);
501 if (!status) 500 if (!status)
502 nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); 501 nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label);
503 goto out; 502 goto out;
504 } else { 503 } else {
505 d_invalidate(dentry); 504 d_invalidate(dentry);
@@ -870,7 +869,7 @@ static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
870static int nfs_readdir(struct file *file, struct dir_context *ctx) 869static int nfs_readdir(struct file *file, struct dir_context *ctx)
871{ 870{
872 struct dentry *dentry = file->f_path.dentry; 871 struct dentry *dentry = file->f_path.dentry;
873 struct inode *inode = dentry->d_inode; 872 struct inode *inode = d_inode(dentry);
874 nfs_readdir_descriptor_t my_desc, 873 nfs_readdir_descriptor_t my_desc,
875 *desc = &my_desc; 874 *desc = &my_desc;
876 struct nfs_open_dir_context *dir_ctx = file->private_data; 875 struct nfs_open_dir_context *dir_ctx = file->private_data;
@@ -1118,15 +1117,15 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1118 1117
1119 if (flags & LOOKUP_RCU) { 1118 if (flags & LOOKUP_RCU) {
1120 parent = ACCESS_ONCE(dentry->d_parent); 1119 parent = ACCESS_ONCE(dentry->d_parent);
1121 dir = ACCESS_ONCE(parent->d_inode); 1120 dir = d_inode_rcu(parent);
1122 if (!dir) 1121 if (!dir)
1123 return -ECHILD; 1122 return -ECHILD;
1124 } else { 1123 } else {
1125 parent = dget_parent(dentry); 1124 parent = dget_parent(dentry);
1126 dir = parent->d_inode; 1125 dir = d_inode(parent);
1127 } 1126 }
1128 nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); 1127 nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
1129 inode = dentry->d_inode; 1128 inode = d_inode(dentry);
1130 1129
1131 if (!inode) { 1130 if (!inode) {
1132 if (nfs_neg_need_reval(dir, dentry, flags)) { 1131 if (nfs_neg_need_reval(dir, dentry, flags)) {
@@ -1242,7 +1241,7 @@ out_error:
1242} 1241}
1243 1242
1244/* 1243/*
1245 * A weaker form of d_revalidate for revalidating just the dentry->d_inode 1244 * A weaker form of d_revalidate for revalidating just the d_inode(dentry)
1246 * when we don't really care about the dentry name. This is called when a 1245 * when we don't really care about the dentry name. This is called when a
1247 * pathwalk ends on a dentry that was not found via a normal lookup in the 1246 * pathwalk ends on a dentry that was not found via a normal lookup in the
1248 * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals). 1247 * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals).
@@ -1253,7 +1252,7 @@ out_error:
1253static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) 1252static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
1254{ 1253{
1255 int error; 1254 int error;
1256 struct inode *inode = dentry->d_inode; 1255 struct inode *inode = d_inode(dentry);
1257 1256
1258 /* 1257 /*
1259 * I believe we can only get a negative dentry here in the case of a 1258 * I believe we can only get a negative dentry here in the case of a
@@ -1287,7 +1286,7 @@ static int nfs_dentry_delete(const struct dentry *dentry)
1287 dentry, dentry->d_flags); 1286 dentry, dentry->d_flags);
1288 1287
1289 /* Unhash any dentry with a stale inode */ 1288 /* Unhash any dentry with a stale inode */
1290 if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode)) 1289 if (d_really_is_positive(dentry) && NFS_STALE(d_inode(dentry)))
1291 return 1; 1290 return 1;
1292 1291
1293 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { 1292 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
@@ -1491,7 +1490,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
1491 int err; 1490 int err;
1492 1491
1493 /* Expect a negative dentry */ 1492 /* Expect a negative dentry */
1494 BUG_ON(dentry->d_inode); 1493 BUG_ON(d_inode(dentry));
1495 1494
1496 dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n", 1495 dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n",
1497 dir->i_sb->s_id, dir->i_ino, dentry); 1496 dir->i_sb->s_id, dir->i_ino, dentry);
@@ -1587,7 +1586,7 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1587 if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1) 1586 if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1)
1588 goto no_open; 1587 goto no_open;
1589 1588
1590 inode = dentry->d_inode; 1589 inode = d_inode(dentry);
1591 1590
1592 /* We can't create new files in nfs_open_revalidate(), so we 1591 /* We can't create new files in nfs_open_revalidate(), so we
1593 * optimize away revalidation of negative dentries. 1592 * optimize away revalidation of negative dentries.
@@ -1598,12 +1597,12 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1598 1597
1599 if (flags & LOOKUP_RCU) { 1598 if (flags & LOOKUP_RCU) {
1600 parent = ACCESS_ONCE(dentry->d_parent); 1599 parent = ACCESS_ONCE(dentry->d_parent);
1601 dir = ACCESS_ONCE(parent->d_inode); 1600 dir = d_inode_rcu(parent);
1602 if (!dir) 1601 if (!dir)
1603 return -ECHILD; 1602 return -ECHILD;
1604 } else { 1603 } else {
1605 parent = dget_parent(dentry); 1604 parent = dget_parent(dentry);
1606 dir = parent->d_inode; 1605 dir = d_inode(parent);
1607 } 1606 }
1608 if (!nfs_neg_need_reval(dir, dentry, flags)) 1607 if (!nfs_neg_need_reval(dir, dentry, flags))
1609 ret = 1; 1608 ret = 1;
@@ -1643,14 +1642,14 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1643 struct nfs4_label *label) 1642 struct nfs4_label *label)
1644{ 1643{
1645 struct dentry *parent = dget_parent(dentry); 1644 struct dentry *parent = dget_parent(dentry);
1646 struct inode *dir = parent->d_inode; 1645 struct inode *dir = d_inode(parent);
1647 struct inode *inode; 1646 struct inode *inode;
1648 int error = -EACCES; 1647 int error = -EACCES;
1649 1648
1650 d_drop(dentry); 1649 d_drop(dentry);
1651 1650
1652 /* We may have been initialized further down */ 1651 /* We may have been initialized further down */
1653 if (dentry->d_inode) 1652 if (d_really_is_positive(dentry))
1654 goto out; 1653 goto out;
1655 if (fhandle->size == 0) { 1654 if (fhandle->size == 0) {
1656 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL); 1655 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL);
@@ -1768,7 +1767,7 @@ EXPORT_SYMBOL_GPL(nfs_mkdir);
1768 1767
1769static void nfs_dentry_handle_enoent(struct dentry *dentry) 1768static void nfs_dentry_handle_enoent(struct dentry *dentry)
1770{ 1769{
1771 if (dentry->d_inode != NULL && !d_unhashed(dentry)) 1770 if (d_really_is_positive(dentry) && !d_unhashed(dentry))
1772 d_delete(dentry); 1771 d_delete(dentry);
1773} 1772}
1774 1773
@@ -1780,13 +1779,13 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
1780 dir->i_sb->s_id, dir->i_ino, dentry); 1779 dir->i_sb->s_id, dir->i_ino, dentry);
1781 1780
1782 trace_nfs_rmdir_enter(dir, dentry); 1781 trace_nfs_rmdir_enter(dir, dentry);
1783 if (dentry->d_inode) { 1782 if (d_really_is_positive(dentry)) {
1784 nfs_wait_on_sillyrename(dentry); 1783 nfs_wait_on_sillyrename(dentry);
1785 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); 1784 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
1786 /* Ensure the VFS deletes this inode */ 1785 /* Ensure the VFS deletes this inode */
1787 switch (error) { 1786 switch (error) {
1788 case 0: 1787 case 0:
1789 clear_nlink(dentry->d_inode); 1788 clear_nlink(d_inode(dentry));
1790 break; 1789 break;
1791 case -ENOENT: 1790 case -ENOENT:
1792 nfs_dentry_handle_enoent(dentry); 1791 nfs_dentry_handle_enoent(dentry);
@@ -1808,8 +1807,8 @@ EXPORT_SYMBOL_GPL(nfs_rmdir);
1808 */ 1807 */
1809static int nfs_safe_remove(struct dentry *dentry) 1808static int nfs_safe_remove(struct dentry *dentry)
1810{ 1809{
1811 struct inode *dir = dentry->d_parent->d_inode; 1810 struct inode *dir = d_inode(dentry->d_parent);
1812 struct inode *inode = dentry->d_inode; 1811 struct inode *inode = d_inode(dentry);
1813 int error = -EBUSY; 1812 int error = -EBUSY;
1814 1813
1815 dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry); 1814 dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry);
@@ -1853,7 +1852,7 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
1853 if (d_count(dentry) > 1) { 1852 if (d_count(dentry) > 1) {
1854 spin_unlock(&dentry->d_lock); 1853 spin_unlock(&dentry->d_lock);
1855 /* Start asynchronous writeout of the inode */ 1854 /* Start asynchronous writeout of the inode */
1856 write_inode_now(dentry->d_inode, 0); 1855 write_inode_now(d_inode(dentry), 0);
1857 error = nfs_sillyrename(dir, dentry); 1856 error = nfs_sillyrename(dir, dentry);
1858 goto out; 1857 goto out;
1859 } 1858 }
@@ -1931,7 +1930,7 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1931 * No big deal if we can't add this page to the page cache here. 1930 * No big deal if we can't add this page to the page cache here.
1932 * READLINK will get the missing page from the server if needed. 1931 * READLINK will get the missing page from the server if needed.
1933 */ 1932 */
1934 if (!add_to_page_cache_lru(page, dentry->d_inode->i_mapping, 0, 1933 if (!add_to_page_cache_lru(page, d_inode(dentry)->i_mapping, 0,
1935 GFP_KERNEL)) { 1934 GFP_KERNEL)) {
1936 SetPageUptodate(page); 1935 SetPageUptodate(page);
1937 unlock_page(page); 1936 unlock_page(page);
@@ -1950,7 +1949,7 @@ EXPORT_SYMBOL_GPL(nfs_symlink);
1950int 1949int
1951nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 1950nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1952{ 1951{
1953 struct inode *inode = old_dentry->d_inode; 1952 struct inode *inode = d_inode(old_dentry);
1954 int error; 1953 int error;
1955 1954
1956 dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n", 1955 dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n",
@@ -1997,8 +1996,8 @@ EXPORT_SYMBOL_GPL(nfs_link);
1997int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, 1996int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1998 struct inode *new_dir, struct dentry *new_dentry) 1997 struct inode *new_dir, struct dentry *new_dentry)
1999{ 1998{
2000 struct inode *old_inode = old_dentry->d_inode; 1999 struct inode *old_inode = d_inode(old_dentry);
2001 struct inode *new_inode = new_dentry->d_inode; 2000 struct inode *new_inode = d_inode(new_dentry);
2002 struct dentry *dentry = NULL, *rehash = NULL; 2001 struct dentry *dentry = NULL, *rehash = NULL;
2003 struct rpc_task *task; 2002 struct rpc_task *task;
2004 int error = -EBUSY; 2003 int error = -EBUSY;
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 682f65fe09b5..ed0e6031be88 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -403,8 +403,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
403static void nfs_direct_readpage_release(struct nfs_page *req) 403static void nfs_direct_readpage_release(struct nfs_page *req)
404{ 404{
405 dprintk("NFS: direct read done (%s/%llu %d@%lld)\n", 405 dprintk("NFS: direct read done (%s/%llu %d@%lld)\n",
406 req->wb_context->dentry->d_inode->i_sb->s_id, 406 d_inode(req->wb_context->dentry)->i_sb->s_id,
407 (unsigned long long)NFS_FILEID(req->wb_context->dentry->d_inode), 407 (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)),
408 req->wb_bytes, 408 req->wb_bytes,
409 (long long)req_offset(req)); 409 (long long)req_offset(req));
410 nfs_release_request(req); 410 nfs_release_request(req);
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 9ac3846cb59e..a608ffd28acc 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -56,11 +56,11 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
56 * This again causes shrink_dcache_for_umount_subtree() to 56 * This again causes shrink_dcache_for_umount_subtree() to
57 * Oops, since the test for IS_ROOT() will fail. 57 * Oops, since the test for IS_ROOT() will fail.
58 */ 58 */
59 spin_lock(&sb->s_root->d_inode->i_lock); 59 spin_lock(&d_inode(sb->s_root)->i_lock);
60 spin_lock(&sb->s_root->d_lock); 60 spin_lock(&sb->s_root->d_lock);
61 hlist_del_init(&sb->s_root->d_u.d_alias); 61 hlist_del_init(&sb->s_root->d_u.d_alias);
62 spin_unlock(&sb->s_root->d_lock); 62 spin_unlock(&sb->s_root->d_lock);
63 spin_unlock(&sb->s_root->d_inode->i_lock); 63 spin_unlock(&d_inode(sb->s_root)->i_lock);
64 } 64 }
65 return 0; 65 return 0;
66} 66}
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index d42dff6d5e98..3689e95da79a 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -495,7 +495,7 @@ EXPORT_SYMBOL_GPL(nfs_fhget);
495int 495int
496nfs_setattr(struct dentry *dentry, struct iattr *attr) 496nfs_setattr(struct dentry *dentry, struct iattr *attr)
497{ 497{
498 struct inode *inode = dentry->d_inode; 498 struct inode *inode = d_inode(dentry);
499 struct nfs_fattr *fattr; 499 struct nfs_fattr *fattr;
500 int error = -ENOMEM; 500 int error = -ENOMEM;
501 501
@@ -621,7 +621,7 @@ static void nfs_request_parent_use_readdirplus(struct dentry *dentry)
621 struct dentry *parent; 621 struct dentry *parent;
622 622
623 parent = dget_parent(dentry); 623 parent = dget_parent(dentry);
624 nfs_force_use_readdirplus(parent->d_inode); 624 nfs_force_use_readdirplus(d_inode(parent));
625 dput(parent); 625 dput(parent);
626} 626}
627 627
@@ -637,7 +637,7 @@ static bool nfs_need_revalidate_inode(struct inode *inode)
637 637
638int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 638int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
639{ 639{
640 struct inode *inode = dentry->d_inode; 640 struct inode *inode = d_inode(dentry);
641 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; 641 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME;
642 int err = 0; 642 int err = 0;
643 643
@@ -708,7 +708,7 @@ static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context
708struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx) 708struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx)
709{ 709{
710 struct nfs_lock_context *res, *new = NULL; 710 struct nfs_lock_context *res, *new = NULL;
711 struct inode *inode = ctx->dentry->d_inode; 711 struct inode *inode = d_inode(ctx->dentry);
712 712
713 spin_lock(&inode->i_lock); 713 spin_lock(&inode->i_lock);
714 res = __nfs_find_lock_context(ctx); 714 res = __nfs_find_lock_context(ctx);
@@ -736,7 +736,7 @@ EXPORT_SYMBOL_GPL(nfs_get_lock_context);
736void nfs_put_lock_context(struct nfs_lock_context *l_ctx) 736void nfs_put_lock_context(struct nfs_lock_context *l_ctx)
737{ 737{
738 struct nfs_open_context *ctx = l_ctx->open_context; 738 struct nfs_open_context *ctx = l_ctx->open_context;
739 struct inode *inode = ctx->dentry->d_inode; 739 struct inode *inode = d_inode(ctx->dentry);
740 740
741 if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock)) 741 if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock))
742 return; 742 return;
@@ -763,7 +763,7 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync)
763 return; 763 return;
764 if (!is_sync) 764 if (!is_sync)
765 return; 765 return;
766 inode = ctx->dentry->d_inode; 766 inode = d_inode(ctx->dentry);
767 if (!list_empty(&NFS_I(inode)->open_files)) 767 if (!list_empty(&NFS_I(inode)->open_files))
768 return; 768 return;
769 server = NFS_SERVER(inode); 769 server = NFS_SERVER(inode);
@@ -810,7 +810,7 @@ EXPORT_SYMBOL_GPL(get_nfs_open_context);
810 810
811static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) 811static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
812{ 812{
813 struct inode *inode = ctx->dentry->d_inode; 813 struct inode *inode = d_inode(ctx->dentry);
814 struct super_block *sb = ctx->dentry->d_sb; 814 struct super_block *sb = ctx->dentry->d_sb;
815 815
816 if (!list_empty(&ctx->list)) { 816 if (!list_empty(&ctx->list)) {
@@ -842,7 +842,7 @@ EXPORT_SYMBOL_GPL(put_nfs_open_context);
842 */ 842 */
843void nfs_inode_attach_open_context(struct nfs_open_context *ctx) 843void nfs_inode_attach_open_context(struct nfs_open_context *ctx)
844{ 844{
845 struct inode *inode = ctx->dentry->d_inode; 845 struct inode *inode = d_inode(ctx->dentry);
846 struct nfs_inode *nfsi = NFS_I(inode); 846 struct nfs_inode *nfsi = NFS_I(inode);
847 847
848 spin_lock(&inode->i_lock); 848 spin_lock(&inode->i_lock);
@@ -885,7 +885,7 @@ static void nfs_file_clear_open_context(struct file *filp)
885 struct nfs_open_context *ctx = nfs_file_open_context(filp); 885 struct nfs_open_context *ctx = nfs_file_open_context(filp);
886 886
887 if (ctx) { 887 if (ctx) {
888 struct inode *inode = ctx->dentry->d_inode; 888 struct inode *inode = d_inode(ctx->dentry);
889 889
890 filp->private_data = NULL; 890 filp->private_data = NULL;
891 spin_lock(&inode->i_lock); 891 spin_lock(&inode->i_lock);
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index b5a0afc3ee10..c8162c660c44 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -139,7 +139,7 @@ EXPORT_SYMBOL_GPL(nfs_path);
139struct vfsmount *nfs_d_automount(struct path *path) 139struct vfsmount *nfs_d_automount(struct path *path)
140{ 140{
141 struct vfsmount *mnt; 141 struct vfsmount *mnt;
142 struct nfs_server *server = NFS_SERVER(path->dentry->d_inode); 142 struct nfs_server *server = NFS_SERVER(d_inode(path->dentry));
143 struct nfs_fh *fh = NULL; 143 struct nfs_fh *fh = NULL;
144 struct nfs_fattr *fattr = NULL; 144 struct nfs_fattr *fattr = NULL;
145 145
@@ -180,16 +180,16 @@ out_nofree:
180static int 180static int
181nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 181nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
182{ 182{
183 if (NFS_FH(dentry->d_inode)->size != 0) 183 if (NFS_FH(d_inode(dentry))->size != 0)
184 return nfs_getattr(mnt, dentry, stat); 184 return nfs_getattr(mnt, dentry, stat);
185 generic_fillattr(dentry->d_inode, stat); 185 generic_fillattr(d_inode(dentry), stat);
186 return 0; 186 return 0;
187} 187}
188 188
189static int 189static int
190nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr) 190nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr)
191{ 191{
192 if (NFS_FH(dentry->d_inode)->size != 0) 192 if (NFS_FH(d_inode(dentry))->size != 0)
193 return nfs_setattr(dentry, attr); 193 return nfs_setattr(dentry, attr);
194 return -EACCES; 194 return -EACCES;
195} 195}
@@ -279,7 +279,7 @@ struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry,
279 struct dentry *parent = dget_parent(dentry); 279 struct dentry *parent = dget_parent(dentry);
280 280
281 /* Look it up again to get its attributes */ 281 /* Look it up again to get its attributes */
282 err = server->nfs_client->rpc_ops->lookup(parent->d_inode, &dentry->d_name, fh, fattr, NULL); 282 err = server->nfs_client->rpc_ops->lookup(d_inode(parent), &dentry->d_name, fh, fattr, NULL);
283 dput(parent); 283 dput(parent);
284 if (err != 0) 284 if (err != 0)
285 return ERR_PTR(err); 285 return ERR_PTR(err);
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 658e586ca438..1ebe2fc7cda2 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -279,7 +279,7 @@ nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data,
279ssize_t 279ssize_t
280nfs3_listxattr(struct dentry *dentry, char *data, size_t size) 280nfs3_listxattr(struct dentry *dentry, char *data, size_t size)
281{ 281{
282 struct inode *inode = dentry->d_inode; 282 struct inode *inode = d_inode(dentry);
283 ssize_t result = 0; 283 ssize_t result = 0;
284 int error; 284 int error;
285 285
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 1f11d2533ee4..cb28cceefebe 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -120,7 +120,7 @@ static int
120nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, 120nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
121 struct iattr *sattr) 121 struct iattr *sattr)
122{ 122{
123 struct inode *inode = dentry->d_inode; 123 struct inode *inode = d_inode(dentry);
124 struct nfs3_sattrargs arg = { 124 struct nfs3_sattrargs arg = {
125 .fh = NFS_FH(inode), 125 .fh = NFS_FH(inode),
126 .sattr = sattr, 126 .sattr = sattr,
@@ -386,13 +386,13 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
386 * not sure this buys us anything (and I'd have 386 * not sure this buys us anything (and I'd have
387 * to revamp the NFSv3 XDR code) */ 387 * to revamp the NFSv3 XDR code) */
388 status = nfs3_proc_setattr(dentry, data->res.fattr, sattr); 388 status = nfs3_proc_setattr(dentry, data->res.fattr, sattr);
389 nfs_post_op_update_inode(dentry->d_inode, data->res.fattr); 389 nfs_post_op_update_inode(d_inode(dentry), data->res.fattr);
390 dprintk("NFS reply setattr (post-create): %d\n", status); 390 dprintk("NFS reply setattr (post-create): %d\n", status);
391 if (status != 0) 391 if (status != 0)
392 goto out_release_acls; 392 goto out_release_acls;
393 } 393 }
394 394
395 status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); 395 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
396 396
397out_release_acls: 397out_release_acls:
398 posix_acl_release(acl); 398 posix_acl_release(acl);
@@ -570,7 +570,7 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
570 if (status != 0) 570 if (status != 0)
571 goto out_release_acls; 571 goto out_release_acls;
572 572
573 status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); 573 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
574 574
575out_release_acls: 575out_release_acls:
576 posix_acl_release(acl); 576 posix_acl_release(acl);
@@ -623,7 +623,7 @@ static int
623nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, 623nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
624 u64 cookie, struct page **pages, unsigned int count, int plus) 624 u64 cookie, struct page **pages, unsigned int count, int plus)
625{ 625{
626 struct inode *dir = dentry->d_inode; 626 struct inode *dir = d_inode(dentry);
627 __be32 *verf = NFS_I(dir)->cookieverf; 627 __be32 *verf = NFS_I(dir)->cookieverf;
628 struct nfs3_readdirargs arg = { 628 struct nfs3_readdirargs arg = {
629 .fh = NFS_FH(dir), 629 .fh = NFS_FH(dir),
@@ -715,7 +715,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
715 if (status != 0) 715 if (status != 0)
716 goto out_release_acls; 716 goto out_release_acls;
717 717
718 status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); 718 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
719 719
720out_release_acls: 720out_release_acls:
721 posix_acl_release(acl); 721 posix_acl_release(acl);
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 86d6214ea022..51c2dbd1e942 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -1130,7 +1130,7 @@ error:
1130 */ 1130 */
1131static int nfs_probe_destination(struct nfs_server *server) 1131static int nfs_probe_destination(struct nfs_server *server)
1132{ 1132{
1133 struct inode *inode = server->super->s_root->d_inode; 1133 struct inode *inode = d_inode(server->super->s_root);
1134 struct nfs_fattr *fattr; 1134 struct nfs_fattr *fattr;
1135 int error; 1135 int error;
1136 1136
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 0181cde1d102..619eca34e70f 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -46,7 +46,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
46 openflags &= ~(O_CREAT|O_EXCL); 46 openflags &= ~(O_CREAT|O_EXCL);
47 47
48 parent = dget_parent(dentry); 48 parent = dget_parent(dentry);
49 dir = parent->d_inode; 49 dir = d_inode(parent);
50 50
51 ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); 51 ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode);
52 err = PTR_ERR(ctx); 52 err = PTR_ERR(ctx);
@@ -74,7 +74,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
74 goto out_drop; 74 goto out_drop;
75 } 75 }
76 } 76 }
77 if (inode != dentry->d_inode) 77 if (inode != d_inode(dentry))
78 goto out_drop; 78 goto out_drop;
79 79
80 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 80 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 3d83cb1fdc70..f592672373cb 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -375,7 +375,7 @@ static struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *
375 dprintk("%s: getting locations for %pd2\n", 375 dprintk("%s: getting locations for %pd2\n",
376 __func__, dentry); 376 __func__, dentry);
377 377
378 err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page); 378 err = nfs4_proc_fs_locations(client, d_inode(parent), &dentry->d_name, fs_locations, page);
379 dput(parent); 379 dput(parent);
380 if (err != 0 || 380 if (err != 0 ||
381 fs_locations->nlocations <= 0 || 381 fs_locations->nlocations <= 0 ||
@@ -396,7 +396,7 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
396{ 396{
397 rpc_authflavor_t flavor = server->client->cl_auth->au_flavor; 397 rpc_authflavor_t flavor = server->client->cl_auth->au_flavor;
398 struct dentry *parent = dget_parent(dentry); 398 struct dentry *parent = dget_parent(dentry);
399 struct inode *dir = parent->d_inode; 399 struct inode *dir = d_inode(parent);
400 struct qstr *name = &dentry->d_name; 400 struct qstr *name = &dentry->d_name;
401 struct rpc_clnt *client; 401 struct rpc_clnt *client;
402 struct vfsmount *mnt; 402 struct vfsmount *mnt;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 627f37c44456..98e533f2c94a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -293,7 +293,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
293 *p++ = xdr_one; /* bitmap length */ 293 *p++ = xdr_one; /* bitmap length */
294 *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ 294 *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
295 *p++ = htonl(8); /* attribute buffer length */ 295 *p++ = htonl(8); /* attribute buffer length */
296 p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_inode)); 296 p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry)));
297 } 297 }
298 298
299 *p++ = xdr_one; /* next */ 299 *p++ = xdr_one; /* next */
@@ -305,7 +305,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
305 *p++ = xdr_one; /* bitmap length */ 305 *p++ = xdr_one; /* bitmap length */
306 *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ 306 *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
307 *p++ = htonl(8); /* attribute buffer length */ 307 *p++ = htonl(8); /* attribute buffer length */
308 p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_parent->d_inode)); 308 p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry->d_parent)));
309 309
310 readdir->pgbase = (char *)p - (char *)start; 310 readdir->pgbase = (char *)p - (char *)start;
311 readdir->count -= readdir->pgbase; 311 readdir->count -= readdir->pgbase;
@@ -1004,7 +1004,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
1004 gfp_t gfp_mask) 1004 gfp_t gfp_mask)
1005{ 1005{
1006 struct dentry *parent = dget_parent(dentry); 1006 struct dentry *parent = dget_parent(dentry);
1007 struct inode *dir = parent->d_inode; 1007 struct inode *dir = d_inode(parent);
1008 struct nfs_server *server = NFS_SERVER(dir); 1008 struct nfs_server *server = NFS_SERVER(dir);
1009 struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t); 1009 struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t);
1010 struct nfs4_opendata *p; 1010 struct nfs4_opendata *p;
@@ -1057,7 +1057,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
1057 case NFS4_OPEN_CLAIM_FH: 1057 case NFS4_OPEN_CLAIM_FH:
1058 case NFS4_OPEN_CLAIM_DELEG_CUR_FH: 1058 case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
1059 case NFS4_OPEN_CLAIM_DELEG_PREV_FH: 1059 case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
1060 p->o_arg.fh = NFS_FH(dentry->d_inode); 1060 p->o_arg.fh = NFS_FH(d_inode(dentry));
1061 } 1061 }
1062 if (attrs != NULL && attrs->ia_valid != 0) { 1062 if (attrs != NULL && attrs->ia_valid != 0) {
1063 __u32 verf[2]; 1063 __u32 verf[2];
@@ -1794,7 +1794,7 @@ static const struct rpc_call_ops nfs4_open_confirm_ops = {
1794 */ 1794 */
1795static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) 1795static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
1796{ 1796{
1797 struct nfs_server *server = NFS_SERVER(data->dir->d_inode); 1797 struct nfs_server *server = NFS_SERVER(d_inode(data->dir));
1798 struct rpc_task *task; 1798 struct rpc_task *task;
1799 struct rpc_message msg = { 1799 struct rpc_message msg = {
1800 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM], 1800 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM],
@@ -1951,7 +1951,7 @@ static const struct rpc_call_ops nfs4_open_ops = {
1951 1951
1952static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) 1952static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover)
1953{ 1953{
1954 struct inode *dir = data->dir->d_inode; 1954 struct inode *dir = d_inode(data->dir);
1955 struct nfs_server *server = NFS_SERVER(dir); 1955 struct nfs_server *server = NFS_SERVER(dir);
1956 struct nfs_openargs *o_arg = &data->o_arg; 1956 struct nfs_openargs *o_arg = &data->o_arg;
1957 struct nfs_openres *o_res = &data->o_res; 1957 struct nfs_openres *o_res = &data->o_res;
@@ -1998,7 +1998,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover)
1998 1998
1999static int _nfs4_recover_proc_open(struct nfs4_opendata *data) 1999static int _nfs4_recover_proc_open(struct nfs4_opendata *data)
2000{ 2000{
2001 struct inode *dir = data->dir->d_inode; 2001 struct inode *dir = d_inode(data->dir);
2002 struct nfs_openres *o_res = &data->o_res; 2002 struct nfs_openres *o_res = &data->o_res;
2003 int status; 2003 int status;
2004 2004
@@ -2067,7 +2067,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
2067 */ 2067 */
2068static int _nfs4_proc_open(struct nfs4_opendata *data) 2068static int _nfs4_proc_open(struct nfs4_opendata *data)
2069{ 2069{
2070 struct inode *dir = data->dir->d_inode; 2070 struct inode *dir = d_inode(data->dir);
2071 struct nfs_server *server = NFS_SERVER(dir); 2071 struct nfs_server *server = NFS_SERVER(dir);
2072 struct nfs_openargs *o_arg = &data->o_arg; 2072 struct nfs_openargs *o_arg = &data->o_arg;
2073 struct nfs_openres *o_res = &data->o_res; 2073 struct nfs_openres *o_res = &data->o_res;
@@ -2314,7 +2314,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
2314 set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); 2314 set_bit(NFS_STATE_POSIX_LOCKS, &state->flags);
2315 2315
2316 dentry = opendata->dentry; 2316 dentry = opendata->dentry;
2317 if (dentry->d_inode == NULL) { 2317 if (d_really_is_negative(dentry)) {
2318 /* FIXME: Is this d_drop() ever needed? */ 2318 /* FIXME: Is this d_drop() ever needed? */
2319 d_drop(dentry); 2319 d_drop(dentry);
2320 dentry = d_add_unique(dentry, igrab(state->inode)); 2320 dentry = d_add_unique(dentry, igrab(state->inode));
@@ -2325,7 +2325,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
2325 ctx->dentry = dget(dentry); 2325 ctx->dentry = dget(dentry);
2326 } 2326 }
2327 nfs_set_verifier(dentry, 2327 nfs_set_verifier(dentry,
2328 nfs_save_change_attribute(opendata->dir->d_inode)); 2328 nfs_save_change_attribute(d_inode(opendata->dir)));
2329 } 2329 }
2330 2330
2331 ret = nfs4_opendata_access(sp->so_cred, opendata, state, fmode, flags); 2331 ret = nfs4_opendata_access(sp->so_cred, opendata, state, fmode, flags);
@@ -2333,7 +2333,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
2333 goto out; 2333 goto out;
2334 2334
2335 ctx->state = state; 2335 ctx->state = state;
2336 if (dentry->d_inode == state->inode) { 2336 if (d_inode(dentry) == state->inode) {
2337 nfs_inode_attach_open_context(ctx); 2337 nfs_inode_attach_open_context(ctx);
2338 if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) 2338 if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
2339 nfs4_schedule_stateid_recovery(server, state); 2339 nfs4_schedule_stateid_recovery(server, state);
@@ -2374,10 +2374,10 @@ static int _nfs4_do_open(struct inode *dir,
2374 status = nfs4_recover_expired_lease(server); 2374 status = nfs4_recover_expired_lease(server);
2375 if (status != 0) 2375 if (status != 0)
2376 goto err_put_state_owner; 2376 goto err_put_state_owner;
2377 if (dentry->d_inode != NULL) 2377 if (d_really_is_positive(dentry))
2378 nfs4_return_incompatible_delegation(dentry->d_inode, fmode); 2378 nfs4_return_incompatible_delegation(d_inode(dentry), fmode);
2379 status = -ENOMEM; 2379 status = -ENOMEM;
2380 if (dentry->d_inode) 2380 if (d_really_is_positive(dentry))
2381 claim = NFS4_OPEN_CLAIM_FH; 2381 claim = NFS4_OPEN_CLAIM_FH;
2382 opendata = nfs4_opendata_alloc(dentry, sp, fmode, flags, sattr, 2382 opendata = nfs4_opendata_alloc(dentry, sp, fmode, flags, sattr,
2383 label, claim, GFP_KERNEL); 2383 label, claim, GFP_KERNEL);
@@ -2400,8 +2400,8 @@ static int _nfs4_do_open(struct inode *dir,
2400 } 2400 }
2401 opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0]; 2401 opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0];
2402 } 2402 }
2403 if (dentry->d_inode != NULL) 2403 if (d_really_is_positive(dentry))
2404 opendata->state = nfs4_get_open_state(dentry->d_inode, sp); 2404 opendata->state = nfs4_get_open_state(d_inode(dentry), sp);
2405 2405
2406 status = _nfs4_open_and_get_state(opendata, fmode, flags, ctx); 2406 status = _nfs4_open_and_get_state(opendata, fmode, flags, ctx);
2407 if (status != 0) 2407 if (status != 0)
@@ -3254,7 +3254,7 @@ static int
3254nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, 3254nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
3255 struct iattr *sattr) 3255 struct iattr *sattr)
3256{ 3256{
3257 struct inode *inode = dentry->d_inode; 3257 struct inode *inode = d_inode(dentry);
3258 struct rpc_cred *cred = NULL; 3258 struct rpc_cred *cred = NULL;
3259 struct nfs4_state *state = NULL; 3259 struct nfs4_state *state = NULL;
3260 struct nfs4_label *label = NULL; 3260 struct nfs4_label *label = NULL;
@@ -3871,13 +3871,13 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
3871static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, 3871static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
3872 u64 cookie, struct page **pages, unsigned int count, int plus) 3872 u64 cookie, struct page **pages, unsigned int count, int plus)
3873{ 3873{
3874 struct inode *dir = dentry->d_inode; 3874 struct inode *dir = d_inode(dentry);
3875 struct nfs4_readdir_arg args = { 3875 struct nfs4_readdir_arg args = {
3876 .fh = NFS_FH(dir), 3876 .fh = NFS_FH(dir),
3877 .pages = pages, 3877 .pages = pages,
3878 .pgbase = 0, 3878 .pgbase = 0,
3879 .count = count, 3879 .count = count,
3880 .bitmask = NFS_SERVER(dentry->d_inode)->attr_bitmask, 3880 .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask,
3881 .plus = plus, 3881 .plus = plus,
3882 }; 3882 };
3883 struct nfs4_readdir_res res; 3883 struct nfs4_readdir_res res;
@@ -3914,8 +3914,8 @@ static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
3914 do { 3914 do {
3915 err = _nfs4_proc_readdir(dentry, cred, cookie, 3915 err = _nfs4_proc_readdir(dentry, cred, cookie,
3916 pages, count, plus); 3916 pages, count, plus);
3917 trace_nfs4_readdir(dentry->d_inode, err); 3917 trace_nfs4_readdir(d_inode(dentry), err);
3918 err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), err, 3918 err = nfs4_handle_exception(NFS_SERVER(d_inode(dentry)), err,
3919 &exception); 3919 &exception);
3920 } while (exception.retry); 3920 } while (exception.retry);
3921 return err; 3921 return err;
@@ -4830,7 +4830,7 @@ nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen)
4830 struct nfs4_label ilabel, *olabel = NULL; 4830 struct nfs4_label ilabel, *olabel = NULL;
4831 struct nfs_fattr fattr; 4831 struct nfs_fattr fattr;
4832 struct rpc_cred *cred; 4832 struct rpc_cred *cred;
4833 struct inode *inode = dentry->d_inode; 4833 struct inode *inode = d_inode(dentry);
4834 int status; 4834 int status;
4835 4835
4836 if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) 4836 if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL))
@@ -5670,7 +5670,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
5670 data->rpc_status = task->tk_status; 5670 data->rpc_status = task->tk_status;
5671 switch (task->tk_status) { 5671 switch (task->tk_status) {
5672 case 0: 5672 case 0:
5673 renew_lease(NFS_SERVER(data->ctx->dentry->d_inode), 5673 renew_lease(NFS_SERVER(d_inode(data->ctx->dentry)),
5674 data->timestamp); 5674 data->timestamp);
5675 if (data->arg.new_lock) { 5675 if (data->arg.new_lock) {
5676 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); 5676 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS);
@@ -6112,7 +6112,7 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
6112 if (strcmp(key, "") != 0) 6112 if (strcmp(key, "") != 0)
6113 return -EINVAL; 6113 return -EINVAL;
6114 6114
6115 return nfs4_proc_set_acl(dentry->d_inode, buf, buflen); 6115 return nfs4_proc_set_acl(d_inode(dentry), buf, buflen);
6116} 6116}
6117 6117
6118static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, 6118static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
@@ -6121,7 +6121,7 @@ static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
6121 if (strcmp(key, "") != 0) 6121 if (strcmp(key, "") != 0)
6122 return -EINVAL; 6122 return -EINVAL;
6123 6123
6124 return nfs4_proc_get_acl(dentry->d_inode, buf, buflen); 6124 return nfs4_proc_get_acl(d_inode(dentry), buf, buflen);
6125} 6125}
6126 6126
6127static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, 6127static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
@@ -6130,7 +6130,7 @@ static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
6130{ 6130{
6131 size_t len = sizeof(XATTR_NAME_NFSV4_ACL); 6131 size_t len = sizeof(XATTR_NAME_NFSV4_ACL);
6132 6132
6133 if (!nfs4_server_supports_acls(NFS_SERVER(dentry->d_inode))) 6133 if (!nfs4_server_supports_acls(NFS_SERVER(d_inode(dentry))))
6134 return 0; 6134 return 0;
6135 6135
6136 if (list && len <= list_len) 6136 if (list && len <= list_len)
@@ -6158,7 +6158,7 @@ static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key,
6158 void *buf, size_t buflen, int type) 6158 void *buf, size_t buflen, int type)
6159{ 6159{
6160 if (security_ismaclabel(key)) 6160 if (security_ismaclabel(key))
6161 return nfs4_get_security_label(dentry->d_inode, buf, buflen); 6161 return nfs4_get_security_label(d_inode(dentry), buf, buflen);
6162 return -EOPNOTSUPP; 6162 return -EOPNOTSUPP;
6163} 6163}
6164 6164
@@ -6168,10 +6168,10 @@ static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list,
6168{ 6168{
6169 size_t len = 0; 6169 size_t len = 0;
6170 6170
6171 if (nfs_server_capable(dentry->d_inode, NFS_CAP_SECURITY_LABEL)) { 6171 if (nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) {
6172 len = security_inode_listsecurity(dentry->d_inode, NULL, 0); 6172 len = security_inode_listsecurity(d_inode(dentry), NULL, 0);
6173 if (list && len <= list_len) 6173 if (list && len <= list_len)
6174 security_inode_listsecurity(dentry->d_inode, list, len); 6174 security_inode_listsecurity(d_inode(dentry), list, len);
6175 } 6175 }
6176 return len; 6176 return len;
6177} 6177}
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index f95e3b58bbc3..3b2b20534a3a 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1902,7 +1902,7 @@ static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred)
1902 goto out; 1902 goto out;
1903 } 1903 }
1904 1904
1905 inode = server->super->s_root->d_inode; 1905 inode = d_inode(server->super->s_root);
1906 result = nfs4_proc_get_locations(inode, locations, page, cred); 1906 result = nfs4_proc_get_locations(inode, locations, page, cred);
1907 if (result) { 1907 if (result) {
1908 dprintk("<-- %s: failed to retrieve fs_locations: %d\n", 1908 dprintk("<-- %s: failed to retrieve fs_locations: %d\n",
@@ -2021,7 +2021,7 @@ restart:
2021 2021
2022 rcu_read_unlock(); 2022 rcu_read_unlock();
2023 2023
2024 inode = server->super->s_root->d_inode; 2024 inode = d_inode(server->super->s_root);
2025 status = nfs4_proc_fsid_present(inode, cred); 2025 status = nfs4_proc_fsid_present(inode, cred);
2026 if (status != -NFS4ERR_MOVED) 2026 if (status != -NFS4ERR_MOVED)
2027 goto restart; /* wasn't this one */ 2027 goto restart; /* wasn't this one */
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 1c32adbe728d..470af1a78bec 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -418,7 +418,7 @@ DECLARE_EVENT_CLASS(nfs4_open_event,
418 __entry->fileid = 0; 418 __entry->fileid = 0;
419 __entry->fhandle = 0; 419 __entry->fhandle = 0;
420 } 420 }
421 __entry->dir = NFS_FILEID(ctx->dentry->d_parent->d_inode); 421 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
422 __assign_str(name, ctx->dentry->d_name.name); 422 __assign_str(name, ctx->dentry->d_name.name);
423 ), 423 ),
424 424
@@ -1110,7 +1110,7 @@ TRACE_EVENT(nfs4_layoutget,
1110 ), 1110 ),
1111 1111
1112 TP_fast_assign( 1112 TP_fast_assign(
1113 const struct inode *inode = ctx->dentry->d_inode; 1113 const struct inode *inode = d_inode(ctx->dentry);
1114 __entry->dev = inode->i_sb->s_dev; 1114 __entry->dev = inode->i_sb->s_dev;
1115 __entry->fileid = NFS_FILEID(inode); 1115 __entry->fileid = NFS_FILEID(inode);
1116 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1116 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index d57190a0d533..282b39369510 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -938,7 +938,7 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
938 if (prev) { 938 if (prev) {
939 if (!nfs_match_open_context(req->wb_context, prev->wb_context)) 939 if (!nfs_match_open_context(req->wb_context, prev->wb_context))
940 return false; 940 return false;
941 flctx = req->wb_context->dentry->d_inode->i_flctx; 941 flctx = d_inode(req->wb_context->dentry)->i_flctx;
942 if (flctx != NULL && 942 if (flctx != NULL &&
943 !(list_empty_careful(&flctx->flc_posix) && 943 !(list_empty_careful(&flctx->flc_posix) &&
944 list_empty_careful(&flctx->flc_flock)) && 944 list_empty_careful(&flctx->flc_flock)) &&
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 635f0865671c..084c9144f86d 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -426,7 +426,7 @@ static inline bool
426pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 426pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
427 struct nfs_commit_info *cinfo, u32 ds_commit_idx) 427 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
428{ 428{
429 struct inode *inode = req->wb_context->dentry->d_inode; 429 struct inode *inode = d_inode(req->wb_context->dentry);
430 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; 430 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
431 431
432 if (lseg == NULL || ld->mark_request_commit == NULL) 432 if (lseg == NULL || ld->mark_request_commit == NULL)
@@ -438,7 +438,7 @@ pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
438static inline bool 438static inline bool
439pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) 439pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo)
440{ 440{
441 struct inode *inode = req->wb_context->dentry->d_inode; 441 struct inode *inode = d_inode(req->wb_context->dentry);
442 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; 442 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
443 443
444 if (ld == NULL || ld->clear_request_commit == NULL) 444 if (ld == NULL || ld->clear_request_commit == NULL)
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index c63189acd052..b417bbcd9704 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -118,7 +118,7 @@ static int
118nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, 118nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
119 struct iattr *sattr) 119 struct iattr *sattr)
120{ 120{
121 struct inode *inode = dentry->d_inode; 121 struct inode *inode = d_inode(dentry);
122 struct nfs_sattrargs arg = { 122 struct nfs_sattrargs arg = {
123 .fh = NFS_FH(inode), 123 .fh = NFS_FH(inode),
124 .sattr = sattr 124 .sattr = sattr
@@ -487,7 +487,7 @@ static int
487nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, 487nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
488 u64 cookie, struct page **pages, unsigned int count, int plus) 488 u64 cookie, struct page **pages, unsigned int count, int plus)
489{ 489{
490 struct inode *dir = dentry->d_inode; 490 struct inode *dir = d_inode(dentry);
491 struct nfs_readdirargs arg = { 491 struct nfs_readdirargs arg = {
492 .fh = NFS_FH(dir), 492 .fh = NFS_FH(dir),
493 .cookie = cookie, 493 .cookie = cookie,
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index b8f5c63f77b2..a5b7427c3754 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -117,7 +117,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
117 117
118static void nfs_readpage_release(struct nfs_page *req) 118static void nfs_readpage_release(struct nfs_page *req)
119{ 119{
120 struct inode *inode = req->wb_context->dentry->d_inode; 120 struct inode *inode = d_inode(req->wb_context->dentry);
121 121
122 dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id, 122 dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id,
123 (unsigned long long)NFS_FILEID(inode), req->wb_bytes, 123 (unsigned long long)NFS_FILEID(inode), req->wb_bytes,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 322b2de02988..21f8f52bf37d 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -433,7 +433,7 @@ int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
433 struct nfs_server *server = NFS_SB(dentry->d_sb); 433 struct nfs_server *server = NFS_SB(dentry->d_sb);
434 unsigned char blockbits; 434 unsigned char blockbits;
435 unsigned long blockres; 435 unsigned long blockres;
436 struct nfs_fh *fh = NFS_FH(dentry->d_inode); 436 struct nfs_fh *fh = NFS_FH(d_inode(dentry));
437 struct nfs_fsstat res; 437 struct nfs_fsstat res;
438 int error = -ENOMEM; 438 int error = -ENOMEM;
439 439
@@ -447,7 +447,7 @@ int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
447 447
448 pd_dentry = dget_parent(dentry); 448 pd_dentry = dget_parent(dentry);
449 if (pd_dentry != NULL) { 449 if (pd_dentry != NULL) {
450 nfs_zap_caches(pd_dentry->d_inode); 450 nfs_zap_caches(d_inode(pd_dentry));
451 dput(pd_dentry); 451 dput(pd_dentry);
452 } 452 }
453 } 453 }
@@ -2526,7 +2526,7 @@ int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot,
2526 struct nfs_mount_info *mount_info) 2526 struct nfs_mount_info *mount_info)
2527{ 2527{
2528 /* clone any lsm security options from the parent to the new sb */ 2528 /* clone any lsm security options from the parent to the new sb */
2529 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) 2529 if (d_inode(mntroot)->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops)
2530 return -ESTALE; 2530 return -ESTALE;
2531 return security_sb_clone_mnt_opts(mount_info->cloned->sb, s); 2531 return security_sb_clone_mnt_opts(mount_info->cloned->sb, s);
2532} 2532}
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 05c9e02f4153..2d56200655fe 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -45,7 +45,7 @@ error:
45 45
46static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd) 46static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd)
47{ 47{
48 struct inode *inode = dentry->d_inode; 48 struct inode *inode = d_inode(dentry);
49 struct page *page; 49 struct page *page;
50 void *err; 50 void *err;
51 51
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index de54129336c6..fa538b2ba251 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -143,7 +143,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
143 nfs_free_dname(data); 143 nfs_free_dname(data);
144 ret = nfs_copy_dname(alias, data); 144 ret = nfs_copy_dname(alias, data);
145 spin_lock(&alias->d_lock); 145 spin_lock(&alias->d_lock);
146 if (ret == 0 && alias->d_inode != NULL && 146 if (ret == 0 && d_really_is_positive(alias) &&
147 !(alias->d_flags & DCACHE_NFSFS_RENAMED)) { 147 !(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
148 devname_garbage = alias->d_fsdata; 148 devname_garbage = alias->d_fsdata;
149 alias->d_fsdata = data; 149 alias->d_fsdata = data;
@@ -190,7 +190,7 @@ static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data)
190 parent = dget_parent(dentry); 190 parent = dget_parent(dentry);
191 if (parent == NULL) 191 if (parent == NULL)
192 goto out_free; 192 goto out_free;
193 dir = parent->d_inode; 193 dir = d_inode(parent);
194 /* Non-exclusive lock protects against concurrent lookup() calls */ 194 /* Non-exclusive lock protects against concurrent lookup() calls */
195 spin_lock(&dir->i_lock); 195 spin_lock(&dir->i_lock);
196 if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) { 196 if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) {
@@ -210,21 +210,21 @@ out_free:
210 210
211void nfs_wait_on_sillyrename(struct dentry *dentry) 211void nfs_wait_on_sillyrename(struct dentry *dentry)
212{ 212{
213 struct nfs_inode *nfsi = NFS_I(dentry->d_inode); 213 struct nfs_inode *nfsi = NFS_I(d_inode(dentry));
214 214
215 wait_event(nfsi->waitqueue, atomic_read(&nfsi->silly_count) <= 1); 215 wait_event(nfsi->waitqueue, atomic_read(&nfsi->silly_count) <= 1);
216} 216}
217 217
218void nfs_block_sillyrename(struct dentry *dentry) 218void nfs_block_sillyrename(struct dentry *dentry)
219{ 219{
220 struct nfs_inode *nfsi = NFS_I(dentry->d_inode); 220 struct nfs_inode *nfsi = NFS_I(d_inode(dentry));
221 221
222 wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1); 222 wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1);
223} 223}
224 224
225void nfs_unblock_sillyrename(struct dentry *dentry) 225void nfs_unblock_sillyrename(struct dentry *dentry)
226{ 226{
227 struct inode *dir = dentry->d_inode; 227 struct inode *dir = d_inode(dentry);
228 struct nfs_inode *nfsi = NFS_I(dir); 228 struct nfs_inode *nfsi = NFS_I(dir);
229 struct nfs_unlinkdata *data; 229 struct nfs_unlinkdata *data;
230 230
@@ -367,8 +367,8 @@ static void nfs_async_rename_release(void *calldata)
367 struct nfs_renamedata *data = calldata; 367 struct nfs_renamedata *data = calldata;
368 struct super_block *sb = data->old_dir->i_sb; 368 struct super_block *sb = data->old_dir->i_sb;
369 369
370 if (data->old_dentry->d_inode) 370 if (d_really_is_positive(data->old_dentry))
371 nfs_mark_for_revalidate(data->old_dentry->d_inode); 371 nfs_mark_for_revalidate(d_inode(data->old_dentry));
372 372
373 dput(data->old_dentry); 373 dput(data->old_dentry);
374 dput(data->new_dentry); 374 dput(data->new_dentry);
@@ -529,10 +529,10 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
529 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) 529 if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
530 goto out; 530 goto out;
531 531
532 fileid = NFS_FILEID(dentry->d_inode); 532 fileid = NFS_FILEID(d_inode(dentry));
533 533
534 /* Return delegation in anticipation of the rename */ 534 /* Return delegation in anticipation of the rename */
535 NFS_PROTO(dentry->d_inode)->return_delegation(dentry->d_inode); 535 NFS_PROTO(d_inode(dentry))->return_delegation(d_inode(dentry));
536 536
537 sdentry = NULL; 537 sdentry = NULL;
538 do { 538 do {
@@ -554,7 +554,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
554 */ 554 */
555 if (IS_ERR(sdentry)) 555 if (IS_ERR(sdentry))
556 goto out; 556 goto out;
557 } while (sdentry->d_inode != NULL); /* need negative lookup */ 557 } while (d_inode(sdentry) != NULL); /* need negative lookup */
558 558
559 /* queue unlink first. Can't do this from rpc_release as it 559 /* queue unlink first. Can't do this from rpc_release as it
560 * has to allocate memory 560 * has to allocate memory
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 849ed784d6ac..e8f675d4b2fb 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -702,7 +702,7 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
702 */ 702 */
703static void nfs_inode_remove_request(struct nfs_page *req) 703static void nfs_inode_remove_request(struct nfs_page *req)
704{ 704{
705 struct inode *inode = req->wb_context->dentry->d_inode; 705 struct inode *inode = d_inode(req->wb_context->dentry);
706 struct nfs_inode *nfsi = NFS_I(inode); 706 struct nfs_inode *nfsi = NFS_I(inode);
707 struct nfs_page *head; 707 struct nfs_page *head;
708 708
@@ -861,7 +861,7 @@ static void
861nfs_clear_request_commit(struct nfs_page *req) 861nfs_clear_request_commit(struct nfs_page *req)
862{ 862{
863 if (test_bit(PG_CLEAN, &req->wb_flags)) { 863 if (test_bit(PG_CLEAN, &req->wb_flags)) {
864 struct inode *inode = req->wb_context->dentry->d_inode; 864 struct inode *inode = d_inode(req->wb_context->dentry);
865 struct nfs_commit_info cinfo; 865 struct nfs_commit_info cinfo;
866 866
867 nfs_init_cinfo_from_inode(&cinfo, inode); 867 nfs_init_cinfo_from_inode(&cinfo, inode);
@@ -1591,7 +1591,7 @@ void nfs_init_commit(struct nfs_commit_data *data,
1591 struct nfs_commit_info *cinfo) 1591 struct nfs_commit_info *cinfo)
1592{ 1592{
1593 struct nfs_page *first = nfs_list_entry(head->next); 1593 struct nfs_page *first = nfs_list_entry(head->next);
1594 struct inode *inode = first->wb_context->dentry->d_inode; 1594 struct inode *inode = d_inode(first->wb_context->dentry);
1595 1595
1596 /* Set up the RPC argument and reply structs 1596 /* Set up the RPC argument and reply structs
1597 * NB: take care not to mess about with data->commit et al. */ 1597 * NB: take care not to mess about with data->commit et al. */
@@ -1690,7 +1690,7 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data)
1690 1690
1691 dprintk("NFS: commit (%s/%llu %d@%lld)", 1691 dprintk("NFS: commit (%s/%llu %d@%lld)",
1692 req->wb_context->dentry->d_sb->s_id, 1692 req->wb_context->dentry->d_sb->s_id,
1693 (unsigned long long)NFS_FILEID(req->wb_context->dentry->d_inode), 1693 (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)),
1694 req->wb_bytes, 1694 req->wb_bytes,
1695 (long long)req_offset(req)); 1695 (long long)req_offset(req));
1696 if (status < 0) { 1696 if (status < 0) {
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index c3e3b6e55ae2..77c4c723534c 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -599,7 +599,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
599 goto out4; 599 goto out4;
600 } 600 }
601 601
602 err = check_export(exp.ex_path.dentry->d_inode, &exp.ex_flags, 602 err = check_export(d_inode(exp.ex_path.dentry), &exp.ex_flags,
603 exp.ex_uuid); 603 exp.ex_uuid);
604 if (err) 604 if (err)
605 goto out4; 605 goto out4;
@@ -891,7 +891,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
891 printk("nfsd: exp_rootfh path not found %s", name); 891 printk("nfsd: exp_rootfh path not found %s", name);
892 return err; 892 return err;
893 } 893 }
894 inode = path.dentry->d_inode; 894 inode = d_inode(path.dentry);
895 895
896 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 896 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
897 name, path.dentry, clp->name, 897 name, path.dentry, clp->name,
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index ac54ea60b3f6..d54701f6dc78 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -42,7 +42,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
42 if (nfserr) 42 if (nfserr)
43 RETURN_STATUS(nfserr); 43 RETURN_STATUS(nfserr);
44 44
45 inode = fh->fh_dentry->d_inode; 45 inode = d_inode(fh->fh_dentry);
46 46
47 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 47 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
48 RETURN_STATUS(nfserr_inval); 48 RETURN_STATUS(nfserr_inval);
@@ -103,7 +103,7 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
103 if (nfserr) 103 if (nfserr)
104 goto out; 104 goto out;
105 105
106 inode = fh->fh_dentry->d_inode; 106 inode = d_inode(fh->fh_dentry);
107 if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { 107 if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) {
108 error = -EOPNOTSUPP; 108 error = -EOPNOTSUPP;
109 goto out_errno; 109 goto out_errno;
@@ -266,9 +266,9 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
266 * nfsd_dispatch actually ensures the following cannot happen. 266 * nfsd_dispatch actually ensures the following cannot happen.
267 * However, it seems fragile to depend on that. 267 * However, it seems fragile to depend on that.
268 */ 268 */
269 if (dentry == NULL || dentry->d_inode == NULL) 269 if (dentry == NULL || d_really_is_negative(dentry))
270 return 0; 270 return 0;
271 inode = dentry->d_inode; 271 inode = d_inode(dentry);
272 272
273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); 273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
274 *p++ = htonl(resp->mask); 274 *p++ = htonl(resp->mask);
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index 34cbbab6abd7..882b1a14bc3e 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -39,7 +39,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
39 if (nfserr) 39 if (nfserr)
40 RETURN_STATUS(nfserr); 40 RETURN_STATUS(nfserr);
41 41
42 inode = fh->fh_dentry->d_inode; 42 inode = d_inode(fh->fh_dentry);
43 43
44 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 44 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
45 RETURN_STATUS(nfserr_inval); 45 RETURN_STATUS(nfserr_inval);
@@ -94,7 +94,7 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp,
94 if (nfserr) 94 if (nfserr)
95 goto out; 95 goto out;
96 96
97 inode = fh->fh_dentry->d_inode; 97 inode = d_inode(fh->fh_dentry);
98 if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { 98 if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) {
99 error = -EOPNOTSUPP; 99 error = -EOPNOTSUPP;
100 goto out_errno; 100 goto out_errno;
@@ -174,8 +174,8 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
174 struct dentry *dentry = resp->fh.fh_dentry; 174 struct dentry *dentry = resp->fh.fh_dentry;
175 175
176 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 176 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
177 if (resp->status == 0 && dentry && dentry->d_inode) { 177 if (resp->status == 0 && dentry && d_really_is_positive(dentry)) {
178 struct inode *inode = dentry->d_inode; 178 struct inode *inode = d_inode(dentry);
179 struct kvec *head = rqstp->rq_res.head; 179 struct kvec *head = rqstp->rq_res.head;
180 unsigned int base; 180 unsigned int base;
181 int n; 181 int n;
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 12f2aab4f614..7b755b7f785c 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -166,7 +166,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
166 rqstp->rq_vec, argp->vlen, 166 rqstp->rq_vec, argp->vlen,
167 &resp->count); 167 &resp->count);
168 if (nfserr == 0) { 168 if (nfserr == 0) {
169 struct inode *inode = resp->fh.fh_dentry->d_inode; 169 struct inode *inode = d_inode(resp->fh.fh_dentry);
170 170
171 resp->eof = (argp->offset + resp->count) >= inode->i_size; 171 resp->eof = (argp->offset + resp->count) >= inode->i_size;
172 } 172 }
@@ -551,7 +551,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
551 * different read/write sizes for file systems known to have 551 * different read/write sizes for file systems known to have
552 * problems with large blocks */ 552 * problems with large blocks */
553 if (nfserr == 0) { 553 if (nfserr == 0) {
554 struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; 554 struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb;
555 555
556 /* Note that we don't care for remote fs's here */ 556 /* Note that we don't care for remote fs's here */
557 if (sb->s_magic == MSDOS_SUPER_MAGIC) { 557 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
@@ -587,7 +587,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
587 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); 587 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
588 588
589 if (nfserr == 0) { 589 if (nfserr == 0) {
590 struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; 590 struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb;
591 591
592 /* Note that we don't care for remote fs's here */ 592 /* Note that we don't care for remote fs's here */
593 switch (sb->s_magic) { 593 switch (sb->s_magic) {
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 39c5eb3ad33a..e4b2b4322553 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
146 default: 146 default:
147 case FSIDSOURCE_DEV: 147 case FSIDSOURCE_DEV:
148 p = xdr_encode_hyper(p, (u64)huge_encode_dev 148 p = xdr_encode_hyper(p, (u64)huge_encode_dev
149 (fhp->fh_dentry->d_inode->i_sb->s_dev)); 149 (d_inode(fhp->fh_dentry)->i_sb->s_dev));
150 break; 150 break;
151 case FSIDSOURCE_FSID: 151 case FSIDSOURCE_FSID:
152 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); 152 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
@@ -203,14 +203,14 @@ static __be32 *
203encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 203encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
204{ 204{
205 struct dentry *dentry = fhp->fh_dentry; 205 struct dentry *dentry = fhp->fh_dentry;
206 if (dentry && dentry->d_inode) { 206 if (dentry && d_really_is_positive(dentry)) {
207 __be32 err; 207 __be32 err;
208 struct kstat stat; 208 struct kstat stat;
209 209
210 err = fh_getattr(fhp, &stat); 210 err = fh_getattr(fhp, &stat);
211 if (!err) { 211 if (!err) {
212 *p++ = xdr_one; /* attributes follow */ 212 *p++ = xdr_one; /* attributes follow */
213 lease_get_mtime(dentry->d_inode, &stat.mtime); 213 lease_get_mtime(d_inode(dentry), &stat.mtime);
214 return encode_fattr3(rqstp, p, fhp, &stat); 214 return encode_fattr3(rqstp, p, fhp, &stat);
215 } 215 }
216 } 216 }
@@ -233,7 +233,7 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
233{ 233{
234 struct dentry *dentry = fhp->fh_dentry; 234 struct dentry *dentry = fhp->fh_dentry;
235 235
236 if (dentry && dentry->d_inode && fhp->fh_post_saved) { 236 if (dentry && d_really_is_positive(dentry) && fhp->fh_post_saved) {
237 if (fhp->fh_pre_saved) { 237 if (fhp->fh_pre_saved) {
238 *p++ = xdr_one; 238 *p++ = xdr_one;
239 p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size); 239 p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size);
@@ -260,11 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp)
260 printk("nfsd: inode locked twice during operation.\n"); 260 printk("nfsd: inode locked twice during operation.\n");
261 261
262 err = fh_getattr(fhp, &fhp->fh_post_attr); 262 err = fh_getattr(fhp, &fhp->fh_post_attr);
263 fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; 263 fhp->fh_post_change = d_inode(fhp->fh_dentry)->i_version;
264 if (err) { 264 if (err) {
265 fhp->fh_post_saved = 0; 265 fhp->fh_post_saved = 0;
266 /* Grab the ctime anyway - set_change_info might use it */ 266 /* Grab the ctime anyway - set_change_info might use it */
267 fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; 267 fhp->fh_post_attr.ctime = d_inode(fhp->fh_dentry)->i_ctime;
268 } else 268 } else
269 fhp->fh_post_saved = 1; 269 fhp->fh_post_saved = 1;
270} 270}
@@ -628,7 +628,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
628 struct nfsd3_attrstat *resp) 628 struct nfsd3_attrstat *resp)
629{ 629{
630 if (resp->status == 0) { 630 if (resp->status == 0) {
631 lease_get_mtime(resp->fh.fh_dentry->d_inode, 631 lease_get_mtime(d_inode(resp->fh.fh_dentry),
632 &resp->stat.mtime); 632 &resp->stat.mtime);
633 p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat); 633 p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat);
634 } 634 }
@@ -828,7 +828,7 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
828 return rv; 828 return rv;
829 if (d_mountpoint(dchild)) 829 if (d_mountpoint(dchild))
830 goto out; 830 goto out;
831 if (!dchild->d_inode) 831 if (d_really_is_negative(dchild))
832 goto out; 832 goto out;
833 rv = fh_compose(fhp, exp, dchild, &cd->fh); 833 rv = fh_compose(fhp, exp, dchild, &cd->fh);
834out: 834out:
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 59fd76651781..64466dcc71d1 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -139,7 +139,7 @@ int
139nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, 139nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
140 struct nfs4_acl **acl) 140 struct nfs4_acl **acl)
141{ 141{
142 struct inode *inode = dentry->d_inode; 142 struct inode *inode = d_inode(dentry);
143 int error = 0; 143 int error = 0;
144 struct posix_acl *pacl = NULL, *dpacl = NULL; 144 struct posix_acl *pacl = NULL, *dpacl = NULL;
145 unsigned int flags = 0; 145 unsigned int flags = 0;
@@ -828,7 +828,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
828 return error; 828 return error;
829 829
830 dentry = fhp->fh_dentry; 830 dentry = fhp->fh_dentry;
831 inode = dentry->d_inode; 831 inode = d_inode(dentry);
832 832
833 if (!inode->i_op->set_acl || !IS_POSIXACL(inode)) 833 if (!inode->i_op->set_acl || !IS_POSIXACL(inode))
834 return nfserr_attrnotsupp; 834 return nfserr_attrnotsupp;
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 92b9d97aff4f..000f962d15f1 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -52,7 +52,7 @@
52static inline void 52static inline void
53nfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval) 53nfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval)
54{ 54{
55 struct inode *inode = resfh->fh_dentry->d_inode; 55 struct inode *inode = d_inode(resfh->fh_dentry);
56 int status; 56 int status;
57 57
58 mutex_lock(&inode->i_mutex); 58 mutex_lock(&inode->i_mutex);
@@ -110,7 +110,7 @@ check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
110 * in current environment or not. 110 * in current environment or not.
111 */ 111 */
112 if (bmval[0] & FATTR4_WORD0_ACL) { 112 if (bmval[0] & FATTR4_WORD0_ACL) {
113 if (!IS_POSIXACL(dentry->d_inode)) 113 if (!IS_POSIXACL(d_inode(dentry)))
114 return nfserr_attrnotsupp; 114 return nfserr_attrnotsupp;
115 } 115 }
116 116
@@ -209,7 +209,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
209 209
210static __be32 nfsd_check_obj_isreg(struct svc_fh *fh) 210static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
211{ 211{
212 umode_t mode = fh->fh_dentry->d_inode->i_mode; 212 umode_t mode = d_inode(fh->fh_dentry)->i_mode;
213 213
214 if (S_ISREG(mode)) 214 if (S_ISREG(mode))
215 return nfs_ok; 215 return nfs_ok;
@@ -881,7 +881,7 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
881 &exp, &dentry); 881 &exp, &dentry);
882 if (err) 882 if (err)
883 return err; 883 return err;
884 if (dentry->d_inode == NULL) { 884 if (d_really_is_negative(dentry)) {
885 exp_put(exp); 885 exp_put(exp);
886 err = nfserr_noent; 886 err = nfserr_noent;
887 } else 887 } else
@@ -1308,7 +1308,7 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
1308 if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls)) 1308 if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls))
1309 goto out_put_stid; 1309 goto out_put_stid;
1310 1310
1311 nfserr = ops->proc_layoutget(current_fh->fh_dentry->d_inode, 1311 nfserr = ops->proc_layoutget(d_inode(current_fh->fh_dentry),
1312 current_fh, lgp); 1312 current_fh, lgp);
1313 if (nfserr) 1313 if (nfserr)
1314 goto out_put_stid; 1314 goto out_put_stid;
@@ -1342,7 +1342,7 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
1342 ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type); 1342 ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type);
1343 if (!ops) 1343 if (!ops)
1344 goto out; 1344 goto out;
1345 inode = current_fh->fh_dentry->d_inode; 1345 inode = d_inode(current_fh->fh_dentry);
1346 1346
1347 nfserr = nfserr_inval; 1347 nfserr = nfserr_inval;
1348 if (new_size <= seg->offset) { 1348 if (new_size <= seg->offset) {
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1c307f02baa8..d88ea7b9a85c 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -192,14 +192,14 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
192 192
193 dir = nn->rec_file->f_path.dentry; 193 dir = nn->rec_file->f_path.dentry;
194 /* lock the parent */ 194 /* lock the parent */
195 mutex_lock(&dir->d_inode->i_mutex); 195 mutex_lock(&d_inode(dir)->i_mutex);
196 196
197 dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); 197 dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1);
198 if (IS_ERR(dentry)) { 198 if (IS_ERR(dentry)) {
199 status = PTR_ERR(dentry); 199 status = PTR_ERR(dentry);
200 goto out_unlock; 200 goto out_unlock;
201 } 201 }
202 if (dentry->d_inode) 202 if (d_really_is_positive(dentry))
203 /* 203 /*
204 * In the 4.1 case, where we're called from 204 * In the 4.1 case, where we're called from
205 * reclaim_complete(), records from the previous reboot 205 * reclaim_complete(), records from the previous reboot
@@ -209,11 +209,11 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
209 * as well be forgiving and just succeed silently. 209 * as well be forgiving and just succeed silently.
210 */ 210 */
211 goto out_put; 211 goto out_put;
212 status = vfs_mkdir(dir->d_inode, dentry, S_IRWXU); 212 status = vfs_mkdir(d_inode(dir), dentry, S_IRWXU);
213out_put: 213out_put:
214 dput(dentry); 214 dput(dentry);
215out_unlock: 215out_unlock:
216 mutex_unlock(&dir->d_inode->i_mutex); 216 mutex_unlock(&d_inode(dir)->i_mutex);
217 if (status == 0) { 217 if (status == 0) {
218 if (nn->in_grace) { 218 if (nn->in_grace) {
219 crp = nfs4_client_to_reclaim(dname, nn); 219 crp = nfs4_client_to_reclaim(dname, nn);
@@ -285,7 +285,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn)
285 } 285 }
286 286
287 status = iterate_dir(nn->rec_file, &ctx.ctx); 287 status = iterate_dir(nn->rec_file, &ctx.ctx);
288 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 288 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
289 while (!list_empty(&ctx.names)) { 289 while (!list_empty(&ctx.names)) {
290 struct name_list *entry; 290 struct name_list *entry;
291 entry = list_entry(ctx.names.next, struct name_list, list); 291 entry = list_entry(ctx.names.next, struct name_list, list);
@@ -302,7 +302,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn)
302 list_del(&entry->list); 302 list_del(&entry->list);
303 kfree(entry); 303 kfree(entry);
304 } 304 }
305 mutex_unlock(&dir->d_inode->i_mutex); 305 mutex_unlock(&d_inode(dir)->i_mutex);
306 nfs4_reset_creds(original_cred); 306 nfs4_reset_creds(original_cred);
307 return status; 307 return status;
308} 308}
@@ -316,20 +316,20 @@ nfsd4_unlink_clid_dir(char *name, int namlen, struct nfsd_net *nn)
316 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 316 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
317 317
318 dir = nn->rec_file->f_path.dentry; 318 dir = nn->rec_file->f_path.dentry;
319 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 319 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
320 dentry = lookup_one_len(name, dir, namlen); 320 dentry = lookup_one_len(name, dir, namlen);
321 if (IS_ERR(dentry)) { 321 if (IS_ERR(dentry)) {
322 status = PTR_ERR(dentry); 322 status = PTR_ERR(dentry);
323 goto out_unlock; 323 goto out_unlock;
324 } 324 }
325 status = -ENOENT; 325 status = -ENOENT;
326 if (!dentry->d_inode) 326 if (d_really_is_negative(dentry))
327 goto out; 327 goto out;
328 status = vfs_rmdir(dir->d_inode, dentry); 328 status = vfs_rmdir(d_inode(dir), dentry);
329out: 329out:
330 dput(dentry); 330 dput(dentry);
331out_unlock: 331out_unlock:
332 mutex_unlock(&dir->d_inode->i_mutex); 332 mutex_unlock(&d_inode(dir)->i_mutex);
333 return status; 333 return status;
334} 334}
335 335
@@ -385,7 +385,7 @@ purge_old(struct dentry *parent, struct dentry *child, struct nfsd_net *nn)
385 if (nfs4_has_reclaimed_state(child->d_name.name, nn)) 385 if (nfs4_has_reclaimed_state(child->d_name.name, nn))
386 return 0; 386 return 0;
387 387
388 status = vfs_rmdir(parent->d_inode, child); 388 status = vfs_rmdir(d_inode(parent), child);
389 if (status) 389 if (status)
390 printk("failed to remove client recovery directory %pd\n", 390 printk("failed to remove client recovery directory %pd\n",
391 child); 391 child);
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8ba1d888f1e6..7e08aabd56e5 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4473,7 +4473,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
4473 struct nfs4_ol_stateid *stp = NULL; 4473 struct nfs4_ol_stateid *stp = NULL;
4474 struct nfs4_delegation *dp = NULL; 4474 struct nfs4_delegation *dp = NULL;
4475 struct svc_fh *current_fh = &cstate->current_fh; 4475 struct svc_fh *current_fh = &cstate->current_fh;
4476 struct inode *ino = current_fh->fh_dentry->d_inode; 4476 struct inode *ino = d_inode(current_fh->fh_dentry);
4477 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 4477 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
4478 struct file *file = NULL; 4478 struct file *file = NULL;
4479 __be32 status; 4479 __be32 status;
@@ -5169,7 +5169,7 @@ lookup_or_create_lock_state(struct nfsd4_compound_state *cstate,
5169 struct nfs4_file *fi = ost->st_stid.sc_file; 5169 struct nfs4_file *fi = ost->st_stid.sc_file;
5170 struct nfs4_openowner *oo = openowner(ost->st_stateowner); 5170 struct nfs4_openowner *oo = openowner(ost->st_stateowner);
5171 struct nfs4_client *cl = oo->oo_owner.so_client; 5171 struct nfs4_client *cl = oo->oo_owner.so_client;
5172 struct inode *inode = cstate->current_fh.fh_dentry->d_inode; 5172 struct inode *inode = d_inode(cstate->current_fh.fh_dentry);
5173 struct nfs4_lockowner *lo; 5173 struct nfs4_lockowner *lo;
5174 unsigned int strhashval; 5174 unsigned int strhashval;
5175 5175
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 5fb7e78169a6..ff9be0743b88 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2292,7 +2292,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
2292#ifdef CONFIG_NFSD_V4_SECURITY_LABEL 2292#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2293 if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || 2293 if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) ||
2294 bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { 2294 bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) {
2295 err = security_inode_getsecctx(dentry->d_inode, 2295 err = security_inode_getsecctx(d_inode(dentry),
2296 &context, &contextlen); 2296 &context, &contextlen);
2297 contextsupport = (err == 0); 2297 contextsupport = (err == 0);
2298 if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { 2298 if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) {
@@ -2384,7 +2384,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
2384 p = xdr_reserve_space(xdr, 8); 2384 p = xdr_reserve_space(xdr, 8);
2385 if (!p) 2385 if (!p)
2386 goto out_resource; 2386 goto out_resource;
2387 p = encode_change(p, &stat, dentry->d_inode); 2387 p = encode_change(p, &stat, d_inode(dentry));
2388 } 2388 }
2389 if (bmval0 & FATTR4_WORD0_SIZE) { 2389 if (bmval0 & FATTR4_WORD0_SIZE) {
2390 p = xdr_reserve_space(xdr, 8); 2390 p = xdr_reserve_space(xdr, 8);
@@ -2807,7 +2807,7 @@ nfsd4_encode_dirent_fattr(struct xdr_stream *xdr, struct nfsd4_readdir *cd,
2807 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); 2807 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
2808 if (IS_ERR(dentry)) 2808 if (IS_ERR(dentry))
2809 return nfserrno(PTR_ERR(dentry)); 2809 return nfserrno(PTR_ERR(dentry));
2810 if (!dentry->d_inode) { 2810 if (d_really_is_negative(dentry)) {
2811 /* 2811 /*
2812 * nfsd_buffered_readdir drops the i_mutex between 2812 * nfsd_buffered_readdir drops the i_mutex between
2813 * readdir and calling this callback, leaving a window 2813 * readdir and calling this callback, leaving a window
@@ -3324,7 +3324,7 @@ static __be32 nfsd4_encode_splice_read(
3324 } 3324 }
3325 3325
3326 eof = (read->rd_offset + maxcount >= 3326 eof = (read->rd_offset + maxcount >=
3327 read->rd_fhp->fh_dentry->d_inode->i_size); 3327 d_inode(read->rd_fhp->fh_dentry)->i_size);
3328 3328
3329 *(p++) = htonl(eof); 3329 *(p++) = htonl(eof);
3330 *(p++) = htonl(maxcount); 3330 *(p++) = htonl(maxcount);
@@ -3401,7 +3401,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
3401 xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3)); 3401 xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3));
3402 3402
3403 eof = (read->rd_offset + maxcount >= 3403 eof = (read->rd_offset + maxcount >=
3404 read->rd_fhp->fh_dentry->d_inode->i_size); 3404 d_inode(read->rd_fhp->fh_dentry)->i_size);
3405 3405
3406 tmp = htonl(eof); 3406 tmp = htonl(eof);
3407 write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4); 3407 write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4);
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index e9fa966fc37f..350041a40fe5 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -38,7 +38,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
38 /* make sure parents give x permission to user */ 38 /* make sure parents give x permission to user */
39 int err; 39 int err;
40 parent = dget_parent(tdentry); 40 parent = dget_parent(tdentry);
41 err = inode_permission(parent->d_inode, MAY_EXEC); 41 err = inode_permission(d_inode(parent), MAY_EXEC);
42 if (err < 0) { 42 if (err < 0) {
43 dput(parent); 43 dput(parent);
44 break; 44 break;
@@ -340,7 +340,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
340 if (error) 340 if (error)
341 goto out; 341 goto out;
342 342
343 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); 343 error = nfsd_mode_check(rqstp, d_inode(dentry)->i_mode, type);
344 if (error) 344 if (error)
345 goto out; 345 goto out;
346 346
@@ -412,8 +412,8 @@ static inline void _fh_update_old(struct dentry *dentry,
412 struct svc_export *exp, 412 struct svc_export *exp,
413 struct knfsd_fh *fh) 413 struct knfsd_fh *fh)
414{ 414{
415 fh->ofh_ino = ino_t_to_u32(dentry->d_inode->i_ino); 415 fh->ofh_ino = ino_t_to_u32(d_inode(dentry)->i_ino);
416 fh->ofh_generation = dentry->d_inode->i_generation; 416 fh->ofh_generation = d_inode(dentry)->i_generation;
417 if (d_is_dir(dentry) || 417 if (d_is_dir(dentry) ||
418 (exp->ex_flags & NFSEXP_NOSUBTREECHECK)) 418 (exp->ex_flags & NFSEXP_NOSUBTREECHECK))
419 fh->ofh_dirino = 0; 419 fh->ofh_dirino = 0;
@@ -426,7 +426,7 @@ static bool is_root_export(struct svc_export *exp)
426 426
427static struct super_block *exp_sb(struct svc_export *exp) 427static struct super_block *exp_sb(struct svc_export *exp)
428{ 428{
429 return exp->ex_path.dentry->d_inode->i_sb; 429 return d_inode(exp->ex_path.dentry)->i_sb;
430} 430}
431 431
432static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp) 432static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
@@ -520,12 +520,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
520 * 520 *
521 */ 521 */
522 522
523 struct inode * inode = dentry->d_inode; 523 struct inode * inode = d_inode(dentry);
524 dev_t ex_dev = exp_sb(exp)->s_dev; 524 dev_t ex_dev = exp_sb(exp)->s_dev;
525 525
526 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n", 526 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n",
527 MAJOR(ex_dev), MINOR(ex_dev), 527 MAJOR(ex_dev), MINOR(ex_dev),
528 (long) exp->ex_path.dentry->d_inode->i_ino, 528 (long) d_inode(exp->ex_path.dentry)->i_ino,
529 dentry, 529 dentry,
530 (inode ? inode->i_ino : 0)); 530 (inode ? inode->i_ino : 0));
531 531
@@ -558,7 +558,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
558 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 558 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev);
559 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 559 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
560 fhp->fh_handle.ofh_xino = 560 fhp->fh_handle.ofh_xino =
561 ino_t_to_u32(exp->ex_path.dentry->d_inode->i_ino); 561 ino_t_to_u32(d_inode(exp->ex_path.dentry)->i_ino);
562 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 562 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
563 if (inode) 563 if (inode)
564 _fh_update_old(dentry, exp, &fhp->fh_handle); 564 _fh_update_old(dentry, exp, &fhp->fh_handle);
@@ -570,7 +570,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
570 mk_fsid(fhp->fh_handle.fh_fsid_type, 570 mk_fsid(fhp->fh_handle.fh_fsid_type,
571 fhp->fh_handle.fh_fsid, 571 fhp->fh_handle.fh_fsid,
572 ex_dev, 572 ex_dev,
573 exp->ex_path.dentry->d_inode->i_ino, 573 d_inode(exp->ex_path.dentry)->i_ino,
574 exp->ex_fsid, exp->ex_uuid); 574 exp->ex_fsid, exp->ex_uuid);
575 575
576 if (inode) 576 if (inode)
@@ -597,7 +597,7 @@ fh_update(struct svc_fh *fhp)
597 goto out_bad; 597 goto out_bad;
598 598
599 dentry = fhp->fh_dentry; 599 dentry = fhp->fh_dentry;
600 if (!dentry->d_inode) 600 if (d_really_is_negative(dentry))
601 goto out_negative; 601 goto out_negative;
602 if (fhp->fh_handle.fh_version != 1) { 602 if (fhp->fh_handle.fh_version != 1) {
603 _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); 603 _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle);
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index f22920442172..1e90dad4926b 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -225,7 +225,7 @@ fill_pre_wcc(struct svc_fh *fhp)
225{ 225{
226 struct inode *inode; 226 struct inode *inode;
227 227
228 inode = fhp->fh_dentry->d_inode; 228 inode = d_inode(fhp->fh_dentry);
229 if (!fhp->fh_pre_saved) { 229 if (!fhp->fh_pre_saved) {
230 fhp->fh_pre_mtime = inode->i_mtime; 230 fhp->fh_pre_mtime = inode->i_mtime;
231 fhp->fh_pre_ctime = inode->i_ctime; 231 fhp->fh_pre_ctime = inode->i_ctime;
@@ -264,7 +264,7 @@ fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
264 return; 264 return;
265 } 265 }
266 266
267 inode = dentry->d_inode; 267 inode = d_inode(dentry);
268 mutex_lock_nested(&inode->i_mutex, subclass); 268 mutex_lock_nested(&inode->i_mutex, subclass);
269 fill_pre_wcc(fhp); 269 fill_pre_wcc(fhp);
270 fhp->fh_locked = 1; 270 fhp->fh_locked = 1;
@@ -284,7 +284,7 @@ fh_unlock(struct svc_fh *fhp)
284{ 284{
285 if (fhp->fh_locked) { 285 if (fhp->fh_locked) {
286 fill_post_wcc(fhp); 286 fill_post_wcc(fhp);
287 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); 287 mutex_unlock(&d_inode(fhp->fh_dentry)->i_mutex);
288 fhp->fh_locked = 0; 288 fhp->fh_locked = 0;
289 } 289 }
290} 290}
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index b8680738f588..aecbcd34d336 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -223,7 +223,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
223 } 223 }
224 fh_init(newfhp, NFS_FHSIZE); 224 fh_init(newfhp, NFS_FHSIZE);
225 nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp); 225 nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp);
226 if (!nfserr && !dchild->d_inode) 226 if (!nfserr && d_really_is_negative(dchild))
227 nfserr = nfserr_noent; 227 nfserr = nfserr_noent;
228 dput(dchild); 228 dput(dchild);
229 if (nfserr) { 229 if (nfserr) {
@@ -241,7 +241,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
241 } 241 }
242 } 242 }
243 243
244 inode = newfhp->fh_dentry->d_inode; 244 inode = d_inode(newfhp->fh_dentry);
245 245
246 /* Unfudge the mode bits */ 246 /* Unfudge the mode bits */
247 if (attr->ia_valid & ATTR_MODE) { 247 if (attr->ia_valid & ATTR_MODE) {
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 412d7061f9e5..79d964aa8079 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -187,7 +187,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
187 *p++ = htonl((u32) stat->ino); 187 *p++ = htonl((u32) stat->ino);
188 *p++ = htonl((u32) stat->atime.tv_sec); 188 *p++ = htonl((u32) stat->atime.tv_sec);
189 *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); 189 *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0);
190 lease_get_mtime(dentry->d_inode, &time); 190 lease_get_mtime(d_inode(dentry), &time);
191 *p++ = htonl((u32) time.tv_sec); 191 *p++ = htonl((u32) time.tv_sec);
192 *p++ = htonl(time.tv_nsec ? time.tv_nsec / 1000 : 0); 192 *p++ = htonl(time.tv_nsec ? time.tv_nsec / 1000 : 0);
193 *p++ = htonl((u32) stat->ctime.tv_sec); 193 *p++ = htonl((u32) stat->ctime.tv_sec);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 368526582429..84d770be056e 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -174,7 +174,7 @@ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
174 return 1; 174 return 1;
175 if (!(exp->ex_flags & NFSEXP_V4ROOT)) 175 if (!(exp->ex_flags & NFSEXP_V4ROOT))
176 return 0; 176 return 0;
177 return dentry->d_inode != NULL; 177 return d_inode(dentry) != NULL;
178} 178}
179 179
180__be32 180__be32
@@ -270,7 +270,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
270 * dentry may be negative, it may need to be updated. 270 * dentry may be negative, it may need to be updated.
271 */ 271 */
272 err = fh_compose(resfh, exp, dentry, fhp); 272 err = fh_compose(resfh, exp, dentry, fhp);
273 if (!err && !dentry->d_inode) 273 if (!err && d_really_is_negative(dentry))
274 err = nfserr_noent; 274 err = nfserr_noent;
275out: 275out:
276 dput(dentry); 276 dput(dentry);
@@ -284,7 +284,7 @@ out:
284static int 284static int
285commit_metadata(struct svc_fh *fhp) 285commit_metadata(struct svc_fh *fhp)
286{ 286{
287 struct inode *inode = fhp->fh_dentry->d_inode; 287 struct inode *inode = d_inode(fhp->fh_dentry);
288 const struct export_operations *export_ops = inode->i_sb->s_export_op; 288 const struct export_operations *export_ops = inode->i_sb->s_export_op;
289 289
290 if (!EX_ISSYNC(fhp->fh_export)) 290 if (!EX_ISSYNC(fhp->fh_export))
@@ -364,7 +364,7 @@ static __be32
364nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, 364nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
365 struct iattr *iap) 365 struct iattr *iap)
366{ 366{
367 struct inode *inode = fhp->fh_dentry->d_inode; 367 struct inode *inode = d_inode(fhp->fh_dentry);
368 int host_err; 368 int host_err;
369 369
370 if (iap->ia_size < inode->i_size) { 370 if (iap->ia_size < inode->i_size) {
@@ -426,7 +426,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
426 } 426 }
427 427
428 dentry = fhp->fh_dentry; 428 dentry = fhp->fh_dentry;
429 inode = dentry->d_inode; 429 inode = d_inode(dentry);
430 430
431 /* Ignore any mode updates on symlinks */ 431 /* Ignore any mode updates on symlinks */
432 if (S_ISLNK(inode->i_mode)) 432 if (S_ISLNK(inode->i_mode))
@@ -495,7 +495,7 @@ out:
495 */ 495 */
496int nfsd4_is_junction(struct dentry *dentry) 496int nfsd4_is_junction(struct dentry *dentry)
497{ 497{
498 struct inode *inode = dentry->d_inode; 498 struct inode *inode = d_inode(dentry);
499 499
500 if (inode == NULL) 500 if (inode == NULL)
501 return 0; 501 return 0;
@@ -521,9 +521,9 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
521 521
522 dentry = fhp->fh_dentry; 522 dentry = fhp->fh_dentry;
523 523
524 mutex_lock(&dentry->d_inode->i_mutex); 524 mutex_lock(&d_inode(dentry)->i_mutex);
525 host_error = security_inode_setsecctx(dentry, label->data, label->len); 525 host_error = security_inode_setsecctx(dentry, label->data, label->len);
526 mutex_unlock(&dentry->d_inode->i_mutex); 526 mutex_unlock(&d_inode(dentry)->i_mutex);
527 return nfserrno(host_error); 527 return nfserrno(host_error);
528} 528}
529#else 529#else
@@ -706,7 +706,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
706 706
707 path.mnt = fhp->fh_export->ex_path.mnt; 707 path.mnt = fhp->fh_export->ex_path.mnt;
708 path.dentry = fhp->fh_dentry; 708 path.dentry = fhp->fh_dentry;
709 inode = path.dentry->d_inode; 709 inode = d_inode(path.dentry);
710 710
711 /* Disallow write access to files with the append-only bit set 711 /* Disallow write access to files with the append-only bit set
712 * or any access when mandatory locking enabled 712 * or any access when mandatory locking enabled
@@ -1211,7 +1211,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1211 goto out; 1211 goto out;
1212 1212
1213 dentry = fhp->fh_dentry; 1213 dentry = fhp->fh_dentry;
1214 dirp = dentry->d_inode; 1214 dirp = d_inode(dentry);
1215 1215
1216 err = nfserr_notdir; 1216 err = nfserr_notdir;
1217 if (!dirp->i_op->lookup) 1217 if (!dirp->i_op->lookup)
@@ -1250,7 +1250,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1250 * Make sure the child dentry is still negative ... 1250 * Make sure the child dentry is still negative ...
1251 */ 1251 */
1252 err = nfserr_exist; 1252 err = nfserr_exist;
1253 if (dchild->d_inode) { 1253 if (d_really_is_positive(dchild)) {
1254 dprintk("nfsd_create: dentry %pd/%pd not negative!\n", 1254 dprintk("nfsd_create: dentry %pd/%pd not negative!\n",
1255 dentry, dchild); 1255 dentry, dchild);
1256 goto out; 1256 goto out;
@@ -1353,7 +1353,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1353 goto out; 1353 goto out;
1354 1354
1355 dentry = fhp->fh_dentry; 1355 dentry = fhp->fh_dentry;
1356 dirp = dentry->d_inode; 1356 dirp = d_inode(dentry);
1357 1357
1358 /* Get all the sanity checks out of the way before 1358 /* Get all the sanity checks out of the way before
1359 * we lock the parent. */ 1359 * we lock the parent. */
@@ -1376,7 +1376,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1376 goto out_nfserr; 1376 goto out_nfserr;
1377 1377
1378 /* If file doesn't exist, check for permissions to create one */ 1378 /* If file doesn't exist, check for permissions to create one */
1379 if (!dchild->d_inode) { 1379 if (d_really_is_negative(dchild)) {
1380 err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); 1380 err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
1381 if (err) 1381 if (err)
1382 goto out; 1382 goto out;
@@ -1397,7 +1397,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1397 v_atime = verifier[1]&0x7fffffff; 1397 v_atime = verifier[1]&0x7fffffff;
1398 } 1398 }
1399 1399
1400 if (dchild->d_inode) { 1400 if (d_really_is_positive(dchild)) {
1401 err = 0; 1401 err = 0;
1402 1402
1403 switch (createmode) { 1403 switch (createmode) {
@@ -1420,17 +1420,17 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1420 } 1420 }
1421 break; 1421 break;
1422 case NFS3_CREATE_EXCLUSIVE: 1422 case NFS3_CREATE_EXCLUSIVE:
1423 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1423 if ( d_inode(dchild)->i_mtime.tv_sec == v_mtime
1424 && dchild->d_inode->i_atime.tv_sec == v_atime 1424 && d_inode(dchild)->i_atime.tv_sec == v_atime
1425 && dchild->d_inode->i_size == 0 ) { 1425 && d_inode(dchild)->i_size == 0 ) {
1426 if (created) 1426 if (created)
1427 *created = 1; 1427 *created = 1;
1428 break; 1428 break;
1429 } 1429 }
1430 case NFS4_CREATE_EXCLUSIVE4_1: 1430 case NFS4_CREATE_EXCLUSIVE4_1:
1431 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1431 if ( d_inode(dchild)->i_mtime.tv_sec == v_mtime
1432 && dchild->d_inode->i_atime.tv_sec == v_atime 1432 && d_inode(dchild)->i_atime.tv_sec == v_atime
1433 && dchild->d_inode->i_size == 0 ) { 1433 && d_inode(dchild)->i_size == 0 ) {
1434 if (created) 1434 if (created)
1435 *created = 1; 1435 *created = 1;
1436 goto set_attr; 1436 goto set_attr;
@@ -1513,7 +1513,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1513 1513
1514 path.mnt = fhp->fh_export->ex_path.mnt; 1514 path.mnt = fhp->fh_export->ex_path.mnt;
1515 path.dentry = fhp->fh_dentry; 1515 path.dentry = fhp->fh_dentry;
1516 inode = path.dentry->d_inode; 1516 inode = d_inode(path.dentry);
1517 1517
1518 err = nfserr_inval; 1518 err = nfserr_inval;
1519 if (!inode->i_op->readlink) 1519 if (!inode->i_op->readlink)
@@ -1576,7 +1576,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1576 if (IS_ERR(dnew)) 1576 if (IS_ERR(dnew))
1577 goto out_nfserr; 1577 goto out_nfserr;
1578 1578
1579 host_err = vfs_symlink(dentry->d_inode, dnew, path); 1579 host_err = vfs_symlink(d_inode(dentry), dnew, path);
1580 err = nfserrno(host_err); 1580 err = nfserrno(host_err);
1581 if (!err) 1581 if (!err)
1582 err = nfserrno(commit_metadata(fhp)); 1582 err = nfserrno(commit_metadata(fhp));
@@ -1632,7 +1632,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1632 1632
1633 fh_lock_nested(ffhp, I_MUTEX_PARENT); 1633 fh_lock_nested(ffhp, I_MUTEX_PARENT);
1634 ddir = ffhp->fh_dentry; 1634 ddir = ffhp->fh_dentry;
1635 dirp = ddir->d_inode; 1635 dirp = d_inode(ddir);
1636 1636
1637 dnew = lookup_one_len(name, ddir, len); 1637 dnew = lookup_one_len(name, ddir, len);
1638 host_err = PTR_ERR(dnew); 1638 host_err = PTR_ERR(dnew);
@@ -1642,7 +1642,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1642 dold = tfhp->fh_dentry; 1642 dold = tfhp->fh_dentry;
1643 1643
1644 err = nfserr_noent; 1644 err = nfserr_noent;
1645 if (!dold->d_inode) 1645 if (d_really_is_negative(dold))
1646 goto out_dput; 1646 goto out_dput;
1647 host_err = vfs_link(dold, dirp, dnew, NULL); 1647 host_err = vfs_link(dold, dirp, dnew, NULL);
1648 if (!host_err) { 1648 if (!host_err) {
@@ -1689,10 +1689,10 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1689 goto out; 1689 goto out;
1690 1690
1691 fdentry = ffhp->fh_dentry; 1691 fdentry = ffhp->fh_dentry;
1692 fdir = fdentry->d_inode; 1692 fdir = d_inode(fdentry);
1693 1693
1694 tdentry = tfhp->fh_dentry; 1694 tdentry = tfhp->fh_dentry;
1695 tdir = tdentry->d_inode; 1695 tdir = d_inode(tdentry);
1696 1696
1697 err = nfserr_perm; 1697 err = nfserr_perm;
1698 if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen)) 1698 if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen))
@@ -1717,7 +1717,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1717 goto out_nfserr; 1717 goto out_nfserr;
1718 1718
1719 host_err = -ENOENT; 1719 host_err = -ENOENT;
1720 if (!odentry->d_inode) 1720 if (d_really_is_negative(odentry))
1721 goto out_dput_old; 1721 goto out_dput_old;
1722 host_err = -EINVAL; 1722 host_err = -EINVAL;
1723 if (odentry == trap) 1723 if (odentry == trap)
@@ -1790,21 +1790,21 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1790 1790
1791 fh_lock_nested(fhp, I_MUTEX_PARENT); 1791 fh_lock_nested(fhp, I_MUTEX_PARENT);
1792 dentry = fhp->fh_dentry; 1792 dentry = fhp->fh_dentry;
1793 dirp = dentry->d_inode; 1793 dirp = d_inode(dentry);
1794 1794
1795 rdentry = lookup_one_len(fname, dentry, flen); 1795 rdentry = lookup_one_len(fname, dentry, flen);
1796 host_err = PTR_ERR(rdentry); 1796 host_err = PTR_ERR(rdentry);
1797 if (IS_ERR(rdentry)) 1797 if (IS_ERR(rdentry))
1798 goto out_nfserr; 1798 goto out_nfserr;
1799 1799
1800 if (!rdentry->d_inode) { 1800 if (d_really_is_negative(rdentry)) {
1801 dput(rdentry); 1801 dput(rdentry);
1802 err = nfserr_noent; 1802 err = nfserr_noent;
1803 goto out; 1803 goto out;
1804 } 1804 }
1805 1805
1806 if (!type) 1806 if (!type)
1807 type = rdentry->d_inode->i_mode & S_IFMT; 1807 type = d_inode(rdentry)->i_mode & S_IFMT;
1808 1808
1809 if (type != S_IFDIR) 1809 if (type != S_IFDIR)
1810 host_err = vfs_unlink(dirp, rdentry, NULL); 1810 host_err = vfs_unlink(dirp, rdentry, NULL);
@@ -2015,7 +2015,7 @@ __be32
2015nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, 2015nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
2016 struct dentry *dentry, int acc) 2016 struct dentry *dentry, int acc)
2017{ 2017{
2018 struct inode *inode = dentry->d_inode; 2018 struct inode *inode = d_inode(dentry);
2019 int err; 2019 int err;
2020 2020
2021 if ((acc & NFSD_MAY_MASK) == NFSD_MAY_NOP) 2021 if ((acc & NFSD_MAY_MASK) == NFSD_MAY_NOP)
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 0bda93e58e1b..056f23a78ffd 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -632,7 +632,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
632{ 632{
633 BUG_ON(!fhp->fh_pre_saved); 633 BUG_ON(!fhp->fh_pre_saved);
634 cinfo->atomic = fhp->fh_post_saved; 634 cinfo->atomic = fhp->fh_post_saved;
635 cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); 635 cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry));
636 636
637 cinfo->before_change = fhp->fh_pre_change; 637 cinfo->before_change = fhp->fh_pre_change;
638 cinfo->after_change = fhp->fh_post_change; 638 cinfo->after_change = fhp->fh_post_change;
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 197a63e9d102..0ee0bed3649b 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -435,7 +435,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
435 */ 435 */
436int nilfs_add_link(struct dentry *dentry, struct inode *inode) 436int nilfs_add_link(struct dentry *dentry, struct inode *inode)
437{ 437{
438 struct inode *dir = dentry->d_parent->d_inode; 438 struct inode *dir = d_inode(dentry->d_parent);
439 const unsigned char *name = dentry->d_name.name; 439 const unsigned char *name = dentry->d_name.name;
440 int namelen = dentry->d_name.len; 440 int namelen = dentry->d_name.len;
441 unsigned chunk_size = nilfs_chunk_size(dir); 441 unsigned chunk_size = nilfs_chunk_size(dir);
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 36f057fa8aa3..310d87c51b40 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -834,7 +834,7 @@ void nilfs_evict_inode(struct inode *inode)
834int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) 834int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
835{ 835{
836 struct nilfs_transaction_info ti; 836 struct nilfs_transaction_info ti;
837 struct inode *inode = dentry->d_inode; 837 struct inode *inode = d_inode(dentry);
838 struct super_block *sb = inode->i_sb; 838 struct super_block *sb = inode->i_sb;
839 int err; 839 int err;
840 840
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 0f84b257932c..22180836ec22 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -192,7 +192,7 @@ out_fail:
192static int nilfs_link(struct dentry *old_dentry, struct inode *dir, 192static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
193 struct dentry *dentry) 193 struct dentry *dentry)
194{ 194{
195 struct inode *inode = old_dentry->d_inode; 195 struct inode *inode = d_inode(old_dentry);
196 struct nilfs_transaction_info ti; 196 struct nilfs_transaction_info ti;
197 int err; 197 int err;
198 198
@@ -283,7 +283,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
283 if (!de) 283 if (!de)
284 goto out; 284 goto out;
285 285
286 inode = dentry->d_inode; 286 inode = d_inode(dentry);
287 err = -EIO; 287 err = -EIO;
288 if (le64_to_cpu(de->inode) != inode->i_ino) 288 if (le64_to_cpu(de->inode) != inode->i_ino)
289 goto out; 289 goto out;
@@ -318,7 +318,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
318 318
319 if (!err) { 319 if (!err) {
320 nilfs_mark_inode_dirty(dir); 320 nilfs_mark_inode_dirty(dir);
321 nilfs_mark_inode_dirty(dentry->d_inode); 321 nilfs_mark_inode_dirty(d_inode(dentry));
322 err = nilfs_transaction_commit(dir->i_sb); 322 err = nilfs_transaction_commit(dir->i_sb);
323 } else 323 } else
324 nilfs_transaction_abort(dir->i_sb); 324 nilfs_transaction_abort(dir->i_sb);
@@ -328,7 +328,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
328 328
329static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) 329static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
330{ 330{
331 struct inode *inode = dentry->d_inode; 331 struct inode *inode = d_inode(dentry);
332 struct nilfs_transaction_info ti; 332 struct nilfs_transaction_info ti;
333 int err; 333 int err;
334 334
@@ -358,8 +358,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
358static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, 358static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
359 struct inode *new_dir, struct dentry *new_dentry) 359 struct inode *new_dir, struct dentry *new_dentry)
360{ 360{
361 struct inode *old_inode = old_dentry->d_inode; 361 struct inode *old_inode = d_inode(old_dentry);
362 struct inode *new_inode = new_dentry->d_inode; 362 struct inode *new_inode = d_inode(new_dentry);
363 struct page *dir_page = NULL; 363 struct page *dir_page = NULL;
364 struct nilfs_dir_entry *dir_de = NULL; 364 struct nilfs_dir_entry *dir_de = NULL;
365 struct page *old_page; 365 struct page *old_page;
@@ -453,13 +453,13 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
453 struct qstr dotdot = QSTR_INIT("..", 2); 453 struct qstr dotdot = QSTR_INIT("..", 2);
454 struct nilfs_root *root; 454 struct nilfs_root *root;
455 455
456 ino = nilfs_inode_by_name(child->d_inode, &dotdot); 456 ino = nilfs_inode_by_name(d_inode(child), &dotdot);
457 if (!ino) 457 if (!ino)
458 return ERR_PTR(-ENOENT); 458 return ERR_PTR(-ENOENT);
459 459
460 root = NILFS_I(child->d_inode)->i_root; 460 root = NILFS_I(d_inode(child))->i_root;
461 461
462 inode = nilfs_iget(child->d_inode->i_sb, root, ino); 462 inode = nilfs_iget(d_inode(child)->i_sb, root, ino);
463 if (IS_ERR(inode)) 463 if (IS_ERR(inode))
464 return ERR_CAST(inode); 464 return ERR_CAST(inode);
465 465
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 5bc2a1cf73c3..282fb1037823 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -610,7 +610,7 @@ static int nilfs_unfreeze(struct super_block *sb)
610static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) 610static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
611{ 611{
612 struct super_block *sb = dentry->d_sb; 612 struct super_block *sb = dentry->d_sb;
613 struct nilfs_root *root = NILFS_I(dentry->d_inode)->i_root; 613 struct nilfs_root *root = NILFS_I(d_inode(dentry))->i_root;
614 struct the_nilfs *nilfs = root->nilfs; 614 struct the_nilfs *nilfs = root->nilfs;
615 u64 id = huge_encode_dev(sb->s_bdev->bd_dev); 615 u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
616 unsigned long long blocks; 616 unsigned long long blocks;
@@ -681,7 +681,7 @@ static int nilfs_show_options(struct seq_file *seq, struct dentry *dentry)
681{ 681{
682 struct super_block *sb = dentry->d_sb; 682 struct super_block *sb = dentry->d_sb;
683 struct the_nilfs *nilfs = sb->s_fs_info; 683 struct the_nilfs *nilfs = sb->s_fs_info;
684 struct nilfs_root *root = NILFS_I(dentry->d_inode)->i_root; 684 struct nilfs_root *root = NILFS_I(d_inode(dentry))->i_root;
685 685
686 if (!nilfs_test_opt(nilfs, BARRIER)) 686 if (!nilfs_test_opt(nilfs, BARRIER))
687 seq_puts(seq, ",nobarrier"); 687 seq_puts(seq, ",nobarrier");
@@ -1190,7 +1190,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
1190 1190
1191 sb->s_flags &= ~MS_RDONLY; 1191 sb->s_flags &= ~MS_RDONLY;
1192 1192
1193 root = NILFS_I(sb->s_root->d_inode)->i_root; 1193 root = NILFS_I(d_inode(sb->s_root))->i_root;
1194 err = nilfs_attach_log_writer(sb, root); 1194 err = nilfs_attach_log_writer(sb, root);
1195 if (err) 1195 if (err)
1196 goto restore_opts; 1196 goto restore_opts;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 1d0c21df0d80..d284f07eda77 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2889,7 +2889,7 @@ void ntfs_truncate_vfs(struct inode *vi) {
2889 */ 2889 */
2890int ntfs_setattr(struct dentry *dentry, struct iattr *attr) 2890int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
2891{ 2891{
2892 struct inode *vi = dentry->d_inode; 2892 struct inode *vi = d_inode(dentry);
2893 int err; 2893 int err;
2894 unsigned int ia_valid = attr->ia_valid; 2894 unsigned int ia_valid = attr->ia_valid;
2895 2895
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index b3973c2fd190..0f35b80d17fe 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -292,14 +292,14 @@ const struct inode_operations ntfs_dir_inode_ops = {
292 * The code is based on the ext3 ->get_parent() implementation found in 292 * The code is based on the ext3 ->get_parent() implementation found in
293 * fs/ext3/namei.c::ext3_get_parent(). 293 * fs/ext3/namei.c::ext3_get_parent().
294 * 294 *
295 * Note: ntfs_get_parent() is called with @child_dent->d_inode->i_mutex down. 295 * Note: ntfs_get_parent() is called with @d_inode(child_dent)->i_mutex down.
296 * 296 *
297 * Return the dentry of the parent directory on success or the error code on 297 * Return the dentry of the parent directory on success or the error code on
298 * error (IS_ERR() is true). 298 * error (IS_ERR() is true).
299 */ 299 */
300static struct dentry *ntfs_get_parent(struct dentry *child_dent) 300static struct dentry *ntfs_get_parent(struct dentry *child_dent)
301{ 301{
302 struct inode *vi = child_dent->d_inode; 302 struct inode *vi = d_inode(child_dent);
303 ntfs_inode *ni = NTFS_I(vi); 303 ntfs_inode *ni = NTFS_I(vi);
304 MFT_RECORD *mrec; 304 MFT_RECORD *mrec;
305 ntfs_attr_search_ctx *ctx; 305 ntfs_attr_search_ctx *ctx;
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 4fda7a5f3088..290373024d9d 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -42,8 +42,8 @@
42void ocfs2_dentry_attach_gen(struct dentry *dentry) 42void ocfs2_dentry_attach_gen(struct dentry *dentry)
43{ 43{
44 unsigned long gen = 44 unsigned long gen =
45 OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; 45 OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
46 BUG_ON(dentry->d_inode); 46 BUG_ON(d_inode(dentry));
47 dentry->d_fsdata = (void *)gen; 47 dentry->d_fsdata = (void *)gen;
48} 48}
49 49
@@ -57,7 +57,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags)
57 if (flags & LOOKUP_RCU) 57 if (flags & LOOKUP_RCU)
58 return -ECHILD; 58 return -ECHILD;
59 59
60 inode = dentry->d_inode; 60 inode = d_inode(dentry);
61 osb = OCFS2_SB(dentry->d_sb); 61 osb = OCFS2_SB(dentry->d_sb);
62 62
63 trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len, 63 trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len,
@@ -71,7 +71,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags)
71 unsigned long gen = (unsigned long) dentry->d_fsdata; 71 unsigned long gen = (unsigned long) dentry->d_fsdata;
72 unsigned long pgen; 72 unsigned long pgen;
73 spin_lock(&dentry->d_lock); 73 spin_lock(&dentry->d_lock);
74 pgen = OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; 74 pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
75 spin_unlock(&dentry->d_lock); 75 spin_unlock(&dentry->d_lock);
76 trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len, 76 trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len,
77 dentry->d_name.name, 77 dentry->d_name.name,
@@ -146,7 +146,7 @@ static int ocfs2_match_dentry(struct dentry *dentry,
146 if (skip_unhashed && d_unhashed(dentry)) 146 if (skip_unhashed && d_unhashed(dentry))
147 return 0; 147 return 0;
148 148
149 parent = dentry->d_parent->d_inode; 149 parent = d_inode(dentry->d_parent);
150 /* Negative parent dentry? */ 150 /* Negative parent dentry? */
151 if (!parent) 151 if (!parent)
152 return 0; 152 return 0;
@@ -243,7 +243,7 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry,
243 if (!inode) 243 if (!inode)
244 return 0; 244 return 0;
245 245
246 if (!dentry->d_inode && dentry->d_fsdata) { 246 if (d_really_is_negative(dentry) && dentry->d_fsdata) {
247 /* Converting a negative dentry to positive 247 /* Converting a negative dentry to positive
248 Clear dentry->d_fsdata */ 248 Clear dentry->d_fsdata */
249 dentry->d_fsdata = dl = NULL; 249 dentry->d_fsdata = dl = NULL;
@@ -446,7 +446,7 @@ void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
446{ 446{
447 int ret; 447 int ret;
448 struct ocfs2_super *osb = OCFS2_SB(old_dir->i_sb); 448 struct ocfs2_super *osb = OCFS2_SB(old_dir->i_sb);
449 struct inode *inode = dentry->d_inode; 449 struct inode *inode = d_inode(dentry);
450 450
451 /* 451 /*
452 * Move within the same directory, so the actual lock info won't 452 * Move within the same directory, so the actual lock info won't
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h
index f0344b75b14d..3d8639f38973 100644
--- a/fs/ocfs2/dir.h
+++ b/fs/ocfs2/dir.h
@@ -72,7 +72,7 @@ static inline int ocfs2_add_entry(handle_t *handle,
72 struct buffer_head *parent_fe_bh, 72 struct buffer_head *parent_fe_bh,
73 struct ocfs2_dir_lookup_result *lookup) 73 struct ocfs2_dir_lookup_result *lookup)
74{ 74{
75 return __ocfs2_add_entry(handle, dentry->d_parent->d_inode, 75 return __ocfs2_add_entry(handle, d_inode(dentry->d_parent),
76 dentry->d_name.name, dentry->d_name.len, 76 dentry->d_name.name, dentry->d_name.len,
77 inode, blkno, parent_fe_bh, lookup); 77 inode, blkno, parent_fe_bh, lookup);
78} 78}
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 061ba6a91bf2..b5cf27dcb18a 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -208,7 +208,7 @@ static int dlmfs_file_release(struct inode *inode,
208static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) 208static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr)
209{ 209{
210 int error; 210 int error;
211 struct inode *inode = dentry->d_inode; 211 struct inode *inode = d_inode(dentry);
212 212
213 attr->ia_valid &= ~ATTR_SIZE; 213 attr->ia_valid &= ~ATTR_SIZE;
214 error = inode_change_ok(inode, attr); 214 error = inode_change_ok(inode, attr);
@@ -549,7 +549,7 @@ static int dlmfs_unlink(struct inode *dir,
549 struct dentry *dentry) 549 struct dentry *dentry)
550{ 550{
551 int status; 551 int status;
552 struct inode *inode = dentry->d_inode; 552 struct inode *inode = d_inode(dentry);
553 553
554 mlog(0, "unlink inode %lu\n", inode->i_ino); 554 mlog(0, "unlink inode %lu\n", inode->i_ino);
555 555
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
index 29651167190d..facf456c481a 100644
--- a/fs/ocfs2/export.c
+++ b/fs/ocfs2/export.c
@@ -147,7 +147,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
147 int status; 147 int status;
148 u64 blkno; 148 u64 blkno;
149 struct dentry *parent; 149 struct dentry *parent;
150 struct inode *dir = child->d_inode; 150 struct inode *dir = d_inode(child);
151 151
152 trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name, 152 trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name,
153 (unsigned long long)OCFS2_I(dir)->ip_blkno); 153 (unsigned long long)OCFS2_I(dir)->ip_blkno);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 913fc250d85a..d8b670cbd909 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1126,7 +1126,7 @@ out:
1126int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) 1126int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1127{ 1127{
1128 int status = 0, size_change; 1128 int status = 0, size_change;
1129 struct inode *inode = dentry->d_inode; 1129 struct inode *inode = d_inode(dentry);
1130 struct super_block *sb = inode->i_sb; 1130 struct super_block *sb = inode->i_sb;
1131 struct ocfs2_super *osb = OCFS2_SB(sb); 1131 struct ocfs2_super *osb = OCFS2_SB(sb);
1132 struct buffer_head *bh = NULL; 1132 struct buffer_head *bh = NULL;
@@ -1275,8 +1275,8 @@ int ocfs2_getattr(struct vfsmount *mnt,
1275 struct dentry *dentry, 1275 struct dentry *dentry,
1276 struct kstat *stat) 1276 struct kstat *stat)
1277{ 1277{
1278 struct inode *inode = dentry->d_inode; 1278 struct inode *inode = d_inode(dentry);
1279 struct super_block *sb = dentry->d_inode->i_sb; 1279 struct super_block *sb = d_inode(dentry)->i_sb;
1280 struct ocfs2_super *osb = sb->s_fs_info; 1280 struct ocfs2_super *osb = sb->s_fs_info;
1281 int err; 1281 int err;
1282 1282
@@ -2114,7 +2114,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
2114{ 2114{
2115 int ret = 0, meta_level = 0; 2115 int ret = 0, meta_level = 0;
2116 struct dentry *dentry = file->f_path.dentry; 2116 struct dentry *dentry = file->f_path.dentry;
2117 struct inode *inode = dentry->d_inode; 2117 struct inode *inode = d_inode(dentry);
2118 loff_t end; 2118 loff_t end;
2119 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 2119 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2120 int full_coherency = !(osb->s_mount_opt & 2120 int full_coherency = !(osb->s_mount_opt &
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 3025c0da6b8a..751736109489 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1209,7 +1209,7 @@ int ocfs2_drop_inode(struct inode *inode)
1209 */ 1209 */
1210int ocfs2_inode_revalidate(struct dentry *dentry) 1210int ocfs2_inode_revalidate(struct dentry *dentry)
1211{ 1211{
1212 struct inode *inode = dentry->d_inode; 1212 struct inode *inode = d_inode(dentry);
1213 int status = 0; 1213 int status = 0;
1214 1214
1215 trace_ocfs2_inode_revalidate(inode, 1215 trace_ocfs2_inode_revalidate(inode,
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index b5c3a5ea3ee6..c0727037c6f9 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -689,8 +689,8 @@ static int ocfs2_link(struct dentry *old_dentry,
689 struct dentry *dentry) 689 struct dentry *dentry)
690{ 690{
691 handle_t *handle; 691 handle_t *handle;
692 struct inode *inode = old_dentry->d_inode; 692 struct inode *inode = d_inode(old_dentry);
693 struct inode *old_dir = old_dentry->d_parent->d_inode; 693 struct inode *old_dir = d_inode(old_dentry->d_parent);
694 int err; 694 int err;
695 struct buffer_head *fe_bh = NULL; 695 struct buffer_head *fe_bh = NULL;
696 struct buffer_head *old_dir_bh = NULL; 696 struct buffer_head *old_dir_bh = NULL;
@@ -879,7 +879,7 @@ static int ocfs2_unlink(struct inode *dir,
879 int status; 879 int status;
880 int child_locked = 0; 880 int child_locked = 0;
881 bool is_unlinkable = false; 881 bool is_unlinkable = false;
882 struct inode *inode = dentry->d_inode; 882 struct inode *inode = d_inode(dentry);
883 struct inode *orphan_dir = NULL; 883 struct inode *orphan_dir = NULL;
884 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); 884 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
885 u64 blkno; 885 u64 blkno;
@@ -898,7 +898,7 @@ static int ocfs2_unlink(struct inode *dir,
898 898
899 dquot_initialize(dir); 899 dquot_initialize(dir);
900 900
901 BUG_ON(dentry->d_parent->d_inode != dir); 901 BUG_ON(d_inode(dentry->d_parent) != dir);
902 902
903 if (inode == osb->root_inode) 903 if (inode == osb->root_inode)
904 return -EPERM; 904 return -EPERM;
@@ -1209,8 +1209,8 @@ static int ocfs2_rename(struct inode *old_dir,
1209{ 1209{
1210 int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; 1210 int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0;
1211 int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; 1211 int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0;
1212 struct inode *old_inode = old_dentry->d_inode; 1212 struct inode *old_inode = d_inode(old_dentry);
1213 struct inode *new_inode = new_dentry->d_inode; 1213 struct inode *new_inode = d_inode(new_dentry);
1214 struct inode *orphan_dir = NULL; 1214 struct inode *orphan_dir = NULL;
1215 struct ocfs2_dinode *newfe = NULL; 1215 struct ocfs2_dinode *newfe = NULL;
1216 char orphan_name[OCFS2_ORPHAN_NAMELEN + 1]; 1216 char orphan_name[OCFS2_ORPHAN_NAMELEN + 1];
@@ -1454,7 +1454,7 @@ static int ocfs2_rename(struct inode *old_dir,
1454 should_add_orphan = true; 1454 should_add_orphan = true;
1455 } 1455 }
1456 } else { 1456 } else {
1457 BUG_ON(new_dentry->d_parent->d_inode != new_dir); 1457 BUG_ON(d_inode(new_dentry->d_parent) != new_dir);
1458 1458
1459 status = ocfs2_check_dir_for_entry(new_dir, 1459 status = ocfs2_check_dir_for_entry(new_dir,
1460 new_dentry->d_name.name, 1460 new_dentry->d_name.name,
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index ee541f92dab4..2dc801255c4d 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4194,7 +4194,7 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
4194 bool preserve) 4194 bool preserve)
4195{ 4195{
4196 int ret; 4196 int ret;
4197 struct inode *inode = old_dentry->d_inode; 4197 struct inode *inode = d_inode(old_dentry);
4198 struct buffer_head *new_bh = NULL; 4198 struct buffer_head *new_bh = NULL;
4199 4199
4200 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) { 4200 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
@@ -4263,7 +4263,7 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4263 struct dentry *new_dentry, bool preserve) 4263 struct dentry *new_dentry, bool preserve)
4264{ 4264{
4265 int error; 4265 int error;
4266 struct inode *inode = old_dentry->d_inode; 4266 struct inode *inode = d_inode(old_dentry);
4267 struct buffer_head *old_bh = NULL; 4267 struct buffer_head *old_bh = NULL;
4268 struct inode *new_orphan_inode = NULL; 4268 struct inode *new_orphan_inode = NULL;
4269 struct posix_acl *default_acl, *acl; 4269 struct posix_acl *default_acl, *acl;
@@ -4357,7 +4357,7 @@ out:
4357/* copied from may_create in VFS. */ 4357/* copied from may_create in VFS. */
4358static inline int ocfs2_may_create(struct inode *dir, struct dentry *child) 4358static inline int ocfs2_may_create(struct inode *dir, struct dentry *child)
4359{ 4359{
4360 if (child->d_inode) 4360 if (d_really_is_positive(child))
4361 return -EEXIST; 4361 return -EEXIST;
4362 if (IS_DEADDIR(dir)) 4362 if (IS_DEADDIR(dir))
4363 return -ENOENT; 4363 return -ENOENT;
@@ -4375,7 +4375,7 @@ static inline int ocfs2_may_create(struct inode *dir, struct dentry *child)
4375static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, 4375static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
4376 struct dentry *new_dentry, bool preserve) 4376 struct dentry *new_dentry, bool preserve)
4377{ 4377{
4378 struct inode *inode = old_dentry->d_inode; 4378 struct inode *inode = d_inode(old_dentry);
4379 int error; 4379 int error;
4380 4380
4381 if (!inode) 4381 if (!inode)
@@ -4463,7 +4463,7 @@ int ocfs2_reflink_ioctl(struct inode *inode,
4463 } 4463 }
4464 4464
4465 error = ocfs2_vfs_reflink(old_path.dentry, 4465 error = ocfs2_vfs_reflink(old_path.dentry,
4466 new_path.dentry->d_inode, 4466 d_inode(new_path.dentry),
4467 new_dentry, preserve); 4467 new_dentry, preserve);
4468out_dput: 4468out_dput:
4469 done_path_create(&new_path, new_dentry); 4469 done_path_create(&new_path, new_dentry);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 85b190dc132f..4bbeb90863b7 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -1020,7 +1020,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry,
1020 int ret = 0, i_ret = 0, b_ret = 0; 1020 int ret = 0, i_ret = 0, b_ret = 0;
1021 struct buffer_head *di_bh = NULL; 1021 struct buffer_head *di_bh = NULL;
1022 struct ocfs2_dinode *di = NULL; 1022 struct ocfs2_dinode *di = NULL;
1023 struct ocfs2_inode_info *oi = OCFS2_I(dentry->d_inode); 1023 struct ocfs2_inode_info *oi = OCFS2_I(d_inode(dentry));
1024 1024
1025 if (!ocfs2_supports_xattr(OCFS2_SB(dentry->d_sb))) 1025 if (!ocfs2_supports_xattr(OCFS2_SB(dentry->d_sb)))
1026 return -EOPNOTSUPP; 1026 return -EOPNOTSUPP;
@@ -1028,7 +1028,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry,
1028 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL)) 1028 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
1029 return ret; 1029 return ret;
1030 1030
1031 ret = ocfs2_inode_lock(dentry->d_inode, &di_bh, 0); 1031 ret = ocfs2_inode_lock(d_inode(dentry), &di_bh, 0);
1032 if (ret < 0) { 1032 if (ret < 0) {
1033 mlog_errno(ret); 1033 mlog_errno(ret);
1034 return ret; 1034 return ret;
@@ -1037,7 +1037,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry,
1037 di = (struct ocfs2_dinode *)di_bh->b_data; 1037 di = (struct ocfs2_dinode *)di_bh->b_data;
1038 1038
1039 down_read(&oi->ip_xattr_sem); 1039 down_read(&oi->ip_xattr_sem);
1040 i_ret = ocfs2_xattr_ibody_list(dentry->d_inode, di, buffer, size); 1040 i_ret = ocfs2_xattr_ibody_list(d_inode(dentry), di, buffer, size);
1041 if (i_ret < 0) 1041 if (i_ret < 0)
1042 b_ret = 0; 1042 b_ret = 0;
1043 else { 1043 else {
@@ -1045,13 +1045,13 @@ ssize_t ocfs2_listxattr(struct dentry *dentry,
1045 buffer += i_ret; 1045 buffer += i_ret;
1046 size -= i_ret; 1046 size -= i_ret;
1047 } 1047 }
1048 b_ret = ocfs2_xattr_block_list(dentry->d_inode, di, 1048 b_ret = ocfs2_xattr_block_list(d_inode(dentry), di,
1049 buffer, size); 1049 buffer, size);
1050 if (b_ret < 0) 1050 if (b_ret < 0)
1051 i_ret = 0; 1051 i_ret = 0;
1052 } 1052 }
1053 up_read(&oi->ip_xattr_sem); 1053 up_read(&oi->ip_xattr_sem);
1054 ocfs2_inode_unlock(dentry->d_inode, 0); 1054 ocfs2_inode_unlock(d_inode(dentry), 0);
1055 1055
1056 brelse(di_bh); 1056 brelse(di_bh);
1057 1057
@@ -7249,7 +7249,7 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
7249{ 7249{
7250 if (strcmp(name, "") == 0) 7250 if (strcmp(name, "") == 0)
7251 return -EINVAL; 7251 return -EINVAL;
7252 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, 7252 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
7253 name, buffer, size); 7253 name, buffer, size);
7254} 7254}
7255 7255
@@ -7259,7 +7259,7 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
7259 if (strcmp(name, "") == 0) 7259 if (strcmp(name, "") == 0)
7260 return -EINVAL; 7260 return -EINVAL;
7261 7261
7262 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, 7262 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
7263 name, value, size, flags); 7263 name, value, size, flags);
7264} 7264}
7265 7265
@@ -7339,7 +7339,7 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
7339{ 7339{
7340 if (strcmp(name, "") == 0) 7340 if (strcmp(name, "") == 0)
7341 return -EINVAL; 7341 return -EINVAL;
7342 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, 7342 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
7343 name, buffer, size); 7343 name, buffer, size);
7344} 7344}
7345 7345
@@ -7349,7 +7349,7 @@ static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
7349 if (strcmp(name, "") == 0) 7349 if (strcmp(name, "") == 0)
7350 return -EINVAL; 7350 return -EINVAL;
7351 7351
7352 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, 7352 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
7353 name, value, size, flags); 7353 name, value, size, flags);
7354} 7354}
7355 7355
@@ -7391,7 +7391,7 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
7391 return -EINVAL; 7391 return -EINVAL;
7392 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7392 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7393 return -EOPNOTSUPP; 7393 return -EOPNOTSUPP;
7394 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_USER, name, 7394 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name,
7395 buffer, size); 7395 buffer, size);
7396} 7396}
7397 7397
@@ -7405,7 +7405,7 @@ static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
7405 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7405 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7406 return -EOPNOTSUPP; 7406 return -EOPNOTSUPP;
7407 7407
7408 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_USER, 7408 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER,
7409 name, value, size, flags); 7409 name, value, size, flags);
7410} 7410}
7411 7411
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index 1b8e9e8405b2..f833bf8d5792 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -110,7 +110,7 @@ int omfs_make_empty(struct inode *inode, struct super_block *sb)
110 110
111static int omfs_add_link(struct dentry *dentry, struct inode *inode) 111static int omfs_add_link(struct dentry *dentry, struct inode *inode)
112{ 112{
113 struct inode *dir = dentry->d_parent->d_inode; 113 struct inode *dir = d_inode(dentry->d_parent);
114 const char *name = dentry->d_name.name; 114 const char *name = dentry->d_name.name;
115 int namelen = dentry->d_name.len; 115 int namelen = dentry->d_name.len;
116 struct omfs_inode *oi; 116 struct omfs_inode *oi;
@@ -155,7 +155,7 @@ out:
155 155
156static int omfs_delete_entry(struct dentry *dentry) 156static int omfs_delete_entry(struct dentry *dentry)
157{ 157{
158 struct inode *dir = dentry->d_parent->d_inode; 158 struct inode *dir = d_inode(dentry->d_parent);
159 struct inode *dirty; 159 struct inode *dirty;
160 const char *name = dentry->d_name.name; 160 const char *name = dentry->d_name.name;
161 int namelen = dentry->d_name.len; 161 int namelen = dentry->d_name.len;
@@ -237,7 +237,7 @@ static int omfs_dir_is_empty(struct inode *inode)
237 237
238static int omfs_remove(struct inode *dir, struct dentry *dentry) 238static int omfs_remove(struct inode *dir, struct dentry *dentry)
239{ 239{
240 struct inode *inode = dentry->d_inode; 240 struct inode *inode = d_inode(dentry);
241 int ret; 241 int ret;
242 242
243 243
@@ -373,8 +373,8 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
373static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, 373static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
374 struct inode *new_dir, struct dentry *new_dentry) 374 struct inode *new_dir, struct dentry *new_dentry)
375{ 375{
376 struct inode *new_inode = new_dentry->d_inode; 376 struct inode *new_inode = d_inode(new_dentry);
377 struct inode *old_inode = old_dentry->d_inode; 377 struct inode *old_inode = d_inode(old_dentry);
378 int err; 378 int err;
379 379
380 if (new_inode) { 380 if (new_inode) {
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index f993be7f2156..d9e26cfbb793 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -346,7 +346,7 @@ const struct file_operations omfs_file_operations = {
346 346
347static int omfs_setattr(struct dentry *dentry, struct iattr *attr) 347static int omfs_setattr(struct dentry *dentry, struct iattr *attr)
348{ 348{
349 struct inode *inode = dentry->d_inode; 349 struct inode *inode = d_inode(dentry);
350 int error; 350 int error;
351 351
352 error = inode_change_ok(inode, attr); 352 error = inode_change_ok(inode, attr);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3f3d7aeb0712..a3d6b559178b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -169,7 +169,7 @@ static int get_task_root(struct task_struct *task, struct path *root)
169 169
170static int proc_cwd_link(struct dentry *dentry, struct path *path) 170static int proc_cwd_link(struct dentry *dentry, struct path *path)
171{ 171{
172 struct task_struct *task = get_proc_task(dentry->d_inode); 172 struct task_struct *task = get_proc_task(d_inode(dentry));
173 int result = -ENOENT; 173 int result = -ENOENT;
174 174
175 if (task) { 175 if (task) {
@@ -186,7 +186,7 @@ static int proc_cwd_link(struct dentry *dentry, struct path *path)
186 186
187static int proc_root_link(struct dentry *dentry, struct path *path) 187static int proc_root_link(struct dentry *dentry, struct path *path)
188{ 188{
189 struct task_struct *task = get_proc_task(dentry->d_inode); 189 struct task_struct *task = get_proc_task(d_inode(dentry));
190 int result = -ENOENT; 190 int result = -ENOENT;
191 191
192 if (task) { 192 if (task) {
@@ -505,7 +505,7 @@ static int proc_fd_access_allowed(struct inode *inode)
505int proc_setattr(struct dentry *dentry, struct iattr *attr) 505int proc_setattr(struct dentry *dentry, struct iattr *attr)
506{ 506{
507 int error; 507 int error;
508 struct inode *inode = dentry->d_inode; 508 struct inode *inode = d_inode(dentry);
509 509
510 if (attr->ia_valid & ATTR_MODE) 510 if (attr->ia_valid & ATTR_MODE)
511 return -EPERM; 511 return -EPERM;
@@ -1353,7 +1353,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
1353 struct mm_struct *mm; 1353 struct mm_struct *mm;
1354 struct file *exe_file; 1354 struct file *exe_file;
1355 1355
1356 task = get_proc_task(dentry->d_inode); 1356 task = get_proc_task(d_inode(dentry));
1357 if (!task) 1357 if (!task)
1358 return -ENOENT; 1358 return -ENOENT;
1359 mm = get_task_mm(task); 1359 mm = get_task_mm(task);
@@ -1373,7 +1373,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
1373 1373
1374static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) 1374static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
1375{ 1375{
1376 struct inode *inode = dentry->d_inode; 1376 struct inode *inode = d_inode(dentry);
1377 struct path path; 1377 struct path path;
1378 int error = -EACCES; 1378 int error = -EACCES;
1379 1379
@@ -1418,7 +1418,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
1418static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen) 1418static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
1419{ 1419{
1420 int error = -EACCES; 1420 int error = -EACCES;
1421 struct inode *inode = dentry->d_inode; 1421 struct inode *inode = d_inode(dentry);
1422 struct path path; 1422 struct path path;
1423 1423
1424 /* Are we allowed to snoop on the tasks file descriptors? */ 1424 /* Are we allowed to snoop on the tasks file descriptors? */
@@ -1488,7 +1488,7 @@ out_unlock:
1488 1488
1489int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 1489int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1490{ 1490{
1491 struct inode *inode = dentry->d_inode; 1491 struct inode *inode = d_inode(dentry);
1492 struct task_struct *task; 1492 struct task_struct *task;
1493 const struct cred *cred; 1493 const struct cred *cred;
1494 struct pid_namespace *pid = dentry->d_sb->s_fs_info; 1494 struct pid_namespace *pid = dentry->d_sb->s_fs_info;
@@ -1545,7 +1545,7 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
1545 if (flags & LOOKUP_RCU) 1545 if (flags & LOOKUP_RCU)
1546 return -ECHILD; 1546 return -ECHILD;
1547 1547
1548 inode = dentry->d_inode; 1548 inode = d_inode(dentry);
1549 task = get_proc_task(inode); 1549 task = get_proc_task(inode);
1550 1550
1551 if (task) { 1551 if (task) {
@@ -1579,7 +1579,7 @@ int pid_delete_dentry(const struct dentry *dentry)
1579 * If so, then don't put the dentry on the lru list, 1579 * If so, then don't put the dentry on the lru list,
1580 * kill it immediately. 1580 * kill it immediately.
1581 */ 1581 */
1582 return proc_inode_is_dead(dentry->d_inode); 1582 return proc_inode_is_dead(d_inode(dentry));
1583} 1583}
1584 1584
1585const struct dentry_operations pid_dentry_operations = 1585const struct dentry_operations pid_dentry_operations =
@@ -1617,12 +1617,12 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
1617 child = d_alloc(dir, &qname); 1617 child = d_alloc(dir, &qname);
1618 if (!child) 1618 if (!child)
1619 goto end_instantiate; 1619 goto end_instantiate;
1620 if (instantiate(dir->d_inode, child, task, ptr) < 0) { 1620 if (instantiate(d_inode(dir), child, task, ptr) < 0) {
1621 dput(child); 1621 dput(child);
1622 goto end_instantiate; 1622 goto end_instantiate;
1623 } 1623 }
1624 } 1624 }
1625 inode = child->d_inode; 1625 inode = d_inode(child);
1626 ino = inode->i_ino; 1626 ino = inode->i_ino;
1627 type = inode->i_mode >> 12; 1627 type = inode->i_mode >> 12;
1628 dput(child); 1628 dput(child);
@@ -1665,7 +1665,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
1665 goto out_notask; 1665 goto out_notask;
1666 } 1666 }
1667 1667
1668 inode = dentry->d_inode; 1668 inode = d_inode(dentry);
1669 task = get_proc_task(inode); 1669 task = get_proc_task(inode);
1670 if (!task) 1670 if (!task)
1671 goto out_notask; 1671 goto out_notask;
@@ -1718,7 +1718,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path)
1718 int rc; 1718 int rc;
1719 1719
1720 rc = -ENOENT; 1720 rc = -ENOENT;
1721 task = get_proc_task(dentry->d_inode); 1721 task = get_proc_task(d_inode(dentry));
1722 if (!task) 1722 if (!task)
1723 goto out; 1723 goto out;
1724 1724
@@ -2851,13 +2851,13 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
2851 return 0; 2851 return 0;
2852 2852
2853 if (pos == TGID_OFFSET - 2) { 2853 if (pos == TGID_OFFSET - 2) {
2854 struct inode *inode = ns->proc_self->d_inode; 2854 struct inode *inode = d_inode(ns->proc_self);
2855 if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK)) 2855 if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK))
2856 return 0; 2856 return 0;
2857 ctx->pos = pos = pos + 1; 2857 ctx->pos = pos = pos + 1;
2858 } 2858 }
2859 if (pos == TGID_OFFSET - 1) { 2859 if (pos == TGID_OFFSET - 1) {
2860 struct inode *inode = ns->proc_thread_self->d_inode; 2860 struct inode *inode = d_inode(ns->proc_thread_self);
2861 if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK)) 2861 if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK))
2862 return 0; 2862 return 0;
2863 ctx->pos = pos = pos + 1; 2863 ctx->pos = pos = pos + 1;
@@ -3176,7 +3176,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
3176 3176
3177static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 3177static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
3178{ 3178{
3179 struct inode *inode = dentry->d_inode; 3179 struct inode *inode = d_inode(dentry);
3180 struct task_struct *p = get_proc_task(inode); 3180 struct task_struct *p = get_proc_task(inode);
3181 generic_fillattr(inode, stat); 3181 generic_fillattr(inode, stat);
3182 3182
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 8e5ad83b629a..a205904a27ae 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -84,7 +84,7 @@ static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags)
84 if (flags & LOOKUP_RCU) 84 if (flags & LOOKUP_RCU)
85 return -ECHILD; 85 return -ECHILD;
86 86
87 inode = dentry->d_inode; 87 inode = d_inode(dentry);
88 task = get_proc_task(inode); 88 task = get_proc_task(inode);
89 fd = proc_fd(inode); 89 fd = proc_fd(inode);
90 90
@@ -144,14 +144,14 @@ static int proc_fd_link(struct dentry *dentry, struct path *path)
144 struct task_struct *task; 144 struct task_struct *task;
145 int ret = -ENOENT; 145 int ret = -ENOENT;
146 146
147 task = get_proc_task(dentry->d_inode); 147 task = get_proc_task(d_inode(dentry));
148 if (task) { 148 if (task) {
149 files = get_files_struct(task); 149 files = get_files_struct(task);
150 put_task_struct(task); 150 put_task_struct(task);
151 } 151 }
152 152
153 if (files) { 153 if (files) {
154 int fd = proc_fd(dentry->d_inode); 154 int fd = proc_fd(d_inode(dentry));
155 struct file *fd_file; 155 struct file *fd_file;
156 156
157 spin_lock(&files->file_lock); 157 spin_lock(&files->file_lock);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index be65b2082135..df6327a2b865 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -101,7 +101,7 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir,
101 101
102static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) 102static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
103{ 103{
104 struct inode *inode = dentry->d_inode; 104 struct inode *inode = d_inode(dentry);
105 struct proc_dir_entry *de = PDE(inode); 105 struct proc_dir_entry *de = PDE(inode);
106 int error; 106 int error;
107 107
@@ -120,7 +120,7 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
120static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, 120static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
121 struct kstat *stat) 121 struct kstat *stat)
122{ 122{
123 struct inode *inode = dentry->d_inode; 123 struct inode *inode = d_inode(dentry);
124 struct proc_dir_entry *de = PDE(inode); 124 struct proc_dir_entry *de = PDE(inode);
125 if (de && de->nlink) 125 if (de && de->nlink)
126 set_nlink(inode, de->nlink); 126 set_nlink(inode, de->nlink);
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 7697b6621cfd..8272aaba1bb0 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -396,7 +396,7 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
396 396
397static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) 397static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
398{ 398{
399 struct proc_dir_entry *pde = PDE(dentry->d_inode); 399 struct proc_dir_entry *pde = PDE(d_inode(dentry));
400 if (unlikely(!use_pde(pde))) 400 if (unlikely(!use_pde(pde)))
401 return ERR_PTR(-EINVAL); 401 return ERR_PTR(-EINVAL);
402 nd_set_link(nd, pde->data); 402 nd_set_link(nd, pde->data);
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index c9eac4563fa8..e512642dbbdc 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -32,7 +32,7 @@ static const struct proc_ns_operations *ns_entries[] = {
32 32
33static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) 33static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
34{ 34{
35 struct inode *inode = dentry->d_inode; 35 struct inode *inode = d_inode(dentry);
36 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 36 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
37 struct task_struct *task; 37 struct task_struct *task;
38 struct path ns_path; 38 struct path ns_path;
@@ -53,7 +53,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
53 53
54static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) 54static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen)
55{ 55{
56 struct inode *inode = dentry->d_inode; 56 struct inode *inode = d_inode(dentry);
57 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 57 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
58 struct task_struct *task; 58 struct task_struct *task;
59 char name[50]; 59 char name[50];
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 1bde894bc624..350984a19c83 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -142,7 +142,7 @@ static struct dentry *proc_tgid_net_lookup(struct inode *dir,
142static int proc_tgid_net_getattr(struct vfsmount *mnt, struct dentry *dentry, 142static int proc_tgid_net_getattr(struct vfsmount *mnt, struct dentry *dentry,
143 struct kstat *stat) 143 struct kstat *stat)
144{ 144{
145 struct inode *inode = dentry->d_inode; 145 struct inode *inode = d_inode(dentry);
146 struct net *net; 146 struct net *net;
147 147
148 net = get_proc_task_net(inode); 148 net = get_proc_task_net(inode);
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f92d5dd578a4..fea2561d773b 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -604,7 +604,7 @@ static bool proc_sys_fill_cache(struct file *file,
604 return false; 604 return false;
605 } 605 }
606 } 606 }
607 inode = child->d_inode; 607 inode = d_inode(child);
608 ino = inode->i_ino; 608 ino = inode->i_ino;
609 type = inode->i_mode >> 12; 609 type = inode->i_mode >> 12;
610 dput(child); 610 dput(child);
@@ -710,7 +710,7 @@ static int proc_sys_permission(struct inode *inode, int mask)
710 710
711static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) 711static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
712{ 712{
713 struct inode *inode = dentry->d_inode; 713 struct inode *inode = d_inode(dentry);
714 int error; 714 int error;
715 715
716 if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) 716 if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
@@ -727,7 +727,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
727 727
728static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 728static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
729{ 729{
730 struct inode *inode = dentry->d_inode; 730 struct inode *inode = d_inode(dentry);
731 struct ctl_table_header *head = grab_header(inode); 731 struct ctl_table_header *head = grab_header(inode);
732 struct ctl_table *table = PROC_I(inode)->sysctl_entry; 732 struct ctl_table *table = PROC_I(inode)->sysctl_entry;
733 733
@@ -773,12 +773,12 @@ static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags)
773{ 773{
774 if (flags & LOOKUP_RCU) 774 if (flags & LOOKUP_RCU)
775 return -ECHILD; 775 return -ECHILD;
776 return !PROC_I(dentry->d_inode)->sysctl->unregistering; 776 return !PROC_I(d_inode(dentry))->sysctl->unregistering;
777} 777}
778 778
779static int proc_sys_delete(const struct dentry *dentry) 779static int proc_sys_delete(const struct dentry *dentry)
780{ 780{
781 return !!PROC_I(dentry->d_inode)->sysctl->unregistering; 781 return !!PROC_I(d_inode(dentry))->sysctl->unregistering;
782} 782}
783 783
784static int sysctl_is_seen(struct ctl_table_header *p) 784static int sysctl_is_seen(struct ctl_table_header *p)
@@ -805,7 +805,7 @@ static int proc_sys_compare(const struct dentry *parent, const struct dentry *de
805 /* Although proc doesn't have negative dentries, rcu-walk means 805 /* Although proc doesn't have negative dentries, rcu-walk means
806 * that inode here can be NULL */ 806 * that inode here can be NULL */
807 /* AV: can it, indeed? */ 807 /* AV: can it, indeed? */
808 inode = ACCESS_ONCE(dentry->d_inode); 808 inode = d_inode_rcu(dentry);
809 if (!inode) 809 if (!inode)
810 return 1; 810 return 1;
811 if (name->len != len) 811 if (name->len != len)
diff --git a/fs/proc/root.c b/fs/proc/root.c
index e74ac9f1a2c0..b7fa4bfe896a 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -195,7 +195,7 @@ void __init proc_root_init(void)
195static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat 195static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
196) 196)
197{ 197{
198 generic_fillattr(dentry->d_inode, stat); 198 generic_fillattr(d_inode(dentry), stat);
199 stat->nlink = proc_root.nlink + nr_processes(); 199 stat->nlink = proc_root.nlink + nr_processes();
200 return 0; 200 return 0;
201} 201}
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 4348bb8907c2..6195b4a7c3b1 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -46,7 +46,7 @@ static unsigned self_inum;
46 46
47int proc_setup_self(struct super_block *s) 47int proc_setup_self(struct super_block *s)
48{ 48{
49 struct inode *root_inode = s->s_root->d_inode; 49 struct inode *root_inode = d_inode(s->s_root);
50 struct pid_namespace *ns = s->s_fs_info; 50 struct pid_namespace *ns = s->s_fs_info;
51 struct dentry *self; 51 struct dentry *self;
52 52
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 59075b509df3..a8371993b4fb 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -47,7 +47,7 @@ static unsigned thread_self_inum;
47 47
48int proc_setup_thread_self(struct super_block *s) 48int proc_setup_thread_self(struct super_block *s)
49{ 49{
50 struct inode *root_inode = s->s_root->d_inode; 50 struct inode *root_inode = d_inode(s->s_root);
51 struct pid_namespace *ns = s->s_fs_info; 51 struct pid_namespace *ns = s->s_fs_info;
52 struct dentry *thread_self; 52 struct dentry *thread_self;
53 53
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index b32ce53d24ee..9f73797f95a6 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -190,7 +190,7 @@ static const struct file_operations pstore_file_operations = {
190 */ 190 */
191static int pstore_unlink(struct inode *dir, struct dentry *dentry) 191static int pstore_unlink(struct inode *dir, struct dentry *dentry)
192{ 192{
193 struct pstore_private *p = dentry->d_inode->i_private; 193 struct pstore_private *p = d_inode(dentry)->i_private;
194 int err; 194 int err;
195 195
196 err = pstore_check_syslog_permissions(p); 196 err = pstore_check_syslog_permissions(p);
@@ -199,7 +199,7 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
199 199
200 if (p->psi->erase) 200 if (p->psi->erase)
201 p->psi->erase(p->type, p->id, p->count, 201 p->psi->erase(p->type, p->id, p->count,
202 dentry->d_inode->i_ctime, p->psi); 202 d_inode(dentry)->i_ctime, p->psi);
203 else 203 else
204 return -EPERM; 204 return -EPERM;
205 205
@@ -373,7 +373,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
373 break; 373 break;
374 } 374 }
375 375
376 mutex_lock(&root->d_inode->i_mutex); 376 mutex_lock(&d_inode(root)->i_mutex);
377 377
378 dentry = d_alloc_name(root, name); 378 dentry = d_alloc_name(root, name);
379 if (!dentry) 379 if (!dentry)
@@ -393,12 +393,12 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
393 list_add(&private->list, &allpstore); 393 list_add(&private->list, &allpstore);
394 spin_unlock_irqrestore(&allpstore_lock, flags); 394 spin_unlock_irqrestore(&allpstore_lock, flags);
395 395
396 mutex_unlock(&root->d_inode->i_mutex); 396 mutex_unlock(&d_inode(root)->i_mutex);
397 397
398 return 0; 398 return 0;
399 399
400fail_lockedalloc: 400fail_lockedalloc:
401 mutex_unlock(&root->d_inode->i_mutex); 401 mutex_unlock(&d_inode(root)->i_mutex);
402 kfree(private); 402 kfree(private);
403fail_alloc: 403fail_alloc:
404 iput(inode); 404 iput(inode);
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 44e73923670d..32d2e1a9774c 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -182,7 +182,7 @@ static const char *qnx6_checkroot(struct super_block *s)
182 static char match_root[2][3] = {".\0\0", "..\0"}; 182 static char match_root[2][3] = {".\0\0", "..\0"};
183 int i, error = 0; 183 int i, error = 0;
184 struct qnx6_dir_entry *dir_entry; 184 struct qnx6_dir_entry *dir_entry;
185 struct inode *root = s->s_root->d_inode; 185 struct inode *root = d_inode(s->s_root);
186 struct address_space *mapping = root->i_mapping; 186 struct address_space *mapping = root->i_mapping;
187 struct page *page = read_mapping_page(mapping, 0, NULL); 187 struct page *page = read_mapping_page(mapping, 0, NULL);
188 if (IS_ERR(page)) 188 if (IS_ERR(page))
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 0b38befa69f3..ba1323a94924 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -163,7 +163,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
163 */ 163 */
164static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) 164static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
165{ 165{
166 struct inode *inode = dentry->d_inode; 166 struct inode *inode = d_inode(dentry);
167 unsigned int old_ia_valid = ia->ia_valid; 167 unsigned int old_ia_valid = ia->ia_valid;
168 int ret = 0; 168 int ret = 0;
169 169
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 0a7dc941aaf4..4a024e2ceb9f 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -53,8 +53,8 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
53static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh) 53static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh)
54{ 54{
55 struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root; 55 struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root;
56 return (privroot->d_inode && 56 return (d_really_is_positive(privroot) &&
57 deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid); 57 deh->deh_objectid == INODE_PKEY(d_inode(privroot))->k_objectid);
58} 58}
59 59
60int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx) 60int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 742242b60972..f6f2fbad9777 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -3308,7 +3308,7 @@ static ssize_t reiserfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
3308 3308
3309int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) 3309int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3310{ 3310{
3311 struct inode *inode = dentry->d_inode; 3311 struct inode *inode = d_inode(dentry);
3312 unsigned int ia_valid; 3312 unsigned int ia_valid;
3313 int error; 3313 int error;
3314 3314
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index cd11358b10c7..b55a074653d7 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -400,7 +400,7 @@ struct dentry *reiserfs_get_parent(struct dentry *child)
400 struct inode *inode = NULL; 400 struct inode *inode = NULL;
401 struct reiserfs_dir_entry de; 401 struct reiserfs_dir_entry de;
402 INITIALIZE_PATH(path_to_entry); 402 INITIALIZE_PATH(path_to_entry);
403 struct inode *dir = child->d_inode; 403 struct inode *dir = d_inode(child);
404 404
405 if (dir->i_nlink == 0) { 405 if (dir->i_nlink == 0) {
406 return ERR_PTR(-ENOENT); 406 return ERR_PTR(-ENOENT);
@@ -917,7 +917,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
917 goto end_rmdir; 917 goto end_rmdir;
918 } 918 }
919 919
920 inode = dentry->d_inode; 920 inode = d_inode(dentry);
921 921
922 reiserfs_update_inode_transaction(inode); 922 reiserfs_update_inode_transaction(inode);
923 reiserfs_update_inode_transaction(dir); 923 reiserfs_update_inode_transaction(dir);
@@ -987,7 +987,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
987 987
988 dquot_initialize(dir); 988 dquot_initialize(dir);
989 989
990 inode = dentry->d_inode; 990 inode = d_inode(dentry);
991 991
992 /* 992 /*
993 * in this transaction we can be doing at max two balancings and 993 * in this transaction we can be doing at max two balancings and
@@ -1174,7 +1174,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1174 struct dentry *dentry) 1174 struct dentry *dentry)
1175{ 1175{
1176 int retval; 1176 int retval;
1177 struct inode *inode = old_dentry->d_inode; 1177 struct inode *inode = d_inode(old_dentry);
1178 struct reiserfs_transaction_handle th; 1178 struct reiserfs_transaction_handle th;
1179 /* 1179 /*
1180 * We need blocks for transaction + update of quotas for 1180 * We need blocks for transaction + update of quotas for
@@ -1311,8 +1311,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1311 dquot_initialize(old_dir); 1311 dquot_initialize(old_dir);
1312 dquot_initialize(new_dir); 1312 dquot_initialize(new_dir);
1313 1313
1314 old_inode = old_dentry->d_inode; 1314 old_inode = d_inode(old_dentry);
1315 new_dentry_inode = new_dentry->d_inode; 1315 new_dentry_inode = d_inode(new_dentry);
1316 1316
1317 /* 1317 /*
1318 * make sure that oldname still exists and points to an object we 1318 * make sure that oldname still exists and points to an object we
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 71fbbe3e2dab..558ef2ce1bdd 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1687,7 +1687,7 @@ static __u32 find_hash_out(struct super_block *s)
1687 __u32 hash = DEFAULT_HASH; 1687 __u32 hash = DEFAULT_HASH;
1688 __u32 deh_hashval, teahash, r5hash, yurahash; 1688 __u32 deh_hashval, teahash, r5hash, yurahash;
1689 1689
1690 inode = s->s_root->d_inode; 1690 inode = d_inode(s->s_root);
1691 1691
1692 make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3); 1692 make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3);
1693 retval = search_by_entry_key(s, &key, &path, &de); 1693 retval = search_by_entry_key(s, &key, &path, &de);
@@ -2347,7 +2347,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2347 err = -EXDEV; 2347 err = -EXDEV;
2348 goto out; 2348 goto out;
2349 } 2349 }
2350 inode = path->dentry->d_inode; 2350 inode = d_inode(path->dentry);
2351 /* 2351 /*
2352 * We must not pack tails for quota files on reiserfs for quota 2352 * We must not pack tails for quota files on reiserfs for quota
2353 * IO to work 2353 * IO to work
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 4e781e697c90..e87f9b52bf06 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -87,9 +87,9 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry)
87 87
88 BUG_ON(!mutex_is_locked(&dir->i_mutex)); 88 BUG_ON(!mutex_is_locked(&dir->i_mutex));
89 89
90 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 90 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
91 error = dir->i_op->unlink(dir, dentry); 91 error = dir->i_op->unlink(dir, dentry);
92 mutex_unlock(&dentry->d_inode->i_mutex); 92 mutex_unlock(&d_inode(dentry)->i_mutex);
93 93
94 if (!error) 94 if (!error)
95 d_delete(dentry); 95 d_delete(dentry);
@@ -102,11 +102,11 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry)
102 102
103 BUG_ON(!mutex_is_locked(&dir->i_mutex)); 103 BUG_ON(!mutex_is_locked(&dir->i_mutex));
104 104
105 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 105 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD);
106 error = dir->i_op->rmdir(dir, dentry); 106 error = dir->i_op->rmdir(dir, dentry);
107 if (!error) 107 if (!error)
108 dentry->d_inode->i_flags |= S_DEAD; 108 d_inode(dentry)->i_flags |= S_DEAD;
109 mutex_unlock(&dentry->d_inode->i_mutex); 109 mutex_unlock(&d_inode(dentry)->i_mutex);
110 if (!error) 110 if (!error)
111 d_delete(dentry); 111 d_delete(dentry);
112 112
@@ -120,26 +120,26 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags)
120 struct dentry *privroot = REISERFS_SB(sb)->priv_root; 120 struct dentry *privroot = REISERFS_SB(sb)->priv_root;
121 struct dentry *xaroot; 121 struct dentry *xaroot;
122 122
123 if (!privroot->d_inode) 123 if (d_really_is_negative(privroot))
124 return ERR_PTR(-ENODATA); 124 return ERR_PTR(-ENODATA);
125 125
126 mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR); 126 mutex_lock_nested(&d_inode(privroot)->i_mutex, I_MUTEX_XATTR);
127 127
128 xaroot = dget(REISERFS_SB(sb)->xattr_root); 128 xaroot = dget(REISERFS_SB(sb)->xattr_root);
129 if (!xaroot) 129 if (!xaroot)
130 xaroot = ERR_PTR(-ENODATA); 130 xaroot = ERR_PTR(-ENODATA);
131 else if (!xaroot->d_inode) { 131 else if (d_really_is_negative(xaroot)) {
132 int err = -ENODATA; 132 int err = -ENODATA;
133 133
134 if (xattr_may_create(flags)) 134 if (xattr_may_create(flags))
135 err = xattr_mkdir(privroot->d_inode, xaroot, 0700); 135 err = xattr_mkdir(d_inode(privroot), xaroot, 0700);
136 if (err) { 136 if (err) {
137 dput(xaroot); 137 dput(xaroot);
138 xaroot = ERR_PTR(err); 138 xaroot = ERR_PTR(err);
139 } 139 }
140 } 140 }
141 141
142 mutex_unlock(&privroot->d_inode->i_mutex); 142 mutex_unlock(&d_inode(privroot)->i_mutex);
143 return xaroot; 143 return xaroot;
144} 144}
145 145
@@ -156,21 +156,21 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags)
156 le32_to_cpu(INODE_PKEY(inode)->k_objectid), 156 le32_to_cpu(INODE_PKEY(inode)->k_objectid),
157 inode->i_generation); 157 inode->i_generation);
158 158
159 mutex_lock_nested(&xaroot->d_inode->i_mutex, I_MUTEX_XATTR); 159 mutex_lock_nested(&d_inode(xaroot)->i_mutex, I_MUTEX_XATTR);
160 160
161 xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); 161 xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf));
162 if (!IS_ERR(xadir) && !xadir->d_inode) { 162 if (!IS_ERR(xadir) && d_really_is_negative(xadir)) {
163 int err = -ENODATA; 163 int err = -ENODATA;
164 164
165 if (xattr_may_create(flags)) 165 if (xattr_may_create(flags))
166 err = xattr_mkdir(xaroot->d_inode, xadir, 0700); 166 err = xattr_mkdir(d_inode(xaroot), xadir, 0700);
167 if (err) { 167 if (err) {
168 dput(xadir); 168 dput(xadir);
169 xadir = ERR_PTR(err); 169 xadir = ERR_PTR(err);
170 } 170 }
171 } 171 }
172 172
173 mutex_unlock(&xaroot->d_inode->i_mutex); 173 mutex_unlock(&d_inode(xaroot)->i_mutex);
174 dput(xaroot); 174 dput(xaroot);
175 return xadir; 175 return xadir;
176} 176}
@@ -195,7 +195,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen,
195 container_of(ctx, struct reiserfs_dentry_buf, ctx); 195 container_of(ctx, struct reiserfs_dentry_buf, ctx);
196 struct dentry *dentry; 196 struct dentry *dentry;
197 197
198 WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); 198 WARN_ON_ONCE(!mutex_is_locked(&d_inode(dbuf->xadir)->i_mutex));
199 199
200 if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) 200 if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
201 return -ENOSPC; 201 return -ENOSPC;
@@ -207,7 +207,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen,
207 dentry = lookup_one_len(name, dbuf->xadir, namelen); 207 dentry = lookup_one_len(name, dbuf->xadir, namelen);
208 if (IS_ERR(dentry)) { 208 if (IS_ERR(dentry)) {
209 return PTR_ERR(dentry); 209 return PTR_ERR(dentry);
210 } else if (!dentry->d_inode) { 210 } else if (d_really_is_negative(dentry)) {
211 /* A directory entry exists, but no file? */ 211 /* A directory entry exists, but no file? */
212 reiserfs_error(dentry->d_sb, "xattr-20003", 212 reiserfs_error(dentry->d_sb, "xattr-20003",
213 "Corrupted directory: xattr %pd listed but " 213 "Corrupted directory: xattr %pd listed but "
@@ -249,16 +249,16 @@ static int reiserfs_for_each_xattr(struct inode *inode,
249 if (IS_ERR(dir)) { 249 if (IS_ERR(dir)) {
250 err = PTR_ERR(dir); 250 err = PTR_ERR(dir);
251 goto out; 251 goto out;
252 } else if (!dir->d_inode) { 252 } else if (d_really_is_negative(dir)) {
253 err = 0; 253 err = 0;
254 goto out_dir; 254 goto out_dir;
255 } 255 }
256 256
257 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); 257 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR);
258 258
259 buf.xadir = dir; 259 buf.xadir = dir;
260 while (1) { 260 while (1) {
261 err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); 261 err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx);
262 if (err) 262 if (err)
263 break; 263 break;
264 if (!buf.count) 264 if (!buf.count)
@@ -276,7 +276,7 @@ static int reiserfs_for_each_xattr(struct inode *inode,
276 break; 276 break;
277 buf.count = 0; 277 buf.count = 0;
278 } 278 }
279 mutex_unlock(&dir->d_inode->i_mutex); 279 mutex_unlock(&d_inode(dir)->i_mutex);
280 280
281 cleanup_dentry_buf(&buf); 281 cleanup_dentry_buf(&buf);
282 282
@@ -298,13 +298,13 @@ static int reiserfs_for_each_xattr(struct inode *inode,
298 if (!err) { 298 if (!err) {
299 int jerror; 299 int jerror;
300 300
301 mutex_lock_nested(&dir->d_parent->d_inode->i_mutex, 301 mutex_lock_nested(&d_inode(dir->d_parent)->i_mutex,
302 I_MUTEX_XATTR); 302 I_MUTEX_XATTR);
303 err = action(dir, data); 303 err = action(dir, data);
304 reiserfs_write_lock(inode->i_sb); 304 reiserfs_write_lock(inode->i_sb);
305 jerror = journal_end(&th); 305 jerror = journal_end(&th);
306 reiserfs_write_unlock(inode->i_sb); 306 reiserfs_write_unlock(inode->i_sb);
307 mutex_unlock(&dir->d_parent->d_inode->i_mutex); 307 mutex_unlock(&d_inode(dir->d_parent)->i_mutex);
308 err = jerror ?: err; 308 err = jerror ?: err;
309 } 309 }
310 } 310 }
@@ -319,7 +319,7 @@ out:
319 319
320static int delete_one_xattr(struct dentry *dentry, void *data) 320static int delete_one_xattr(struct dentry *dentry, void *data)
321{ 321{
322 struct inode *dir = dentry->d_parent->d_inode; 322 struct inode *dir = d_inode(dentry->d_parent);
323 323
324 /* This is the xattr dir, handle specially. */ 324 /* This is the xattr dir, handle specially. */
325 if (d_is_dir(dentry)) 325 if (d_is_dir(dentry))
@@ -384,27 +384,27 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name,
384 if (IS_ERR(xadir)) 384 if (IS_ERR(xadir))
385 return ERR_CAST(xadir); 385 return ERR_CAST(xadir);
386 386
387 mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); 387 mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR);
388 xafile = lookup_one_len(name, xadir, strlen(name)); 388 xafile = lookup_one_len(name, xadir, strlen(name));
389 if (IS_ERR(xafile)) { 389 if (IS_ERR(xafile)) {
390 err = PTR_ERR(xafile); 390 err = PTR_ERR(xafile);
391 goto out; 391 goto out;
392 } 392 }
393 393
394 if (xafile->d_inode && (flags & XATTR_CREATE)) 394 if (d_really_is_positive(xafile) && (flags & XATTR_CREATE))
395 err = -EEXIST; 395 err = -EEXIST;
396 396
397 if (!xafile->d_inode) { 397 if (d_really_is_negative(xafile)) {
398 err = -ENODATA; 398 err = -ENODATA;
399 if (xattr_may_create(flags)) 399 if (xattr_may_create(flags))
400 err = xattr_create(xadir->d_inode, xafile, 400 err = xattr_create(d_inode(xadir), xafile,
401 0700|S_IFREG); 401 0700|S_IFREG);
402 } 402 }
403 403
404 if (err) 404 if (err)
405 dput(xafile); 405 dput(xafile);
406out: 406out:
407 mutex_unlock(&xadir->d_inode->i_mutex); 407 mutex_unlock(&d_inode(xadir)->i_mutex);
408 dput(xadir); 408 dput(xadir);
409 if (err) 409 if (err)
410 return ERR_PTR(err); 410 return ERR_PTR(err);
@@ -469,21 +469,21 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name)
469 if (IS_ERR(xadir)) 469 if (IS_ERR(xadir))
470 return PTR_ERR(xadir); 470 return PTR_ERR(xadir);
471 471
472 mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); 472 mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR);
473 dentry = lookup_one_len(name, xadir, strlen(name)); 473 dentry = lookup_one_len(name, xadir, strlen(name));
474 if (IS_ERR(dentry)) { 474 if (IS_ERR(dentry)) {
475 err = PTR_ERR(dentry); 475 err = PTR_ERR(dentry);
476 goto out_dput; 476 goto out_dput;
477 } 477 }
478 478
479 if (dentry->d_inode) { 479 if (d_really_is_positive(dentry)) {
480 err = xattr_unlink(xadir->d_inode, dentry); 480 err = xattr_unlink(d_inode(xadir), dentry);
481 update_ctime(inode); 481 update_ctime(inode);
482 } 482 }
483 483
484 dput(dentry); 484 dput(dentry);
485out_dput: 485out_dput:
486 mutex_unlock(&xadir->d_inode->i_mutex); 486 mutex_unlock(&d_inode(xadir)->i_mutex);
487 dput(xadir); 487 dput(xadir);
488 return err; 488 return err;
489} 489}
@@ -533,7 +533,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
533 else 533 else
534 chunk = buffer_size - buffer_pos; 534 chunk = buffer_size - buffer_pos;
535 535
536 page = reiserfs_get_page(dentry->d_inode, file_pos); 536 page = reiserfs_get_page(d_inode(dentry), file_pos);
537 if (IS_ERR(page)) { 537 if (IS_ERR(page)) {
538 err = PTR_ERR(page); 538 err = PTR_ERR(page);
539 goto out_unlock; 539 goto out_unlock;
@@ -573,18 +573,18 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
573 } 573 }
574 574
575 new_size = buffer_size + sizeof(struct reiserfs_xattr_header); 575 new_size = buffer_size + sizeof(struct reiserfs_xattr_header);
576 if (!err && new_size < i_size_read(dentry->d_inode)) { 576 if (!err && new_size < i_size_read(d_inode(dentry))) {
577 struct iattr newattrs = { 577 struct iattr newattrs = {
578 .ia_ctime = current_fs_time(inode->i_sb), 578 .ia_ctime = current_fs_time(inode->i_sb),
579 .ia_size = new_size, 579 .ia_size = new_size,
580 .ia_valid = ATTR_SIZE | ATTR_CTIME, 580 .ia_valid = ATTR_SIZE | ATTR_CTIME,
581 }; 581 };
582 582
583 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); 583 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_XATTR);
584 inode_dio_wait(dentry->d_inode); 584 inode_dio_wait(d_inode(dentry));
585 585
586 err = reiserfs_setattr(dentry, &newattrs); 586 err = reiserfs_setattr(dentry, &newattrs);
587 mutex_unlock(&dentry->d_inode->i_mutex); 587 mutex_unlock(&d_inode(dentry)->i_mutex);
588 } else 588 } else
589 update_ctime(inode); 589 update_ctime(inode);
590out_unlock: 590out_unlock:
@@ -657,7 +657,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
657 657
658 down_read(&REISERFS_I(inode)->i_xattr_sem); 658 down_read(&REISERFS_I(inode)->i_xattr_sem);
659 659
660 isize = i_size_read(dentry->d_inode); 660 isize = i_size_read(d_inode(dentry));
661 661
662 /* Just return the size needed */ 662 /* Just return the size needed */
663 if (buffer == NULL) { 663 if (buffer == NULL) {
@@ -680,7 +680,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
680 else 680 else
681 chunk = isize - file_pos; 681 chunk = isize - file_pos;
682 682
683 page = reiserfs_get_page(dentry->d_inode, file_pos); 683 page = reiserfs_get_page(d_inode(dentry), file_pos);
684 if (IS_ERR(page)) { 684 if (IS_ERR(page)) {
685 err = PTR_ERR(page); 685 err = PTR_ERR(page);
686 goto out_unlock; 686 goto out_unlock;
@@ -775,7 +775,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
775 775
776 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); 776 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
777 777
778 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) 778 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
779 return -EOPNOTSUPP; 779 return -EOPNOTSUPP;
780 780
781 return handler->get(dentry, name, buffer, size, handler->flags); 781 return handler->get(dentry, name, buffer, size, handler->flags);
@@ -784,7 +784,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
784/* 784/*
785 * Inode operation setxattr() 785 * Inode operation setxattr()
786 * 786 *
787 * dentry->d_inode->i_mutex down 787 * d_inode(dentry)->i_mutex down
788 */ 788 */
789int 789int
790reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, 790reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
@@ -794,7 +794,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
794 794
795 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); 795 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
796 796
797 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) 797 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
798 return -EOPNOTSUPP; 798 return -EOPNOTSUPP;
799 799
800 return handler->set(dentry, name, value, size, flags, handler->flags); 800 return handler->set(dentry, name, value, size, flags, handler->flags);
@@ -803,7 +803,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
803/* 803/*
804 * Inode operation removexattr() 804 * Inode operation removexattr()
805 * 805 *
806 * dentry->d_inode->i_mutex down 806 * d_inode(dentry)->i_mutex down
807 */ 807 */
808int reiserfs_removexattr(struct dentry *dentry, const char *name) 808int reiserfs_removexattr(struct dentry *dentry, const char *name)
809{ 809{
@@ -811,7 +811,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)
811 811
812 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); 812 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
813 813
814 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) 814 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
815 return -EOPNOTSUPP; 815 return -EOPNOTSUPP;
816 816
817 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); 817 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags);
@@ -875,14 +875,14 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
875 .size = buffer ? size : 0, 875 .size = buffer ? size : 0,
876 }; 876 };
877 877
878 if (!dentry->d_inode) 878 if (d_really_is_negative(dentry))
879 return -EINVAL; 879 return -EINVAL;
880 880
881 if (!dentry->d_sb->s_xattr || 881 if (!dentry->d_sb->s_xattr ||
882 get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) 882 get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
883 return -EOPNOTSUPP; 883 return -EOPNOTSUPP;
884 884
885 dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE); 885 dir = open_xa_dir(d_inode(dentry), XATTR_REPLACE);
886 if (IS_ERR(dir)) { 886 if (IS_ERR(dir)) {
887 err = PTR_ERR(dir); 887 err = PTR_ERR(dir);
888 if (err == -ENODATA) 888 if (err == -ENODATA)
@@ -890,9 +890,9 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
890 goto out; 890 goto out;
891 } 891 }
892 892
893 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); 893 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR);
894 err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); 894 err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx);
895 mutex_unlock(&dir->d_inode->i_mutex); 895 mutex_unlock(&d_inode(dir)->i_mutex);
896 896
897 if (!err) 897 if (!err)
898 err = buf.pos; 898 err = buf.pos;
@@ -905,12 +905,12 @@ out:
905static int create_privroot(struct dentry *dentry) 905static int create_privroot(struct dentry *dentry)
906{ 906{
907 int err; 907 int err;
908 struct inode *inode = dentry->d_parent->d_inode; 908 struct inode *inode = d_inode(dentry->d_parent);
909 909
910 WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); 910 WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));
911 911
912 err = xattr_mkdir(inode, dentry, 0700); 912 err = xattr_mkdir(inode, dentry, 0700);
913 if (err || !dentry->d_inode) { 913 if (err || d_really_is_negative(dentry)) {
914 reiserfs_warning(dentry->d_sb, "jdm-20006", 914 reiserfs_warning(dentry->d_sb, "jdm-20006",
915 "xattrs/ACLs enabled and couldn't " 915 "xattrs/ACLs enabled and couldn't "
916 "find/create .reiserfs_priv. " 916 "find/create .reiserfs_priv. "
@@ -918,7 +918,7 @@ static int create_privroot(struct dentry *dentry)
918 return -EOPNOTSUPP; 918 return -EOPNOTSUPP;
919 } 919 }
920 920
921 dentry->d_inode->i_flags |= S_PRIVATE; 921 d_inode(dentry)->i_flags |= S_PRIVATE;
922 reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " 922 reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr "
923 "storage.\n", PRIVROOT_NAME); 923 "storage.\n", PRIVROOT_NAME);
924 924
@@ -997,17 +997,17 @@ int reiserfs_lookup_privroot(struct super_block *s)
997 int err = 0; 997 int err = 0;
998 998
999 /* If we don't have the privroot located yet - go find it */ 999 /* If we don't have the privroot located yet - go find it */
1000 mutex_lock(&s->s_root->d_inode->i_mutex); 1000 mutex_lock(&d_inode(s->s_root)->i_mutex);
1001 dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, 1001 dentry = lookup_one_len(PRIVROOT_NAME, s->s_root,
1002 strlen(PRIVROOT_NAME)); 1002 strlen(PRIVROOT_NAME));
1003 if (!IS_ERR(dentry)) { 1003 if (!IS_ERR(dentry)) {
1004 REISERFS_SB(s)->priv_root = dentry; 1004 REISERFS_SB(s)->priv_root = dentry;
1005 d_set_d_op(dentry, &xattr_lookup_poison_ops); 1005 d_set_d_op(dentry, &xattr_lookup_poison_ops);
1006 if (dentry->d_inode) 1006 if (d_really_is_positive(dentry))
1007 dentry->d_inode->i_flags |= S_PRIVATE; 1007 d_inode(dentry)->i_flags |= S_PRIVATE;
1008 } else 1008 } else
1009 err = PTR_ERR(dentry); 1009 err = PTR_ERR(dentry);
1010 mutex_unlock(&s->s_root->d_inode->i_mutex); 1010 mutex_unlock(&d_inode(s->s_root)->i_mutex);
1011 1011
1012 return err; 1012 return err;
1013} 1013}
@@ -1026,15 +1026,15 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
1026 if (err) 1026 if (err)
1027 goto error; 1027 goto error;
1028 1028
1029 if (!privroot->d_inode && !(mount_flags & MS_RDONLY)) { 1029 if (d_really_is_negative(privroot) && !(mount_flags & MS_RDONLY)) {
1030 mutex_lock(&s->s_root->d_inode->i_mutex); 1030 mutex_lock(&d_inode(s->s_root)->i_mutex);
1031 err = create_privroot(REISERFS_SB(s)->priv_root); 1031 err = create_privroot(REISERFS_SB(s)->priv_root);
1032 mutex_unlock(&s->s_root->d_inode->i_mutex); 1032 mutex_unlock(&d_inode(s->s_root)->i_mutex);
1033 } 1033 }
1034 1034
1035 if (privroot->d_inode) { 1035 if (d_really_is_positive(privroot)) {
1036 s->s_xattr = reiserfs_xattr_handlers; 1036 s->s_xattr = reiserfs_xattr_handlers;
1037 mutex_lock(&privroot->d_inode->i_mutex); 1037 mutex_lock(&d_inode(privroot)->i_mutex);
1038 if (!REISERFS_SB(s)->xattr_root) { 1038 if (!REISERFS_SB(s)->xattr_root) {
1039 struct dentry *dentry; 1039 struct dentry *dentry;
1040 1040
@@ -1045,7 +1045,7 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
1045 else 1045 else
1046 err = PTR_ERR(dentry); 1046 err = PTR_ERR(dentry);
1047 } 1047 }
1048 mutex_unlock(&privroot->d_inode->i_mutex); 1048 mutex_unlock(&d_inode(privroot)->i_mutex);
1049 } 1049 }
1050 1050
1051error: 1051error:
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h
index f620e9678dd5..15dde6262c00 100644
--- a/fs/reiserfs/xattr.h
+++ b/fs/reiserfs/xattr.h
@@ -78,7 +78,7 @@ static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
78 78
79 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { 79 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
80 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); 80 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
81 if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) 81 if (d_really_is_negative(REISERFS_SB(inode->i_sb)->xattr_root))
82 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); 82 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
83 } 83 }
84 84
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index e7f8939a4cb5..9a3b0616f283 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -15,10 +15,10 @@ security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
16 return -EINVAL; 16 return -EINVAL;
17 17
18 if (IS_PRIVATE(dentry->d_inode)) 18 if (IS_PRIVATE(d_inode(dentry)))
19 return -EPERM; 19 return -EPERM;
20 20
21 return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); 21 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
22} 22}
23 23
24static int 24static int
@@ -28,10 +28,10 @@ security_set(struct dentry *dentry, const char *name, const void *buffer,
28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
29 return -EINVAL; 29 return -EINVAL;
30 30
31 if (IS_PRIVATE(dentry->d_inode)) 31 if (IS_PRIVATE(d_inode(dentry)))
32 return -EPERM; 32 return -EPERM;
33 33
34 return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); 34 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
35} 35}
36 36
37static size_t security_list(struct dentry *dentry, char *list, size_t list_len, 37static size_t security_list(struct dentry *dentry, char *list, size_t list_len,
@@ -39,7 +39,7 @@ static size_t security_list(struct dentry *dentry, char *list, size_t list_len,
39{ 39{
40 const size_t len = namelen + 1; 40 const size_t len = namelen + 1;
41 41
42 if (IS_PRIVATE(dentry->d_inode)) 42 if (IS_PRIVATE(d_inode(dentry)))
43 return 0; 43 return 0;
44 44
45 if (list && len <= list_len) { 45 if (list && len <= list_len) {
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
index 5eeb0c48ba46..e4f1343714e0 100644
--- a/fs/reiserfs/xattr_trusted.c
+++ b/fs/reiserfs/xattr_trusted.c
@@ -14,10 +14,10 @@ trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
15 return -EINVAL; 15 return -EINVAL;
16 16
17 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) 17 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
18 return -EPERM; 18 return -EPERM;
19 19
20 return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); 20 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
21} 21}
22 22
23static int 23static int
@@ -27,10 +27,10 @@ trusted_set(struct dentry *dentry, const char *name, const void *buffer,
27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
28 return -EINVAL; 28 return -EINVAL;
29 29
30 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) 30 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
31 return -EPERM; 31 return -EPERM;
32 32
33 return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); 33 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
34} 34}
35 35
36static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, 36static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size,
@@ -38,7 +38,7 @@ static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size,
38{ 38{
39 const size_t len = name_len + 1; 39 const size_t len = name_len + 1;
40 40
41 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) 41 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
42 return 0; 42 return 0;
43 43
44 if (list && len <= list_size) { 44 if (list && len <= list_size) {
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index e50eab046471..d0b08d3e5689 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -15,7 +15,7 @@ user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
15 return -EINVAL; 15 return -EINVAL;
16 if (!reiserfs_xattrs_user(dentry->d_sb)) 16 if (!reiserfs_xattrs_user(dentry->d_sb))
17 return -EOPNOTSUPP; 17 return -EOPNOTSUPP;
18 return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); 18 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
19} 19}
20 20
21static int 21static int
@@ -27,7 +27,7 @@ user_set(struct dentry *dentry, const char *name, const void *buffer,
27 27
28 if (!reiserfs_xattrs_user(dentry->d_sb)) 28 if (!reiserfs_xattrs_user(dentry->d_sb))
29 return -EOPNOTSUPP; 29 return -EOPNOTSUPP;
30 return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); 30 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
31} 31}
32 32
33static size_t user_list(struct dentry *dentry, char *list, size_t list_size, 33static size_t user_list(struct dentry *dentry, char *list, size_t list_size,
diff --git a/fs/squashfs/export.c b/fs/squashfs/export.c
index 5e1101ff276f..8073b6532cf0 100644
--- a/fs/squashfs/export.c
+++ b/fs/squashfs/export.c
@@ -110,7 +110,7 @@ static struct dentry *squashfs_fh_to_parent(struct super_block *sb,
110 110
111static struct dentry *squashfs_get_parent(struct dentry *child) 111static struct dentry *squashfs_get_parent(struct dentry *child)
112{ 112{
113 struct inode *inode = child->d_inode; 113 struct inode *inode = d_inode(child);
114 unsigned int parent_ino = squashfs_i(inode)->parent; 114 unsigned int parent_ino = squashfs_i(inode)->parent;
115 115
116 return squashfs_export_iget(inode->i_sb, parent_ino); 116 return squashfs_export_iget(inode->i_sb, parent_ino);
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index 92fcde7b4d61..e5e0ddf5b143 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -39,7 +39,7 @@ static const struct xattr_handler *squashfs_xattr_handler(int);
39ssize_t squashfs_listxattr(struct dentry *d, char *buffer, 39ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
40 size_t buffer_size) 40 size_t buffer_size)
41{ 41{
42 struct inode *inode = d->d_inode; 42 struct inode *inode = d_inode(d);
43 struct super_block *sb = inode->i_sb; 43 struct super_block *sb = inode->i_sb;
44 struct squashfs_sb_info *msblk = sb->s_fs_info; 44 struct squashfs_sb_info *msblk = sb->s_fs_info;
45 u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr) 45 u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr)
@@ -229,7 +229,7 @@ static int squashfs_user_get(struct dentry *d, const char *name, void *buffer,
229 if (name[0] == '\0') 229 if (name[0] == '\0')
230 return -EINVAL; 230 return -EINVAL;
231 231
232 return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_USER, name, 232 return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_USER, name,
233 buffer, size); 233 buffer, size);
234} 234}
235 235
@@ -259,7 +259,7 @@ static int squashfs_trusted_get(struct dentry *d, const char *name,
259 if (name[0] == '\0') 259 if (name[0] == '\0')
260 return -EINVAL; 260 return -EINVAL;
261 261
262 return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_TRUSTED, name, 262 return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_TRUSTED, name,
263 buffer, size); 263 buffer, size);
264} 264}
265 265
@@ -286,7 +286,7 @@ static int squashfs_security_get(struct dentry *d, const char *name,
286 if (name[0] == '\0') 286 if (name[0] == '\0')
287 return -EINVAL; 287 return -EINVAL;
288 288
289 return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_SECURITY, name, 289 return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_SECURITY, name,
290 buffer, size); 290 buffer, size);
291} 291}
292 292
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index d42291d08215..8f3555f00c54 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -132,7 +132,7 @@ struct sysv_dir_entry *sysv_find_entry(struct dentry *dentry, struct page **res_
132{ 132{
133 const char * name = dentry->d_name.name; 133 const char * name = dentry->d_name.name;
134 int namelen = dentry->d_name.len; 134 int namelen = dentry->d_name.len;
135 struct inode * dir = dentry->d_parent->d_inode; 135 struct inode * dir = d_inode(dentry->d_parent);
136 unsigned long start, n; 136 unsigned long start, n;
137 unsigned long npages = dir_pages(dir); 137 unsigned long npages = dir_pages(dir);
138 struct page *page = NULL; 138 struct page *page = NULL;
@@ -176,7 +176,7 @@ found:
176 176
177int sysv_add_link(struct dentry *dentry, struct inode *inode) 177int sysv_add_link(struct dentry *dentry, struct inode *inode)
178{ 178{
179 struct inode *dir = dentry->d_parent->d_inode; 179 struct inode *dir = d_inode(dentry->d_parent);
180 const char * name = dentry->d_name.name; 180 const char * name = dentry->d_name.name;
181 int namelen = dentry->d_name.len; 181 int namelen = dentry->d_name.len;
182 struct page *page = NULL; 182 struct page *page = NULL;
diff --git a/fs/sysv/file.c b/fs/sysv/file.c
index a48e30410ad1..82ddc09061e2 100644
--- a/fs/sysv/file.c
+++ b/fs/sysv/file.c
@@ -30,7 +30,7 @@ const struct file_operations sysv_file_operations = {
30 30
31static int sysv_setattr(struct dentry *dentry, struct iattr *attr) 31static int sysv_setattr(struct dentry *dentry, struct iattr *attr)
32{ 32{
33 struct inode *inode = dentry->d_inode; 33 struct inode *inode = d_inode(dentry);
34 int error; 34 int error;
35 35
36 error = inode_change_ok(inode, attr); 36 error = inode_change_ok(inode, attr);
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 66bc316927e8..2fde40acf024 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -443,7 +443,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
443int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 443int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
444{ 444{
445 struct super_block *s = dentry->d_sb; 445 struct super_block *s = dentry->d_sb;
446 generic_fillattr(dentry->d_inode, stat); 446 generic_fillattr(d_inode(dentry), stat);
447 stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); 447 stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size);
448 stat->blksize = s->s_blocksize; 448 stat->blksize = s->s_blocksize;
449 return 0; 449 return 0;
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 731b2bbcaab3..11e83ed0b4bf 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -118,7 +118,7 @@ out_fail:
118static int sysv_link(struct dentry * old_dentry, struct inode * dir, 118static int sysv_link(struct dentry * old_dentry, struct inode * dir,
119 struct dentry * dentry) 119 struct dentry * dentry)
120{ 120{
121 struct inode *inode = old_dentry->d_inode; 121 struct inode *inode = d_inode(old_dentry);
122 122
123 inode->i_ctime = CURRENT_TIME_SEC; 123 inode->i_ctime = CURRENT_TIME_SEC;
124 inode_inc_link_count(inode); 124 inode_inc_link_count(inode);
@@ -166,7 +166,7 @@ out_dir:
166 166
167static int sysv_unlink(struct inode * dir, struct dentry * dentry) 167static int sysv_unlink(struct inode * dir, struct dentry * dentry)
168{ 168{
169 struct inode * inode = dentry->d_inode; 169 struct inode * inode = d_inode(dentry);
170 struct page * page; 170 struct page * page;
171 struct sysv_dir_entry * de; 171 struct sysv_dir_entry * de;
172 int err = -ENOENT; 172 int err = -ENOENT;
@@ -187,7 +187,7 @@ out:
187 187
188static int sysv_rmdir(struct inode * dir, struct dentry * dentry) 188static int sysv_rmdir(struct inode * dir, struct dentry * dentry)
189{ 189{
190 struct inode *inode = dentry->d_inode; 190 struct inode *inode = d_inode(dentry);
191 int err = -ENOTEMPTY; 191 int err = -ENOTEMPTY;
192 192
193 if (sysv_empty_dir(inode)) { 193 if (sysv_empty_dir(inode)) {
@@ -208,8 +208,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry)
208static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, 208static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
209 struct inode * new_dir, struct dentry * new_dentry) 209 struct inode * new_dir, struct dentry * new_dentry)
210{ 210{
211 struct inode * old_inode = old_dentry->d_inode; 211 struct inode * old_inode = d_inode(old_dentry);
212 struct inode * new_inode = new_dentry->d_inode; 212 struct inode * new_inode = d_inode(new_dentry);
213 struct page * dir_page = NULL; 213 struct page * dir_page = NULL;
214 struct sysv_dir_entry * dir_de = NULL; 214 struct sysv_dir_entry * dir_de = NULL;
215 struct page * old_page; 215 struct page * old_page;
diff --git a/fs/sysv/symlink.c b/fs/sysv/symlink.c
index 00d2f8a43e4e..d3fa0d703314 100644
--- a/fs/sysv/symlink.c
+++ b/fs/sysv/symlink.c
@@ -10,7 +10,7 @@
10 10
11static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd) 11static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd)
12{ 12{
13 nd_set_link(nd, (char *)SYSV_I(dentry->d_inode)->i_data); 13 nd_set_link(nd, (char *)SYSV_I(d_inode(dentry))->i_data);
14 return NULL; 14 return NULL;
15} 15}
16 16
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 0fa6c803992e..20ae94d37acd 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -498,7 +498,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
498 struct dentry *dentry) 498 struct dentry *dentry)
499{ 499{
500 struct ubifs_info *c = dir->i_sb->s_fs_info; 500 struct ubifs_info *c = dir->i_sb->s_fs_info;
501 struct inode *inode = old_dentry->d_inode; 501 struct inode *inode = d_inode(old_dentry);
502 struct ubifs_inode *ui = ubifs_inode(inode); 502 struct ubifs_inode *ui = ubifs_inode(inode);
503 struct ubifs_inode *dir_ui = ubifs_inode(dir); 503 struct ubifs_inode *dir_ui = ubifs_inode(dir);
504 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); 504 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len);
@@ -553,7 +553,7 @@ out_cancel:
553static int ubifs_unlink(struct inode *dir, struct dentry *dentry) 553static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
554{ 554{
555 struct ubifs_info *c = dir->i_sb->s_fs_info; 555 struct ubifs_info *c = dir->i_sb->s_fs_info;
556 struct inode *inode = dentry->d_inode; 556 struct inode *inode = d_inode(dentry);
557 struct ubifs_inode *dir_ui = ubifs_inode(dir); 557 struct ubifs_inode *dir_ui = ubifs_inode(dir);
558 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); 558 int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
559 int err, budgeted = 1; 559 int err, budgeted = 1;
@@ -645,7 +645,7 @@ static int check_dir_empty(struct ubifs_info *c, struct inode *dir)
645static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) 645static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
646{ 646{
647 struct ubifs_info *c = dir->i_sb->s_fs_info; 647 struct ubifs_info *c = dir->i_sb->s_fs_info;
648 struct inode *inode = dentry->d_inode; 648 struct inode *inode = d_inode(dentry);
649 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); 649 int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
650 int err, budgeted = 1; 650 int err, budgeted = 1;
651 struct ubifs_inode *dir_ui = ubifs_inode(dir); 651 struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -661,7 +661,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
661 inode->i_ino, dir->i_ino); 661 inode->i_ino, dir->i_ino);
662 ubifs_assert(mutex_is_locked(&dir->i_mutex)); 662 ubifs_assert(mutex_is_locked(&dir->i_mutex));
663 ubifs_assert(mutex_is_locked(&inode->i_mutex)); 663 ubifs_assert(mutex_is_locked(&inode->i_mutex));
664 err = check_dir_empty(c, dentry->d_inode); 664 err = check_dir_empty(c, d_inode(dentry));
665 if (err) 665 if (err)
666 return err; 666 return err;
667 667
@@ -967,8 +967,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
967 struct inode *new_dir, struct dentry *new_dentry) 967 struct inode *new_dir, struct dentry *new_dentry)
968{ 968{
969 struct ubifs_info *c = old_dir->i_sb->s_fs_info; 969 struct ubifs_info *c = old_dir->i_sb->s_fs_info;
970 struct inode *old_inode = old_dentry->d_inode; 970 struct inode *old_inode = d_inode(old_dentry);
971 struct inode *new_inode = new_dentry->d_inode; 971 struct inode *new_inode = d_inode(new_dentry);
972 struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode); 972 struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode);
973 int err, release, sync = 0, move = (new_dir != old_dir); 973 int err, release, sync = 0, move = (new_dir != old_dir);
974 int is_dir = S_ISDIR(old_inode->i_mode); 974 int is_dir = S_ISDIR(old_inode->i_mode);
@@ -1133,7 +1133,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1133 struct kstat *stat) 1133 struct kstat *stat)
1134{ 1134{
1135 loff_t size; 1135 loff_t size;
1136 struct inode *inode = dentry->d_inode; 1136 struct inode *inode = d_inode(dentry);
1137 struct ubifs_inode *ui = ubifs_inode(inode); 1137 struct ubifs_inode *ui = ubifs_inode(inode);
1138 1138
1139 mutex_lock(&ui->ui_mutex); 1139 mutex_lock(&ui->ui_mutex);
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 475b15635f11..b5c69414e694 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1256,7 +1256,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1256int ubifs_setattr(struct dentry *dentry, struct iattr *attr) 1256int ubifs_setattr(struct dentry *dentry, struct iattr *attr)
1257{ 1257{
1258 int err; 1258 int err;
1259 struct inode *inode = dentry->d_inode; 1259 struct inode *inode = d_inode(dentry);
1260 struct ubifs_info *c = inode->i_sb->s_fs_info; 1260 struct ubifs_info *c = inode->i_sb->s_fs_info;
1261 1261
1262 dbg_gen("ino %lu, mode %#x, ia_valid %#x", 1262 dbg_gen("ino %lu, mode %#x, ia_valid %#x",
@@ -1301,7 +1301,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset,
1301 1301
1302static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) 1302static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd)
1303{ 1303{
1304 struct ubifs_inode *ui = ubifs_inode(dentry->d_inode); 1304 struct ubifs_inode *ui = ubifs_inode(d_inode(dentry));
1305 1305
1306 nd_set_link(nd, ui->data); 1306 nd_set_link(nd, ui->data);
1307 return NULL; 1307 return NULL;
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index f6ac3f29323c..4f657e15c46e 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -930,8 +930,8 @@ int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir,
930 union ubifs_key key; 930 union ubifs_key key;
931 struct ubifs_dent_node *dent, *dent2; 931 struct ubifs_dent_node *dent, *dent2;
932 int err, dlen1, dlen2, ilen, lnum, offs, len; 932 int err, dlen1, dlen2, ilen, lnum, offs, len;
933 const struct inode *old_inode = old_dentry->d_inode; 933 const struct inode *old_inode = d_inode(old_dentry);
934 const struct inode *new_inode = new_dentry->d_inode; 934 const struct inode *new_inode = d_inode(new_dentry);
935 int aligned_dlen1, aligned_dlen2, plen = UBIFS_INO_NODE_SZ; 935 int aligned_dlen1, aligned_dlen2, plen = UBIFS_INO_NODE_SZ;
936 int last_reference = !!(new_inode && new_inode->i_nlink == 0); 936 int last_reference = !!(new_inode && new_inode->i_nlink == 0);
937 int move = (old_dir != new_dir); 937 int move = (old_dir != new_dir);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index a92be244a6fb..dd2d872189da 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -364,15 +364,15 @@ int ubifs_setxattr(struct dentry *dentry, const char *name,
364 const void *value, size_t size, int flags) 364 const void *value, size_t size, int flags)
365{ 365{
366 dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", 366 dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd",
367 name, dentry->d_inode->i_ino, dentry, size); 367 name, d_inode(dentry)->i_ino, dentry, size);
368 368
369 return setxattr(dentry->d_inode, name, value, size, flags); 369 return setxattr(d_inode(dentry), name, value, size, flags);
370} 370}
371 371
372ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, 372ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
373 size_t size) 373 size_t size)
374{ 374{
375 struct inode *inode, *host = dentry->d_inode; 375 struct inode *inode, *host = d_inode(dentry);
376 struct ubifs_info *c = host->i_sb->s_fs_info; 376 struct ubifs_info *c = host->i_sb->s_fs_info;
377 struct qstr nm = QSTR_INIT(name, strlen(name)); 377 struct qstr nm = QSTR_INIT(name, strlen(name));
378 struct ubifs_inode *ui; 378 struct ubifs_inode *ui;
@@ -432,7 +432,7 @@ out_unlock:
432ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) 432ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size)
433{ 433{
434 union ubifs_key key; 434 union ubifs_key key;
435 struct inode *host = dentry->d_inode; 435 struct inode *host = d_inode(dentry);
436 struct ubifs_info *c = host->i_sb->s_fs_info; 436 struct ubifs_info *c = host->i_sb->s_fs_info;
437 struct ubifs_inode *host_ui = ubifs_inode(host); 437 struct ubifs_inode *host_ui = ubifs_inode(host);
438 struct ubifs_dent_node *xent, *pxent = NULL; 438 struct ubifs_dent_node *xent, *pxent = NULL;
@@ -535,7 +535,7 @@ out_cancel:
535 535
536int ubifs_removexattr(struct dentry *dentry, const char *name) 536int ubifs_removexattr(struct dentry *dentry, const char *name)
537{ 537{
538 struct inode *inode, *host = dentry->d_inode; 538 struct inode *inode, *host = d_inode(dentry);
539 struct ubifs_info *c = host->i_sb->s_fs_info; 539 struct ubifs_info *c = host->i_sb->s_fs_info;
540 struct qstr nm = QSTR_INIT(name, strlen(name)); 540 struct qstr nm = QSTR_INIT(name, strlen(name));
541 struct ubifs_dent_node *xent; 541 struct ubifs_dent_node *xent;
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 3de2edafff73..a84cdd2ef618 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -250,7 +250,7 @@ const struct file_operations udf_file_operations = {
250 250
251static int udf_setattr(struct dentry *dentry, struct iattr *attr) 251static int udf_setattr(struct dentry *dentry, struct iattr *attr)
252{ 252{
253 struct inode *inode = dentry->d_inode; 253 struct inode *inode = d_inode(dentry);
254 int error; 254 int error;
255 255
256 error = inode_change_ok(inode, attr); 256 error = inode_change_ok(inode, attr);
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 33b246b82c98..b159b769bf51 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -552,7 +552,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
552static int udf_add_nondir(struct dentry *dentry, struct inode *inode) 552static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
553{ 553{
554 struct udf_inode_info *iinfo = UDF_I(inode); 554 struct udf_inode_info *iinfo = UDF_I(inode);
555 struct inode *dir = dentry->d_parent->d_inode; 555 struct inode *dir = d_inode(dentry->d_parent);
556 struct udf_fileident_bh fibh; 556 struct udf_fileident_bh fibh;
557 struct fileIdentDesc cfi, *fi; 557 struct fileIdentDesc cfi, *fi;
558 int err; 558 int err;
@@ -767,7 +767,7 @@ static int empty_dir(struct inode *dir)
767static int udf_rmdir(struct inode *dir, struct dentry *dentry) 767static int udf_rmdir(struct inode *dir, struct dentry *dentry)
768{ 768{
769 int retval; 769 int retval;
770 struct inode *inode = dentry->d_inode; 770 struct inode *inode = d_inode(dentry);
771 struct udf_fileident_bh fibh; 771 struct udf_fileident_bh fibh;
772 struct fileIdentDesc *fi, cfi; 772 struct fileIdentDesc *fi, cfi;
773 struct kernel_lb_addr tloc; 773 struct kernel_lb_addr tloc;
@@ -809,7 +809,7 @@ out:
809static int udf_unlink(struct inode *dir, struct dentry *dentry) 809static int udf_unlink(struct inode *dir, struct dentry *dentry)
810{ 810{
811 int retval; 811 int retval;
812 struct inode *inode = dentry->d_inode; 812 struct inode *inode = d_inode(dentry);
813 struct udf_fileident_bh fibh; 813 struct udf_fileident_bh fibh;
814 struct fileIdentDesc *fi; 814 struct fileIdentDesc *fi;
815 struct fileIdentDesc cfi; 815 struct fileIdentDesc cfi;
@@ -999,7 +999,7 @@ out_no_entry:
999static int udf_link(struct dentry *old_dentry, struct inode *dir, 999static int udf_link(struct dentry *old_dentry, struct inode *dir,
1000 struct dentry *dentry) 1000 struct dentry *dentry)
1001{ 1001{
1002 struct inode *inode = old_dentry->d_inode; 1002 struct inode *inode = d_inode(old_dentry);
1003 struct udf_fileident_bh fibh; 1003 struct udf_fileident_bh fibh;
1004 struct fileIdentDesc cfi, *fi; 1004 struct fileIdentDesc cfi, *fi;
1005 int err; 1005 int err;
@@ -1036,8 +1036,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1036static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, 1036static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1037 struct inode *new_dir, struct dentry *new_dentry) 1037 struct inode *new_dir, struct dentry *new_dentry)
1038{ 1038{
1039 struct inode *old_inode = old_dentry->d_inode; 1039 struct inode *old_inode = d_inode(old_dentry);
1040 struct inode *new_inode = new_dentry->d_inode; 1040 struct inode *new_inode = d_inode(new_dentry);
1041 struct udf_fileident_bh ofibh, nfibh; 1041 struct udf_fileident_bh ofibh, nfibh;
1042 struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL; 1042 struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL;
1043 struct fileIdentDesc ocfi, ncfi; 1043 struct fileIdentDesc ocfi, ncfi;
@@ -1175,7 +1175,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
1175 struct fileIdentDesc cfi; 1175 struct fileIdentDesc cfi;
1176 struct udf_fileident_bh fibh; 1176 struct udf_fileident_bh fibh;
1177 1177
1178 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) 1178 if (!udf_find_entry(d_inode(child), &dotdot, &fibh, &cfi))
1179 return ERR_PTR(-EACCES); 1179 return ERR_PTR(-EACCES);
1180 1180
1181 if (fibh.sbh != fibh.ebh) 1181 if (fibh.sbh != fibh.ebh)
@@ -1183,7 +1183,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
1183 brelse(fibh.sbh); 1183 brelse(fibh.sbh);
1184 1184
1185 tloc = lelb_to_cpu(cfi.icb.extLocation); 1185 tloc = lelb_to_cpu(cfi.icb.extLocation);
1186 inode = udf_iget(child->d_inode->i_sb, &tloc); 1186 inode = udf_iget(d_inode(child)->i_sb, &tloc);
1187 if (IS_ERR(inode)) 1187 if (IS_ERR(inode))
1188 return ERR_CAST(inode); 1188 return ERR_CAST(inode);
1189 1189
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 0ecc2cebed8f..1bfe8cabff0f 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -311,7 +311,7 @@ found:
311 */ 311 */
312int ufs_add_link(struct dentry *dentry, struct inode *inode) 312int ufs_add_link(struct dentry *dentry, struct inode *inode)
313{ 313{
314 struct inode *dir = dentry->d_parent->d_inode; 314 struct inode *dir = d_inode(dentry->d_parent);
315 const unsigned char *name = dentry->d_name.name; 315 const unsigned char *name = dentry->d_name.name;
316 int namelen = dentry->d_name.len; 316 int namelen = dentry->d_name.len;
317 struct super_block *sb = dir->i_sb; 317 struct super_block *sb = dir->i_sb;
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index fd65deb4b5f0..e491a93a7e9a 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -165,7 +165,7 @@ out_fail:
165static int ufs_link (struct dentry * old_dentry, struct inode * dir, 165static int ufs_link (struct dentry * old_dentry, struct inode * dir,
166 struct dentry *dentry) 166 struct dentry *dentry)
167{ 167{
168 struct inode *inode = old_dentry->d_inode; 168 struct inode *inode = d_inode(old_dentry);
169 int error; 169 int error;
170 170
171 lock_ufs(dir->i_sb); 171 lock_ufs(dir->i_sb);
@@ -222,7 +222,7 @@ out_fail:
222 222
223static int ufs_unlink(struct inode *dir, struct dentry *dentry) 223static int ufs_unlink(struct inode *dir, struct dentry *dentry)
224{ 224{
225 struct inode * inode = dentry->d_inode; 225 struct inode * inode = d_inode(dentry);
226 struct ufs_dir_entry *de; 226 struct ufs_dir_entry *de;
227 struct page *page; 227 struct page *page;
228 int err = -ENOENT; 228 int err = -ENOENT;
@@ -244,7 +244,7 @@ out:
244 244
245static int ufs_rmdir (struct inode * dir, struct dentry *dentry) 245static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
246{ 246{
247 struct inode * inode = dentry->d_inode; 247 struct inode * inode = d_inode(dentry);
248 int err= -ENOTEMPTY; 248 int err= -ENOTEMPTY;
249 249
250 lock_ufs(dir->i_sb); 250 lock_ufs(dir->i_sb);
@@ -263,8 +263,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
263static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, 263static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
264 struct inode *new_dir, struct dentry *new_dentry) 264 struct inode *new_dir, struct dentry *new_dentry)
265{ 265{
266 struct inode *old_inode = old_dentry->d_inode; 266 struct inode *old_inode = d_inode(old_dentry);
267 struct inode *new_inode = new_dentry->d_inode; 267 struct inode *new_inode = d_inode(new_dentry);
268 struct page *dir_page = NULL; 268 struct page *dir_page = NULL;
269 struct ufs_dir_entry * dir_de = NULL; 269 struct ufs_dir_entry * dir_de = NULL;
270 struct page *old_page; 270 struct page *old_page;
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 8092d3759a5e..b3bc3e7ae79d 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -144,10 +144,10 @@ static struct dentry *ufs_get_parent(struct dentry *child)
144 struct qstr dot_dot = QSTR_INIT("..", 2); 144 struct qstr dot_dot = QSTR_INIT("..", 2);
145 ino_t ino; 145 ino_t ino;
146 146
147 ino = ufs_inode_by_name(child->d_inode, &dot_dot); 147 ino = ufs_inode_by_name(d_inode(child), &dot_dot);
148 if (!ino) 148 if (!ino)
149 return ERR_PTR(-ENOENT); 149 return ERR_PTR(-ENOENT);
150 return d_obtain_alias(ufs_iget(child->d_inode->i_sb, ino)); 150 return d_obtain_alias(ufs_iget(d_inode(child)->i_sb, ino));
151} 151}
152 152
153static const struct export_operations ufs_export_ops = { 153static const struct export_operations ufs_export_ops = {
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c
index d283628b4778..5b537e2fdda3 100644
--- a/fs/ufs/symlink.c
+++ b/fs/ufs/symlink.c
@@ -34,7 +34,7 @@
34 34
35static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) 35static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd)
36{ 36{
37 struct ufs_inode_info *p = UFS_I(dentry->d_inode); 37 struct ufs_inode_info *p = UFS_I(d_inode(dentry));
38 nd_set_link(nd, (char*)p->i_u1.i_symlink); 38 nd_set_link(nd, (char*)p->i_u1.i_symlink);
39 return NULL; 39 return NULL;
40} 40}
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index f04f89fbd4d9..21154704c168 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -492,7 +492,7 @@ out:
492 492
493int ufs_setattr(struct dentry *dentry, struct iattr *attr) 493int ufs_setattr(struct dentry *dentry, struct iattr *attr)
494{ 494{
495 struct inode *inode = dentry->d_inode; 495 struct inode *inode = d_inode(dentry);
496 unsigned int ia_valid = attr->ia_valid; 496 unsigned int ia_valid = attr->ia_valid;
497 int error; 497 int error;
498 498
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
index b97359ba2648..652cd3c5b58c 100644
--- a/fs/xfs/xfs_export.c
+++ b/fs/xfs/xfs_export.c
@@ -215,7 +215,7 @@ xfs_fs_get_parent(
215 int error; 215 int error;
216 struct xfs_inode *cip; 216 struct xfs_inode *cip;
217 217
218 error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip, NULL); 218 error = xfs_lookup(XFS_I(d_inode(child)), &xfs_name_dotdot, &cip, NULL);
219 if (unlikely(error)) 219 if (unlikely(error))
220 return ERR_PTR(error); 220 return ERR_PTR(error);
221 221
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index a2e86e8a0fea..22807e1e9cca 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -294,7 +294,7 @@ xfs_filestream_get_parent(
294 if (!parent) 294 if (!parent)
295 goto out_dput; 295 goto out_dput;
296 296
297 dir = igrab(parent->d_inode); 297 dir = igrab(d_inode(parent));
298 dput(parent); 298 dput(parent);
299 299
300out_dput: 300out_dput:
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index ac4feae45eb3..ed97bd48cf32 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -82,7 +82,7 @@ xfs_find_handle(
82 error = user_lpath((const char __user *)hreq->path, &path); 82 error = user_lpath((const char __user *)hreq->path, &path);
83 if (error) 83 if (error)
84 return error; 84 return error;
85 inode = path.dentry->d_inode; 85 inode = d_inode(path.dentry);
86 } 86 }
87 ip = XFS_I(inode); 87 ip = XFS_I(inode);
88 88
@@ -210,7 +210,7 @@ xfs_open_by_handle(
210 dentry = xfs_handlereq_to_dentry(parfilp, hreq); 210 dentry = xfs_handlereq_to_dentry(parfilp, hreq);
211 if (IS_ERR(dentry)) 211 if (IS_ERR(dentry))
212 return PTR_ERR(dentry); 212 return PTR_ERR(dentry);
213 inode = dentry->d_inode; 213 inode = d_inode(dentry);
214 214
215 /* Restrict xfs_open_by_handle to directories & regular files. */ 215 /* Restrict xfs_open_by_handle to directories & regular files. */
216 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) { 216 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
@@ -303,7 +303,7 @@ xfs_readlink_by_handle(
303 goto out_dput; 303 goto out_dput;
304 } 304 }
305 305
306 error = xfs_readlink(XFS_I(dentry->d_inode), link); 306 error = xfs_readlink(XFS_I(d_inode(dentry)), link);
307 if (error) 307 if (error)
308 goto out_kfree; 308 goto out_kfree;
309 error = readlink_copy(hreq->ohandle, olen, link); 309 error = readlink_copy(hreq->ohandle, olen, link);
@@ -376,7 +376,7 @@ xfs_fssetdm_by_handle(
376 return PTR_ERR(dentry); 376 return PTR_ERR(dentry);
377 } 377 }
378 378
379 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { 379 if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) {
380 error = -EPERM; 380 error = -EPERM;
381 goto out; 381 goto out;
382 } 382 }
@@ -386,7 +386,7 @@ xfs_fssetdm_by_handle(
386 goto out; 386 goto out;
387 } 387 }
388 388
389 error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask, 389 error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask,
390 fsd.fsd_dmstate); 390 fsd.fsd_dmstate);
391 391
392 out: 392 out:
@@ -429,7 +429,7 @@ xfs_attrlist_by_handle(
429 goto out_dput; 429 goto out_dput;
430 430
431 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; 431 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
432 error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen, 432 error = xfs_attr_list(XFS_I(d_inode(dentry)), kbuf, al_hreq.buflen,
433 al_hreq.flags, cursor); 433 al_hreq.flags, cursor);
434 if (error) 434 if (error)
435 goto out_kfree; 435 goto out_kfree;
@@ -559,7 +559,7 @@ xfs_attrmulti_by_handle(
559 switch (ops[i].am_opcode) { 559 switch (ops[i].am_opcode) {
560 case ATTR_OP_GET: 560 case ATTR_OP_GET:
561 ops[i].am_error = xfs_attrmulti_attr_get( 561 ops[i].am_error = xfs_attrmulti_attr_get(
562 dentry->d_inode, attr_name, 562 d_inode(dentry), attr_name,
563 ops[i].am_attrvalue, &ops[i].am_length, 563 ops[i].am_attrvalue, &ops[i].am_length,
564 ops[i].am_flags); 564 ops[i].am_flags);
565 break; 565 break;
@@ -568,7 +568,7 @@ xfs_attrmulti_by_handle(
568 if (ops[i].am_error) 568 if (ops[i].am_error)
569 break; 569 break;
570 ops[i].am_error = xfs_attrmulti_attr_set( 570 ops[i].am_error = xfs_attrmulti_attr_set(
571 dentry->d_inode, attr_name, 571 d_inode(dentry), attr_name,
572 ops[i].am_attrvalue, ops[i].am_length, 572 ops[i].am_attrvalue, ops[i].am_length,
573 ops[i].am_flags); 573 ops[i].am_flags);
574 mnt_drop_write_file(parfilp); 574 mnt_drop_write_file(parfilp);
@@ -578,7 +578,7 @@ xfs_attrmulti_by_handle(
578 if (ops[i].am_error) 578 if (ops[i].am_error)
579 break; 579 break;
580 ops[i].am_error = xfs_attrmulti_attr_remove( 580 ops[i].am_error = xfs_attrmulti_attr_remove(
581 dentry->d_inode, attr_name, 581 d_inode(dentry), attr_name,
582 ops[i].am_flags); 582 ops[i].am_flags);
583 mnt_drop_write_file(parfilp); 583 mnt_drop_write_file(parfilp);
584 break; 584 break;
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index bfc7c7c8a0c8..b88bdc85dd3d 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -375,7 +375,7 @@ xfs_compat_attrlist_by_handle(
375 goto out_dput; 375 goto out_dput;
376 376
377 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; 377 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
378 error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen, 378 error = xfs_attr_list(XFS_I(d_inode(dentry)), kbuf, al_hreq.buflen,
379 al_hreq.flags, cursor); 379 al_hreq.flags, cursor);
380 if (error) 380 if (error)
381 goto out_kfree; 381 goto out_kfree;
@@ -445,7 +445,7 @@ xfs_compat_attrmulti_by_handle(
445 switch (ops[i].am_opcode) { 445 switch (ops[i].am_opcode) {
446 case ATTR_OP_GET: 446 case ATTR_OP_GET:
447 ops[i].am_error = xfs_attrmulti_attr_get( 447 ops[i].am_error = xfs_attrmulti_attr_get(
448 dentry->d_inode, attr_name, 448 d_inode(dentry), attr_name,
449 compat_ptr(ops[i].am_attrvalue), 449 compat_ptr(ops[i].am_attrvalue),
450 &ops[i].am_length, ops[i].am_flags); 450 &ops[i].am_length, ops[i].am_flags);
451 break; 451 break;
@@ -454,7 +454,7 @@ xfs_compat_attrmulti_by_handle(
454 if (ops[i].am_error) 454 if (ops[i].am_error)
455 break; 455 break;
456 ops[i].am_error = xfs_attrmulti_attr_set( 456 ops[i].am_error = xfs_attrmulti_attr_set(
457 dentry->d_inode, attr_name, 457 d_inode(dentry), attr_name,
458 compat_ptr(ops[i].am_attrvalue), 458 compat_ptr(ops[i].am_attrvalue),
459 ops[i].am_length, ops[i].am_flags); 459 ops[i].am_length, ops[i].am_flags);
460 mnt_drop_write_file(parfilp); 460 mnt_drop_write_file(parfilp);
@@ -464,7 +464,7 @@ xfs_compat_attrmulti_by_handle(
464 if (ops[i].am_error) 464 if (ops[i].am_error)
465 break; 465 break;
466 ops[i].am_error = xfs_attrmulti_attr_remove( 466 ops[i].am_error = xfs_attrmulti_attr_remove(
467 dentry->d_inode, attr_name, 467 d_inode(dentry), attr_name,
468 ops[i].am_flags); 468 ops[i].am_flags);
469 mnt_drop_write_file(parfilp); 469 mnt_drop_write_file(parfilp);
470 break; 470 break;
@@ -504,7 +504,7 @@ xfs_compat_fssetdm_by_handle(
504 if (IS_ERR(dentry)) 504 if (IS_ERR(dentry))
505 return PTR_ERR(dentry); 505 return PTR_ERR(dentry);
506 506
507 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { 507 if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) {
508 error = -EPERM; 508 error = -EPERM;
509 goto out; 509 goto out;
510 } 510 }
@@ -514,7 +514,7 @@ xfs_compat_fssetdm_by_handle(
514 goto out; 514 goto out;
515 } 515 }
516 516
517 error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask, 517 error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask,
518 fsd.fsd_dmstate); 518 fsd.fsd_dmstate);
519 519
520out: 520out:
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index e53a90331422..54b95232d946 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -301,7 +301,7 @@ xfs_vn_link(
301 struct inode *dir, 301 struct inode *dir,
302 struct dentry *dentry) 302 struct dentry *dentry)
303{ 303{
304 struct inode *inode = old_dentry->d_inode; 304 struct inode *inode = d_inode(old_dentry);
305 struct xfs_name name; 305 struct xfs_name name;
306 int error; 306 int error;
307 307
@@ -326,7 +326,7 @@ xfs_vn_unlink(
326 326
327 xfs_dentry_to_name(&name, dentry, 0); 327 xfs_dentry_to_name(&name, dentry, 0);
328 328
329 error = xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode)); 329 error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry)));
330 if (error) 330 if (error)
331 return error; 331 return error;
332 332
@@ -384,7 +384,7 @@ xfs_vn_rename(
384 struct dentry *ndentry, 384 struct dentry *ndentry,
385 unsigned int flags) 385 unsigned int flags)
386{ 386{
387 struct inode *new_inode = ndentry->d_inode; 387 struct inode *new_inode = d_inode(ndentry);
388 int omode = 0; 388 int omode = 0;
389 struct xfs_name oname; 389 struct xfs_name oname;
390 struct xfs_name nname; 390 struct xfs_name nname;
@@ -394,12 +394,12 @@ xfs_vn_rename(
394 394
395 /* if we are exchanging files, we need to set i_mode of both files */ 395 /* if we are exchanging files, we need to set i_mode of both files */
396 if (flags & RENAME_EXCHANGE) 396 if (flags & RENAME_EXCHANGE)
397 omode = ndentry->d_inode->i_mode; 397 omode = d_inode(ndentry)->i_mode;
398 398
399 xfs_dentry_to_name(&oname, odentry, omode); 399 xfs_dentry_to_name(&oname, odentry, omode);
400 xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); 400 xfs_dentry_to_name(&nname, ndentry, d_inode(odentry)->i_mode);
401 401
402 return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), 402 return xfs_rename(XFS_I(odir), &oname, XFS_I(d_inode(odentry)),
403 XFS_I(ndir), &nname, 403 XFS_I(ndir), &nname,
404 new_inode ? XFS_I(new_inode) : NULL, flags); 404 new_inode ? XFS_I(new_inode) : NULL, flags);
405} 405}
@@ -421,7 +421,7 @@ xfs_vn_follow_link(
421 if (!link) 421 if (!link)
422 goto out_err; 422 goto out_err;
423 423
424 error = xfs_readlink(XFS_I(dentry->d_inode), link); 424 error = xfs_readlink(XFS_I(d_inode(dentry)), link);
425 if (unlikely(error)) 425 if (unlikely(error))
426 goto out_kfree; 426 goto out_kfree;
427 427
@@ -441,7 +441,7 @@ xfs_vn_getattr(
441 struct dentry *dentry, 441 struct dentry *dentry,
442 struct kstat *stat) 442 struct kstat *stat)
443{ 443{
444 struct inode *inode = dentry->d_inode; 444 struct inode *inode = d_inode(dentry);
445 struct xfs_inode *ip = XFS_I(inode); 445 struct xfs_inode *ip = XFS_I(inode);
446 struct xfs_mount *mp = ip->i_mount; 446 struct xfs_mount *mp = ip->i_mount;
447 447
@@ -968,14 +968,14 @@ xfs_vn_setattr(
968 struct dentry *dentry, 968 struct dentry *dentry,
969 struct iattr *iattr) 969 struct iattr *iattr)
970{ 970{
971 struct xfs_inode *ip = XFS_I(dentry->d_inode); 971 struct xfs_inode *ip = XFS_I(d_inode(dentry));
972 int error; 972 int error;
973 973
974 if (iattr->ia_valid & ATTR_SIZE) { 974 if (iattr->ia_valid & ATTR_SIZE) {
975 uint iolock = XFS_IOLOCK_EXCL; 975 uint iolock = XFS_IOLOCK_EXCL;
976 976
977 xfs_ilock(ip, iolock); 977 xfs_ilock(ip, iolock);
978 error = xfs_break_layouts(dentry->d_inode, &iolock); 978 error = xfs_break_layouts(d_inode(dentry), &iolock);
979 if (!error) 979 if (!error)
980 error = xfs_setattr_size(ip, iattr); 980 error = xfs_setattr_size(ip, iattr);
981 xfs_iunlock(ip, iolock); 981 xfs_iunlock(ip, iolock);
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8fcc4ccc5c79..72e97e31d3b1 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1083,7 +1083,7 @@ xfs_fs_statfs(
1083{ 1083{
1084 struct xfs_mount *mp = XFS_M(dentry->d_sb); 1084 struct xfs_mount *mp = XFS_M(dentry->d_sb);
1085 xfs_sb_t *sbp = &mp->m_sb; 1085 xfs_sb_t *sbp = &mp->m_sb;
1086 struct xfs_inode *ip = XFS_I(dentry->d_inode); 1086 struct xfs_inode *ip = XFS_I(d_inode(dentry));
1087 __uint64_t fakeinos, id; 1087 __uint64_t fakeinos, id;
1088 xfs_extlen_t lsize; 1088 xfs_extlen_t lsize;
1089 __int64_t ffree; 1089 __int64_t ffree;
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 69f6e475de97..c036815183cb 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -35,7 +35,7 @@ static int
35xfs_xattr_get(struct dentry *dentry, const char *name, 35xfs_xattr_get(struct dentry *dentry, const char *name,
36 void *value, size_t size, int xflags) 36 void *value, size_t size, int xflags)
37{ 37{
38 struct xfs_inode *ip = XFS_I(dentry->d_inode); 38 struct xfs_inode *ip = XFS_I(d_inode(dentry));
39 int error, asize = size; 39 int error, asize = size;
40 40
41 if (strcmp(name, "") == 0) 41 if (strcmp(name, "") == 0)
@@ -57,7 +57,7 @@ static int
57xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, 57xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
58 size_t size, int flags, int xflags) 58 size_t size, int flags, int xflags)
59{ 59{
60 struct xfs_inode *ip = XFS_I(dentry->d_inode); 60 struct xfs_inode *ip = XFS_I(d_inode(dentry));
61 61
62 if (strcmp(name, "") == 0) 62 if (strcmp(name, "") == 0)
63 return -EINVAL; 63 return -EINVAL;
@@ -197,7 +197,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
197{ 197{
198 struct xfs_attr_list_context context; 198 struct xfs_attr_list_context context;
199 struct attrlist_cursor_kern cursor = { 0 }; 199 struct attrlist_cursor_kern cursor = { 0 };
200 struct inode *inode = dentry->d_inode; 200 struct inode *inode = d_inode(dentry);
201 int error; 201 int error;
202 202
203 /* 203 /*