aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-26 18:48:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-26 20:22:07 -0400
commit9ec3a646fe09970f801ab15e0f1694060b9f19af (patch)
tree697058ca7e1671eda180a3ccc62445686fbc1a31 /fs
parentc8b3fd0ce313443731e8fd6d5a541085eb465f99 (diff)
parent3cab989afd8d8d1bc3d99fef0e7ed87c31e7b647 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull fourth vfs update from Al Viro: "d_inode() annotations from David Howells (sat in for-next since before the beginning of merge window) + four assorted fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: RCU pathwalk breakage when running into a symlink overmounting something fix I_DIO_WAKEUP definition direct-io: only inc/dec inode->i_dio_count for file systems fs/9p: fix readdir() VFS: assorted d_backing_inode() annotations VFS: fs/inode.c helpers: d_inode() annotations VFS: fs/cachefiles: d_backing_inode() annotations VFS: fs library helpers: d_inode() annotations VFS: assorted weird filesystems: d_inode() annotations VFS: normal filesystems (and lustre): d_inode() annotations VFS: security/: d_inode() annotations VFS: security/: d_backing_inode() annotations VFS: net/: d_inode() annotations VFS: net/unix: d_backing_inode() annotations VFS: kernel/: d_inode() annotations VFS: audit: d_backing_inode() annotations VFS: Fix up some ->d_inode accesses in the chelsio driver VFS: Cachefiles should perform fs modifications on the top layer only VFS: AF_UNIX sockets should call mknod on the top layer only
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_dir.c2
-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.c9
-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/binfmt_misc.c16
-rw-r--r--fs/block_dev.c5
-rw-r--r--fs/btrfs/export.c6
-rw-r--r--fs/btrfs/file.c2
-rw-r--r--fs/btrfs/inode.c36
-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/cachefiles/bind.c10
-rw-r--r--fs/cachefiles/interface.c6
-rw-r--r--fs/cachefiles/namei.c122
-rw-r--r--fs/cachefiles/rdwr.c14
-rw-r--r--fs/cachefiles/security.c6
-rw-r--r--fs/cachefiles/xattr.c22
-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/dax.c4
-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/direct-io.c7
-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/indirect.c6
-rw-r--r--fs/ext4/inline.c4
-rw-r--r--fs/ext4/inode.c8
-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.c8
-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.c12
-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/inode.c20
-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/libfs.c26
-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/namei.c6
-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.c14
-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/nsfs.c4
-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/pipe.c2
-rw-r--r--fs/posix_acl.c8
-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/quota/dquot.c10
-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/stat.c4
-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
285 files changed, 1512 insertions, 1520 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_dir.c b/fs/9p/vfs_dir.c
index 76c3b1ab6361..5cc00e56206e 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -138,6 +138,8 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx)
138 &err); 138 &err);
139 if (err) 139 if (err)
140 return err; 140 return err;
141 if (n == 0)
142 return 0;
141 143
142 rdir->head = 0; 144 rdir->head = 0;
143 rdir->tail = n; 145 rdir->tail = n;
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 5022ac96aa40..a8f463c028ce 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,10 +471,9 @@ 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 475
476 return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE); 476 return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE);
477
478} 477}
479 478
480/* Check if the name is valid for a affs object. */ 479/* Check if the name is valid for a affs object. */
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 9628003ccd2f..a022f4accd76 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -213,7 +213,7 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
213int 213int
214affs_notify_change(struct dentry *dentry, struct iattr *attr) 214affs_notify_change(struct dentry *dentry, struct iattr *attr)
215{ 215{
216 struct inode *inode = dentry->d_inode; 216 struct inode *inode = d_inode(dentry);
217 int error; 217 int error;
218 218
219 pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); 219 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 ec8ca0efb960..181e05b46e72 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -251,7 +251,7 @@ int
251affs_unlink(struct inode *dir, struct dentry *dentry) 251affs_unlink(struct inode *dir, struct dentry *dentry)
252{ 252{
253 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, 253 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
254 dentry->d_inode->i_ino, dentry); 254 d_inode(dentry)->i_ino, dentry);
255 255
256 return affs_remove_header(dentry); 256 return affs_remove_header(dentry);
257} 257}
@@ -320,7 +320,7 @@ int
320affs_rmdir(struct inode *dir, struct dentry *dentry) 320affs_rmdir(struct inode *dir, struct dentry *dentry)
321{ 321{
322 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, 322 pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
323 dentry->d_inode->i_ino, dentry); 323 d_inode(dentry)->i_ino, dentry);
324 324
325 return affs_remove_header(dentry); 325 return affs_remove_header(dentry);
326} 326}
@@ -403,7 +403,7 @@ err:
403int 403int
404affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 404affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
405{ 405{
406 struct inode *inode = old_dentry->d_inode; 406 struct inode *inode = d_inode(old_dentry);
407 407
408 pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, 408 pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino,
409 dentry); 409 dentry);
@@ -430,13 +430,13 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
430 return retval; 430 return retval;
431 431
432 /* Unlink destination if it already exists */ 432 /* Unlink destination if it already exists */
433 if (new_dentry->d_inode) { 433 if (d_really_is_positive(new_dentry)) {
434 retval = affs_remove_header(new_dentry); 434 retval = affs_remove_header(new_dentry);
435 if (retval) 435 if (retval)
436 return retval; 436 return retval;
437 } 437 }
438 438
439 bh = affs_bread(sb, old_dentry->d_inode->i_ino); 439 bh = affs_bread(sb, d_inode(old_dentry)->i_ino);
440 if (!bh) 440 if (!bh)
441 return -EIO; 441 return -EIO;
442 442
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 16e0a48bfccd..7943533c3868 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -471,7 +471,7 @@ static void *
471befs_follow_link(struct dentry *dentry, struct nameidata *nd) 471befs_follow_link(struct dentry *dentry, struct nameidata *nd)
472{ 472{
473 struct super_block *sb = dentry->d_sb; 473 struct super_block *sb = dentry->d_sb;
474 struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); 474 struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
475 befs_data_stream *data = &befs_ino->i_data.ds; 475 befs_data_stream *data = &befs_ino->i_data.ds;
476 befs_off_t len = data->size; 476 befs_off_t len = data->size;
477 char *link; 477 char *link;
@@ -501,7 +501,7 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd)
501static void * 501static void *
502befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) 502befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
503{ 503{
504 struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); 504 struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
505 505
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;
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 7a8182770649..3ec6113146c0 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/binfmt_misc.c b/fs/binfmt_misc.c
index 9dcb05409ba7..78f005f37847 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -591,7 +591,7 @@ static void kill_node(Node *e)
591 write_unlock(&entries_lock); 591 write_unlock(&entries_lock);
592 592
593 if (dentry) { 593 if (dentry) {
594 drop_nlink(dentry->d_inode); 594 drop_nlink(d_inode(dentry));
595 d_drop(dentry); 595 d_drop(dentry);
596 dput(dentry); 596 dput(dentry);
597 simple_release_fs(&bm_mnt, &entry_count); 597 simple_release_fs(&bm_mnt, &entry_count);
@@ -638,11 +638,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
638 case 3: 638 case 3:
639 /* Delete this handler. */ 639 /* Delete this handler. */
640 root = dget(file->f_path.dentry->d_sb->s_root); 640 root = dget(file->f_path.dentry->d_sb->s_root);
641 mutex_lock(&root->d_inode->i_mutex); 641 mutex_lock(&d_inode(root)->i_mutex);
642 642
643 kill_node(e); 643 kill_node(e);
644 644
645 mutex_unlock(&root->d_inode->i_mutex); 645 mutex_unlock(&d_inode(root)->i_mutex);
646 dput(root); 646 dput(root);
647 break; 647 break;
648 default: 648 default:
@@ -675,14 +675,14 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
675 return PTR_ERR(e); 675 return PTR_ERR(e);
676 676
677 root = dget(sb->s_root); 677 root = dget(sb->s_root);
678 mutex_lock(&root->d_inode->i_mutex); 678 mutex_lock(&d_inode(root)->i_mutex);
679 dentry = lookup_one_len(e->name, root, strlen(e->name)); 679 dentry = lookup_one_len(e->name, root, strlen(e->name));
680 err = PTR_ERR(dentry); 680 err = PTR_ERR(dentry);
681 if (IS_ERR(dentry)) 681 if (IS_ERR(dentry))
682 goto out; 682 goto out;
683 683
684 err = -EEXIST; 684 err = -EEXIST;
685 if (dentry->d_inode) 685 if (d_really_is_positive(dentry))
686 goto out2; 686 goto out2;
687 687
688 inode = bm_get_inode(sb, S_IFREG | 0644); 688 inode = bm_get_inode(sb, S_IFREG | 0644);
@@ -711,7 +711,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
711out2: 711out2:
712 dput(dentry); 712 dput(dentry);
713out: 713out:
714 mutex_unlock(&root->d_inode->i_mutex); 714 mutex_unlock(&d_inode(root)->i_mutex);
715 dput(root); 715 dput(root);
716 716
717 if (err) { 717 if (err) {
@@ -754,12 +754,12 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer,
754 case 3: 754 case 3:
755 /* Delete all handlers. */ 755 /* Delete all handlers. */
756 root = dget(file->f_path.dentry->d_sb->s_root); 756 root = dget(file->f_path.dentry->d_sb->s_root);
757 mutex_lock(&root->d_inode->i_mutex); 757 mutex_lock(&d_inode(root)->i_mutex);
758 758
759 while (!list_empty(&entries)) 759 while (!list_empty(&entries))
760 kill_node(list_entry(entries.next, Node, list)); 760 kill_node(list_entry(entries.next, Node, list));
761 761
762 mutex_unlock(&root->d_inode->i_mutex); 762 mutex_unlock(&d_inode(root)->i_mutex);
763 dput(root); 763 dput(root);
764 break; 764 break;
765 default: 765 default:
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 897ee0503932..c7e4163ede87 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -152,7 +152,8 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
152 struct inode *inode = file->f_mapping->host; 152 struct inode *inode = file->f_mapping->host;
153 153
154 return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset, 154 return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset,
155 blkdev_get_block, NULL, NULL, 0); 155 blkdev_get_block, NULL, NULL,
156 DIO_SKIP_DIO_COUNT);
156} 157}
157 158
158int __sync_blockdev(struct block_device *bdev, int wait) 159int __sync_blockdev(struct block_device *bdev, int wait)
@@ -1716,7 +1717,7 @@ struct block_device *lookup_bdev(const char *pathname)
1716 if (error) 1717 if (error)
1717 return ERR_PTR(error); 1718 return ERR_PTR(error);
1718 1719
1719 inode = path.dentry->d_inode; 1720 inode = d_backing_inode(path.dentry);
1720 error = -ENOTBLK; 1721 error = -ENOTBLK;
1721 if (!S_ISBLK(inode->i_mode)) 1722 if (!S_ISBLK(inode->i_mode))
1722 goto fail; 1723 goto fail;
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 467620a3b1f9..b072e17479aa 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1862,7 +1862,7 @@ static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end)
1862int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) 1862int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1863{ 1863{
1864 struct dentry *dentry = file->f_path.dentry; 1864 struct dentry *dentry = file->f_path.dentry;
1865 struct inode *inode = dentry->d_inode; 1865 struct inode *inode = d_inode(dentry);
1866 struct btrfs_root *root = BTRFS_I(inode)->root; 1866 struct btrfs_root *root = BTRFS_I(inode)->root;
1867 struct btrfs_trans_handle *trans; 1867 struct btrfs_trans_handle *trans;
1868 struct btrfs_log_ctx ctx; 1868 struct btrfs_log_ctx ctx;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 56f00a25c003..ada4d24ed11b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4020,16 +4020,16 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
4020{ 4020{
4021 struct btrfs_root *root = BTRFS_I(dir)->root; 4021 struct btrfs_root *root = BTRFS_I(dir)->root;
4022 struct btrfs_trans_handle *trans; 4022 struct btrfs_trans_handle *trans;
4023 struct inode *inode = dentry->d_inode; 4023 struct inode *inode = d_inode(dentry);
4024 int ret; 4024 int ret;
4025 4025
4026 trans = __unlink_start_trans(dir); 4026 trans = __unlink_start_trans(dir);
4027 if (IS_ERR(trans)) 4027 if (IS_ERR(trans))
4028 return PTR_ERR(trans); 4028 return PTR_ERR(trans);
4029 4029
4030 btrfs_record_unlink_dir(trans, dir, dentry->d_inode, 0); 4030 btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0);
4031 4031
4032 ret = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, 4032 ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
4033 dentry->d_name.name, dentry->d_name.len); 4033 dentry->d_name.name, dentry->d_name.len);
4034 if (ret) 4034 if (ret)
4035 goto out; 4035 goto out;
@@ -4128,7 +4128,7 @@ out:
4128 4128
4129static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) 4129static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4130{ 4130{
4131 struct inode *inode = dentry->d_inode; 4131 struct inode *inode = d_inode(dentry);
4132 int err = 0; 4132 int err = 0;
4133 struct btrfs_root *root = BTRFS_I(dir)->root; 4133 struct btrfs_root *root = BTRFS_I(dir)->root;
4134 struct btrfs_trans_handle *trans; 4134 struct btrfs_trans_handle *trans;
@@ -4155,7 +4155,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4155 goto out; 4155 goto out;
4156 4156
4157 /* now the directory is empty */ 4157 /* now the directory is empty */
4158 err = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, 4158 err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
4159 dentry->d_name.name, dentry->d_name.len); 4159 dentry->d_name.name, dentry->d_name.len);
4160 if (!err) 4160 if (!err)
4161 btrfs_i_size_write(inode, 0); 4161 btrfs_i_size_write(inode, 0);
@@ -4915,7 +4915,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
4915 4915
4916static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) 4916static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
4917{ 4917{
4918 struct inode *inode = dentry->d_inode; 4918 struct inode *inode = d_inode(dentry);
4919 struct btrfs_root *root = BTRFS_I(inode)->root; 4919 struct btrfs_root *root = BTRFS_I(inode)->root;
4920 int err; 4920 int err;
4921 4921
@@ -5547,10 +5547,10 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
5547static int btrfs_dentry_delete(const struct dentry *dentry) 5547static int btrfs_dentry_delete(const struct dentry *dentry)
5548{ 5548{
5549 struct btrfs_root *root; 5549 struct btrfs_root *root;
5550 struct inode *inode = dentry->d_inode; 5550 struct inode *inode = d_inode(dentry);
5551 5551
5552 if (!inode && !IS_ROOT(dentry)) 5552 if (!inode && !IS_ROOT(dentry))
5553 inode = dentry->d_parent->d_inode; 5553 inode = d_inode(dentry->d_parent);
5554 5554
5555 if (inode) { 5555 if (inode) {
5556 root = BTRFS_I(inode)->root; 5556 root = BTRFS_I(inode)->root;
@@ -6357,7 +6357,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
6357{ 6357{
6358 struct btrfs_trans_handle *trans; 6358 struct btrfs_trans_handle *trans;
6359 struct btrfs_root *root = BTRFS_I(dir)->root; 6359 struct btrfs_root *root = BTRFS_I(dir)->root;
6360 struct inode *inode = old_dentry->d_inode; 6360 struct inode *inode = d_inode(old_dentry);
6361 u64 index; 6361 u64 index;
6362 int err; 6362 int err;
6363 int drop_inode = 0; 6363 int drop_inode = 0;
@@ -8260,7 +8260,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
8260 if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset)) 8260 if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset))
8261 return 0; 8261 return 0;
8262 8262
8263 atomic_inc(&inode->i_dio_count); 8263 inode_dio_begin(inode);
8264 smp_mb__after_atomic(); 8264 smp_mb__after_atomic();
8265 8265
8266 /* 8266 /*
@@ -8300,7 +8300,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
8300 current->journal_info = &outstanding_extents; 8300 current->journal_info = &outstanding_extents;
8301 } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, 8301 } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK,
8302 &BTRFS_I(inode)->runtime_flags)) { 8302 &BTRFS_I(inode)->runtime_flags)) {
8303 inode_dio_done(inode); 8303 inode_dio_end(inode);
8304 flags = DIO_LOCKING | DIO_SKIP_HOLES; 8304 flags = DIO_LOCKING | DIO_SKIP_HOLES;
8305 wakeup = false; 8305 wakeup = false;
8306 } 8306 }
@@ -8319,7 +8319,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
8319 } 8319 }
8320out: 8320out:
8321 if (wakeup) 8321 if (wakeup)
8322 inode_dio_done(inode); 8322 inode_dio_end(inode);
8323 if (relock) 8323 if (relock)
8324 mutex_lock(&inode->i_mutex); 8324 mutex_lock(&inode->i_mutex);
8325 8325
@@ -9006,7 +9006,7 @@ static int btrfs_getattr(struct vfsmount *mnt,
9006 struct dentry *dentry, struct kstat *stat) 9006 struct dentry *dentry, struct kstat *stat)
9007{ 9007{
9008 u64 delalloc_bytes; 9008 u64 delalloc_bytes;
9009 struct inode *inode = dentry->d_inode; 9009 struct inode *inode = d_inode(dentry);
9010 u32 blocksize = inode->i_sb->s_blocksize; 9010 u32 blocksize = inode->i_sb->s_blocksize;
9011 9011
9012 generic_fillattr(inode, stat); 9012 generic_fillattr(inode, stat);
@@ -9027,8 +9027,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9027 struct btrfs_trans_handle *trans; 9027 struct btrfs_trans_handle *trans;
9028 struct btrfs_root *root = BTRFS_I(old_dir)->root; 9028 struct btrfs_root *root = BTRFS_I(old_dir)->root;
9029 struct btrfs_root *dest = BTRFS_I(new_dir)->root; 9029 struct btrfs_root *dest = BTRFS_I(new_dir)->root;
9030 struct inode *new_inode = new_dentry->d_inode; 9030 struct inode *new_inode = d_inode(new_dentry);
9031 struct inode *old_inode = old_dentry->d_inode; 9031 struct inode *old_inode = d_inode(old_dentry);
9032 struct timespec ctime = CURRENT_TIME; 9032 struct timespec ctime = CURRENT_TIME;
9033 u64 index = 0; 9033 u64 index = 0;
9034 u64 root_objectid; 9034 u64 root_objectid;
@@ -9140,7 +9140,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9140 old_dentry->d_name.len); 9140 old_dentry->d_name.len);
9141 } else { 9141 } else {
9142 ret = __btrfs_unlink_inode(trans, root, old_dir, 9142 ret = __btrfs_unlink_inode(trans, root, old_dir,
9143 old_dentry->d_inode, 9143 d_inode(old_dentry),
9144 old_dentry->d_name.name, 9144 old_dentry->d_name.name,
9145 old_dentry->d_name.len); 9145 old_dentry->d_name.len);
9146 if (!ret) 9146 if (!ret)
@@ -9164,12 +9164,12 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9164 BUG_ON(new_inode->i_nlink == 0); 9164 BUG_ON(new_inode->i_nlink == 0);
9165 } else { 9165 } else {
9166 ret = btrfs_unlink_inode(trans, dest, new_dir, 9166 ret = btrfs_unlink_inode(trans, dest, new_dir,
9167 new_dentry->d_inode, 9167 d_inode(new_dentry),
9168 new_dentry->d_name.name, 9168 new_dentry->d_name.name,
9169 new_dentry->d_name.len); 9169 new_dentry->d_name.len);
9170 } 9170 }
9171 if (!ret && new_inode->i_nlink == 0) 9171 if (!ret && new_inode->i_nlink == 0)
9172 ret = btrfs_orphan_add(trans, new_dentry->d_inode); 9172 ret = btrfs_orphan_add(trans, d_inode(new_dentry));
9173 if (ret) { 9173 if (ret) {
9174 btrfs_abort_transaction(trans, root, ret); 9174 btrfs_abort_transaction(trans, root, ret);
9175 goto out_fail; 9175 goto out_fail;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ca5d968f4c37..b05653f182c2 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -724,7 +724,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
724 if (ret) 724 if (ret)
725 goto fail; 725 goto fail;
726 726
727 inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); 727 inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
728 if (IS_ERR(inode)) { 728 if (IS_ERR(inode)) {
729 ret = PTR_ERR(inode); 729 ret = PTR_ERR(inode);
730 goto fail; 730 goto fail;
@@ -768,10 +768,10 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
768{ 768{
769 int error; 769 int error;
770 770
771 if (!victim->d_inode) 771 if (d_really_is_negative(victim))
772 return -ENOENT; 772 return -ENOENT;
773 773
774 BUG_ON(victim->d_parent->d_inode != dir); 774 BUG_ON(d_inode(victim->d_parent) != dir);
775 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); 775 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
776 776
777 error = inode_permission(dir, MAY_WRITE | MAY_EXEC); 777 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
@@ -779,8 +779,8 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
779 return error; 779 return error;
780 if (IS_APPEND(dir)) 780 if (IS_APPEND(dir))
781 return -EPERM; 781 return -EPERM;
782 if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || 782 if (check_sticky(dir, d_inode(victim)) || IS_APPEND(d_inode(victim)) ||
783 IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) 783 IS_IMMUTABLE(d_inode(victim)) || IS_SWAPFILE(d_inode(victim)))
784 return -EPERM; 784 return -EPERM;
785 if (isdir) { 785 if (isdir) {
786 if (!d_is_dir(victim)) 786 if (!d_is_dir(victim))
@@ -799,7 +799,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
799/* copy of may_create in fs/namei.c() */ 799/* copy of may_create in fs/namei.c() */
800static inline int btrfs_may_create(struct inode *dir, struct dentry *child) 800static inline int btrfs_may_create(struct inode *dir, struct dentry *child)
801{ 801{
802 if (child->d_inode) 802 if (d_really_is_positive(child))
803 return -EEXIST; 803 return -EEXIST;
804 if (IS_DEADDIR(dir)) 804 if (IS_DEADDIR(dir))
805 return -ENOENT; 805 return -ENOENT;
@@ -817,7 +817,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
817 u64 *async_transid, bool readonly, 817 u64 *async_transid, bool readonly,
818 struct btrfs_qgroup_inherit *inherit) 818 struct btrfs_qgroup_inherit *inherit)
819{ 819{
820 struct inode *dir = parent->dentry->d_inode; 820 struct inode *dir = d_inode(parent->dentry);
821 struct dentry *dentry; 821 struct dentry *dentry;
822 int error; 822 int error;
823 823
@@ -831,7 +831,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
831 goto out_unlock; 831 goto out_unlock;
832 832
833 error = -EEXIST; 833 error = -EEXIST;
834 if (dentry->d_inode) 834 if (d_really_is_positive(dentry))
835 goto out_dput; 835 goto out_dput;
836 836
837 error = btrfs_may_create(dir, dentry); 837 error = btrfs_may_create(dir, dentry);
@@ -2301,7 +2301,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2301{ 2301{
2302 struct dentry *parent = file->f_path.dentry; 2302 struct dentry *parent = file->f_path.dentry;
2303 struct dentry *dentry; 2303 struct dentry *dentry;
2304 struct inode *dir = parent->d_inode; 2304 struct inode *dir = d_inode(parent);
2305 struct inode *inode; 2305 struct inode *inode;
2306 struct btrfs_root *root = BTRFS_I(dir)->root; 2306 struct btrfs_root *root = BTRFS_I(dir)->root;
2307 struct btrfs_root *dest = NULL; 2307 struct btrfs_root *dest = NULL;
@@ -2340,12 +2340,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2340 goto out_unlock_dir; 2340 goto out_unlock_dir;
2341 } 2341 }
2342 2342
2343 if (!dentry->d_inode) { 2343 if (d_really_is_negative(dentry)) {
2344 err = -ENOENT; 2344 err = -ENOENT;
2345 goto out_dput; 2345 goto out_dput;
2346 } 2346 }
2347 2347
2348 inode = dentry->d_inode; 2348 inode = d_inode(dentry);
2349 dest = BTRFS_I(inode)->root; 2349 dest = BTRFS_I(inode)->root;
2350 if (!capable(CAP_SYS_ADMIN)) { 2350 if (!capable(CAP_SYS_ADMIN)) {
2351 /* 2351 /*
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f2c9f9db3b19..9e66f5e724db 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -925,7 +925,7 @@ setup_root:
925 * a reference to the dentry. We will have already gotten a reference 925 * a reference to the dentry. We will have already gotten a reference
926 * to the inode in btrfs_fill_super so we're good to go. 926 * to the inode in btrfs_fill_super so we're good to go.
927 */ 927 */
928 if (!new && sb->s_root->d_inode == inode) { 928 if (!new && d_inode(sb->s_root) == inode) {
929 iput(inode); 929 iput(inode);
930 return dget(sb->s_root); 930 return dget(sb->s_root);
931 } 931 }
@@ -1230,7 +1230,7 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags,
1230 1230
1231 root = mount_subtree(mnt, subvol_name); 1231 root = mount_subtree(mnt, subvol_name);
1232 1232
1233 if (!IS_ERR(root) && !is_subvolume_inode(root->d_inode)) { 1233 if (!IS_ERR(root) && !is_subvolume_inode(d_inode(root))) {
1234 struct super_block *s = root->d_sb; 1234 struct super_block *s = root->d_sb;
1235 dput(root); 1235 dput(root);
1236 root = ERR_PTR(-EINVAL); 1236 root = ERR_PTR(-EINVAL);
@@ -1895,8 +1895,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1895 buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); 1895 buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]);
1896 buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); 1896 buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]);
1897 /* Mask in the root object ID too, to disambiguate subvols */ 1897 /* Mask in the root object ID too, to disambiguate subvols */
1898 buf->f_fsid.val[0] ^= BTRFS_I(dentry->d_inode)->root->objectid >> 32; 1898 buf->f_fsid.val[0] ^= BTRFS_I(d_inode(dentry))->root->objectid >> 32;
1899 buf->f_fsid.val[1] ^= BTRFS_I(dentry->d_inode)->root->objectid; 1899 buf->f_fsid.val[1] ^= BTRFS_I(d_inode(dentry))->root->objectid;
1900 1900
1901 return 0; 1901 return 0;
1902} 1902}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a089b5944efc..d04968374e9d 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4474,9 +4474,9 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4474 goto out; 4474 goto out;
4475 4475
4476 if (!S_ISDIR(inode->i_mode)) { 4476 if (!S_ISDIR(inode->i_mode)) {
4477 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4477 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4478 goto out; 4478 goto out;
4479 inode = parent->d_inode; 4479 inode = d_inode(parent);
4480 } 4480 }
4481 4481
4482 while (1) { 4482 while (1) {
@@ -4502,7 +4502,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4502 break; 4502 break;
4503 } 4503 }
4504 4504
4505 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4505 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4506 break; 4506 break;
4507 4507
4508 if (IS_ROOT(parent)) 4508 if (IS_ROOT(parent))
@@ -4511,7 +4511,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4511 parent = dget_parent(parent); 4511 parent = dget_parent(parent);
4512 dput(old_parent); 4512 dput(old_parent);
4513 old_parent = parent; 4513 old_parent = parent;
4514 inode = parent->d_inode; 4514 inode = d_inode(parent);
4515 4515
4516 } 4516 }
4517 dput(old_parent); 4517 dput(old_parent);
@@ -4777,10 +4777,10 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
4777 log_dentries = true; 4777 log_dentries = true;
4778 4778
4779 while (1) { 4779 while (1) {
4780 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 4780 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
4781 break; 4781 break;
4782 4782
4783 inode = parent->d_inode; 4783 inode = d_inode(parent);
4784 if (root != BTRFS_I(inode)->root) 4784 if (root != BTRFS_I(inode)->root)
4785 break; 4785 break;
4786 4786
@@ -4845,7 +4845,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,
4845 struct dentry *parent = dget_parent(dentry); 4845 struct dentry *parent = dget_parent(dentry);
4846 int ret; 4846 int ret;
4847 4847
4848 ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, 4848 ret = btrfs_log_inode_parent(trans, root, d_inode(dentry), parent,
4849 start, end, 0, ctx); 4849 start, end, 0, ctx);
4850 dput(parent); 4850 dput(parent);
4851 4851
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 45ea704be030..6f518c90e1c1 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;
@@ -411,13 +411,13 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
411 ret = btrfs_is_valid_xattr(name); 411 ret = btrfs_is_valid_xattr(name);
412 if (ret) 412 if (ret)
413 return ret; 413 return ret;
414 return __btrfs_getxattr(dentry->d_inode, name, buffer, size); 414 return __btrfs_getxattr(d_inode(dentry), name, buffer, size);
415} 415}
416 416
417int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, 417int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
418 size_t size, int flags) 418 size_t size, int flags)
419{ 419{
420 struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; 420 struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root;
421 int ret; 421 int ret;
422 422
423 /* 423 /*
@@ -440,19 +440,19 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
440 return ret; 440 return ret;
441 441
442 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) 442 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
443 return btrfs_set_prop(dentry->d_inode, name, 443 return btrfs_set_prop(d_inode(dentry), name,
444 value, size, flags); 444 value, size, flags);
445 445
446 if (size == 0) 446 if (size == 0)
447 value = ""; /* empty EA, do not remove */ 447 value = ""; /* empty EA, do not remove */
448 448
449 return __btrfs_setxattr(NULL, dentry->d_inode, name, value, size, 449 return __btrfs_setxattr(NULL, d_inode(dentry), name, value, size,
450 flags); 450 flags);
451} 451}
452 452
453int btrfs_removexattr(struct dentry *dentry, const char *name) 453int btrfs_removexattr(struct dentry *dentry, const char *name)
454{ 454{
455 struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; 455 struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root;
456 int ret; 456 int ret;
457 457
458 /* 458 /*
@@ -475,10 +475,10 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
475 return ret; 475 return ret;
476 476
477 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) 477 if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
478 return btrfs_set_prop(dentry->d_inode, name, 478 return btrfs_set_prop(d_inode(dentry), name,
479 NULL, 0, XATTR_REPLACE); 479 NULL, 0, XATTR_REPLACE);
480 480
481 return __btrfs_setxattr(NULL, dentry->d_inode, name, NULL, 0, 481 return __btrfs_setxattr(NULL, d_inode(dentry), name, NULL, 0,
482 XATTR_REPLACE); 482 XATTR_REPLACE);
483} 483}
484 484
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c
index fbb08e97438d..6af790fc3df8 100644
--- a/fs/cachefiles/bind.c
+++ b/fs/cachefiles/bind.c
@@ -123,11 +123,11 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
123 123
124 /* check parameters */ 124 /* check parameters */
125 ret = -EOPNOTSUPP; 125 ret = -EOPNOTSUPP;
126 if (!root->d_inode || 126 if (d_is_negative(root) ||
127 !root->d_inode->i_op->lookup || 127 !d_backing_inode(root)->i_op->lookup ||
128 !root->d_inode->i_op->mkdir || 128 !d_backing_inode(root)->i_op->mkdir ||
129 !root->d_inode->i_op->setxattr || 129 !d_backing_inode(root)->i_op->setxattr ||
130 !root->d_inode->i_op->getxattr || 130 !d_backing_inode(root)->i_op->getxattr ||
131 !root->d_sb->s_op->statfs || 131 !root->d_sb->s_op->statfs ||
132 !root->d_sb->s_op->sync_fs) 132 !root->d_sb->s_op->sync_fs)
133 goto error_unsupported; 133 goto error_unsupported;
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 232426214fdd..afa023dded5b 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -441,12 +441,12 @@ static int cachefiles_attr_changed(struct fscache_object *_object)
441 441
442 fscache_set_store_limit(&object->fscache, ni_size); 442 fscache_set_store_limit(&object->fscache, ni_size);
443 443
444 oi_size = i_size_read(object->backer->d_inode); 444 oi_size = i_size_read(d_backing_inode(object->backer));
445 if (oi_size == ni_size) 445 if (oi_size == ni_size)
446 return 0; 446 return 0;
447 447
448 cachefiles_begin_secure(cache, &saved_cred); 448 cachefiles_begin_secure(cache, &saved_cred);
449 mutex_lock(&object->backer->d_inode->i_mutex); 449 mutex_lock(&d_inode(object->backer)->i_mutex);
450 450
451 /* if there's an extension to a partial page at the end of the backing 451 /* if there's an extension to a partial page at the end of the backing
452 * file, we need to discard the partial page so that we pick up new 452 * file, we need to discard the partial page so that we pick up new
@@ -465,7 +465,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object)
465 ret = notify_change(object->backer, &newattrs, NULL); 465 ret = notify_change(object->backer, &newattrs, NULL);
466 466
467truncate_failed: 467truncate_failed:
468 mutex_unlock(&object->backer->d_inode->i_mutex); 468 mutex_unlock(&d_inode(object->backer)->i_mutex);
469 cachefiles_end_secure(cache, saved_cred); 469 cachefiles_end_secure(cache, saved_cred);
470 470
471 if (ret == -EIO) { 471 if (ret == -EIO) {
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 1e51714eb33e..ab857ab9f40d 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -286,13 +286,13 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
286 if (ret < 0) { 286 if (ret < 0) {
287 cachefiles_io_error(cache, "Unlink security error"); 287 cachefiles_io_error(cache, "Unlink security error");
288 } else { 288 } else {
289 ret = vfs_unlink(dir->d_inode, rep, NULL); 289 ret = vfs_unlink(d_inode(dir), rep, NULL);
290 290
291 if (preemptive) 291 if (preemptive)
292 cachefiles_mark_object_buried(cache, rep); 292 cachefiles_mark_object_buried(cache, rep);
293 } 293 }
294 294
295 mutex_unlock(&dir->d_inode->i_mutex); 295 mutex_unlock(&d_inode(dir)->i_mutex);
296 296
297 if (ret == -EIO) 297 if (ret == -EIO)
298 cachefiles_io_error(cache, "Unlink failed"); 298 cachefiles_io_error(cache, "Unlink failed");
@@ -303,7 +303,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
303 303
304 /* directories have to be moved to the graveyard */ 304 /* directories have to be moved to the graveyard */
305 _debug("move stale object to graveyard"); 305 _debug("move stale object to graveyard");
306 mutex_unlock(&dir->d_inode->i_mutex); 306 mutex_unlock(&d_inode(dir)->i_mutex);
307 307
308try_again: 308try_again:
309 /* first step is to make up a grave dentry in the graveyard */ 309 /* first step is to make up a grave dentry in the graveyard */
@@ -355,7 +355,7 @@ try_again:
355 return -EIO; 355 return -EIO;
356 } 356 }
357 357
358 if (grave->d_inode) { 358 if (d_is_positive(grave)) {
359 unlock_rename(cache->graveyard, dir); 359 unlock_rename(cache->graveyard, dir);
360 dput(grave); 360 dput(grave);
361 grave = NULL; 361 grave = NULL;
@@ -387,8 +387,8 @@ try_again:
387 if (ret < 0) { 387 if (ret < 0) {
388 cachefiles_io_error(cache, "Rename security error %d", ret); 388 cachefiles_io_error(cache, "Rename security error %d", ret);
389 } else { 389 } else {
390 ret = vfs_rename(dir->d_inode, rep, 390 ret = vfs_rename(d_inode(dir), rep,
391 cache->graveyard->d_inode, grave, NULL, 0); 391 d_inode(cache->graveyard), grave, NULL, 0);
392 if (ret != 0 && ret != -ENOMEM) 392 if (ret != 0 && ret != -ENOMEM)
393 cachefiles_io_error(cache, 393 cachefiles_io_error(cache,
394 "Rename failed with error %d", ret); 394 "Rename failed with error %d", ret);
@@ -415,18 +415,18 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
415 _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry); 415 _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry);
416 416
417 ASSERT(object->dentry); 417 ASSERT(object->dentry);
418 ASSERT(object->dentry->d_inode); 418 ASSERT(d_backing_inode(object->dentry));
419 ASSERT(object->dentry->d_parent); 419 ASSERT(object->dentry->d_parent);
420 420
421 dir = dget_parent(object->dentry); 421 dir = dget_parent(object->dentry);
422 422
423 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 423 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
424 424
425 if (test_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) { 425 if (test_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) {
426 /* object allocation for the same key preemptively deleted this 426 /* object allocation for the same key preemptively deleted this
427 * object's file so that it could create its own file */ 427 * object's file so that it could create its own file */
428 _debug("object preemptively buried"); 428 _debug("object preemptively buried");
429 mutex_unlock(&dir->d_inode->i_mutex); 429 mutex_unlock(&d_inode(dir)->i_mutex);
430 ret = 0; 430 ret = 0;
431 } else { 431 } else {
432 /* we need to check that our parent is _still_ our parent - it 432 /* we need to check that our parent is _still_ our parent - it
@@ -438,7 +438,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
438 /* it got moved, presumably by cachefilesd culling it, 438 /* it got moved, presumably by cachefilesd culling it,
439 * so it's no longer in the key path and we can ignore 439 * so it's no longer in the key path and we can ignore
440 * it */ 440 * it */
441 mutex_unlock(&dir->d_inode->i_mutex); 441 mutex_unlock(&d_inode(dir)->i_mutex);
442 ret = 0; 442 ret = 0;
443 } 443 }
444 } 444 }
@@ -473,7 +473,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
473 path.mnt = cache->mnt; 473 path.mnt = cache->mnt;
474 474
475 ASSERT(parent->dentry); 475 ASSERT(parent->dentry);
476 ASSERT(parent->dentry->d_inode); 476 ASSERT(d_backing_inode(parent->dentry));
477 477
478 if (!(d_is_dir(parent->dentry))) { 478 if (!(d_is_dir(parent->dentry))) {
479 // TODO: convert file to dir 479 // TODO: convert file to dir
@@ -497,7 +497,7 @@ lookup_again:
497 /* search the current directory for the element name */ 497 /* search the current directory for the element name */
498 _debug("lookup '%s'", name); 498 _debug("lookup '%s'", name);
499 499
500 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 500 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
501 501
502 start = jiffies; 502 start = jiffies;
503 next = lookup_one_len(name, dir, nlen); 503 next = lookup_one_len(name, dir, nlen);
@@ -505,21 +505,21 @@ lookup_again:
505 if (IS_ERR(next)) 505 if (IS_ERR(next))
506 goto lookup_error; 506 goto lookup_error;
507 507
508 _debug("next -> %p %s", next, next->d_inode ? "positive" : "negative"); 508 _debug("next -> %p %s", next, d_backing_inode(next) ? "positive" : "negative");
509 509
510 if (!key) 510 if (!key)
511 object->new = !next->d_inode; 511 object->new = !d_backing_inode(next);
512 512
513 /* if this element of the path doesn't exist, then the lookup phase 513 /* if this element of the path doesn't exist, then the lookup phase
514 * failed, and we can release any readers in the certain knowledge that 514 * failed, and we can release any readers in the certain knowledge that
515 * there's nothing for them to actually read */ 515 * there's nothing for them to actually read */
516 if (!next->d_inode) 516 if (d_is_negative(next))
517 fscache_object_lookup_negative(&object->fscache); 517 fscache_object_lookup_negative(&object->fscache);
518 518
519 /* we need to create the object if it's negative */ 519 /* we need to create the object if it's negative */
520 if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) { 520 if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) {
521 /* index objects and intervening tree levels must be subdirs */ 521 /* index objects and intervening tree levels must be subdirs */
522 if (!next->d_inode) { 522 if (d_is_negative(next)) {
523 ret = cachefiles_has_space(cache, 1, 0); 523 ret = cachefiles_has_space(cache, 1, 0);
524 if (ret < 0) 524 if (ret < 0)
525 goto create_error; 525 goto create_error;
@@ -529,26 +529,26 @@ lookup_again:
529 if (ret < 0) 529 if (ret < 0)
530 goto create_error; 530 goto create_error;
531 start = jiffies; 531 start = jiffies;
532 ret = vfs_mkdir(dir->d_inode, next, 0); 532 ret = vfs_mkdir(d_inode(dir), next, 0);
533 cachefiles_hist(cachefiles_mkdir_histogram, start); 533 cachefiles_hist(cachefiles_mkdir_histogram, start);
534 if (ret < 0) 534 if (ret < 0)
535 goto create_error; 535 goto create_error;
536 536
537 ASSERT(next->d_inode); 537 ASSERT(d_backing_inode(next));
538 538
539 _debug("mkdir -> %p{%p{ino=%lu}}", 539 _debug("mkdir -> %p{%p{ino=%lu}}",
540 next, next->d_inode, next->d_inode->i_ino); 540 next, d_backing_inode(next), d_backing_inode(next)->i_ino);
541 541
542 } else if (!d_can_lookup(next)) { 542 } else if (!d_can_lookup(next)) {
543 pr_err("inode %lu is not a directory\n", 543 pr_err("inode %lu is not a directory\n",
544 next->d_inode->i_ino); 544 d_backing_inode(next)->i_ino);
545 ret = -ENOBUFS; 545 ret = -ENOBUFS;
546 goto error; 546 goto error;
547 } 547 }
548 548
549 } else { 549 } else {
550 /* non-index objects start out life as files */ 550 /* non-index objects start out life as files */
551 if (!next->d_inode) { 551 if (d_is_negative(next)) {
552 ret = cachefiles_has_space(cache, 1, 0); 552 ret = cachefiles_has_space(cache, 1, 0);
553 if (ret < 0) 553 if (ret < 0)
554 goto create_error; 554 goto create_error;
@@ -558,21 +558,21 @@ lookup_again:
558 if (ret < 0) 558 if (ret < 0)
559 goto create_error; 559 goto create_error;
560 start = jiffies; 560 start = jiffies;
561 ret = vfs_create(dir->d_inode, next, S_IFREG, true); 561 ret = vfs_create(d_inode(dir), next, S_IFREG, true);
562 cachefiles_hist(cachefiles_create_histogram, start); 562 cachefiles_hist(cachefiles_create_histogram, start);
563 if (ret < 0) 563 if (ret < 0)
564 goto create_error; 564 goto create_error;
565 565
566 ASSERT(next->d_inode); 566 ASSERT(d_backing_inode(next));
567 567
568 _debug("create -> %p{%p{ino=%lu}}", 568 _debug("create -> %p{%p{ino=%lu}}",
569 next, next->d_inode, next->d_inode->i_ino); 569 next, d_backing_inode(next), d_backing_inode(next)->i_ino);
570 570
571 } else if (!d_can_lookup(next) && 571 } else if (!d_can_lookup(next) &&
572 !d_is_reg(next) 572 !d_is_reg(next)
573 ) { 573 ) {
574 pr_err("inode %lu is not a file or directory\n", 574 pr_err("inode %lu is not a file or directory\n",
575 next->d_inode->i_ino); 575 d_backing_inode(next)->i_ino);
576 ret = -ENOBUFS; 576 ret = -ENOBUFS;
577 goto error; 577 goto error;
578 } 578 }
@@ -581,7 +581,7 @@ lookup_again:
581 /* process the next component */ 581 /* process the next component */
582 if (key) { 582 if (key) {
583 _debug("advance"); 583 _debug("advance");
584 mutex_unlock(&dir->d_inode->i_mutex); 584 mutex_unlock(&d_inode(dir)->i_mutex);
585 dput(dir); 585 dput(dir);
586 dir = next; 586 dir = next;
587 next = NULL; 587 next = NULL;
@@ -617,7 +617,7 @@ lookup_again:
617 /* note that we're now using this object */ 617 /* note that we're now using this object */
618 ret = cachefiles_mark_object_active(cache, object); 618 ret = cachefiles_mark_object_active(cache, object);
619 619
620 mutex_unlock(&dir->d_inode->i_mutex); 620 mutex_unlock(&d_inode(dir)->i_mutex);
621 dput(dir); 621 dput(dir);
622 dir = NULL; 622 dir = NULL;
623 623
@@ -646,7 +646,7 @@ lookup_again:
646 const struct address_space_operations *aops; 646 const struct address_space_operations *aops;
647 647
648 ret = -EPERM; 648 ret = -EPERM;
649 aops = object->dentry->d_inode->i_mapping->a_ops; 649 aops = d_backing_inode(object->dentry)->i_mapping->a_ops;
650 if (!aops->bmap) 650 if (!aops->bmap)
651 goto check_error; 651 goto check_error;
652 652
@@ -659,7 +659,7 @@ lookup_again:
659 object->new = 0; 659 object->new = 0;
660 fscache_obtained_object(&object->fscache); 660 fscache_obtained_object(&object->fscache);
661 661
662 _leave(" = 0 [%lu]", object->dentry->d_inode->i_ino); 662 _leave(" = 0 [%lu]", d_backing_inode(object->dentry)->i_ino);
663 return 0; 663 return 0;
664 664
665create_error: 665create_error:
@@ -695,7 +695,7 @@ lookup_error:
695 cachefiles_io_error(cache, "Lookup failed"); 695 cachefiles_io_error(cache, "Lookup failed");
696 next = NULL; 696 next = NULL;
697error: 697error:
698 mutex_unlock(&dir->d_inode->i_mutex); 698 mutex_unlock(&d_inode(dir)->i_mutex);
699 dput(next); 699 dput(next);
700error_out2: 700error_out2:
701 dput(dir); 701 dput(dir);
@@ -719,7 +719,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
719 _enter(",,%s", dirname); 719 _enter(",,%s", dirname);
720 720
721 /* search the current directory for the element name */ 721 /* search the current directory for the element name */
722 mutex_lock(&dir->d_inode->i_mutex); 722 mutex_lock(&d_inode(dir)->i_mutex);
723 723
724 start = jiffies; 724 start = jiffies;
725 subdir = lookup_one_len(dirname, dir, strlen(dirname)); 725 subdir = lookup_one_len(dirname, dir, strlen(dirname));
@@ -731,10 +731,10 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
731 } 731 }
732 732
733 _debug("subdir -> %p %s", 733 _debug("subdir -> %p %s",
734 subdir, subdir->d_inode ? "positive" : "negative"); 734 subdir, d_backing_inode(subdir) ? "positive" : "negative");
735 735
736 /* we need to create the subdir if it doesn't exist yet */ 736 /* we need to create the subdir if it doesn't exist yet */
737 if (!subdir->d_inode) { 737 if (d_is_negative(subdir)) {
738 ret = cachefiles_has_space(cache, 1, 0); 738 ret = cachefiles_has_space(cache, 1, 0);
739 if (ret < 0) 739 if (ret < 0)
740 goto mkdir_error; 740 goto mkdir_error;
@@ -746,22 +746,22 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
746 ret = security_path_mkdir(&path, subdir, 0700); 746 ret = security_path_mkdir(&path, subdir, 0700);
747 if (ret < 0) 747 if (ret < 0)
748 goto mkdir_error; 748 goto mkdir_error;
749 ret = vfs_mkdir(dir->d_inode, subdir, 0700); 749 ret = vfs_mkdir(d_inode(dir), subdir, 0700);
750 if (ret < 0) 750 if (ret < 0)
751 goto mkdir_error; 751 goto mkdir_error;
752 752
753 ASSERT(subdir->d_inode); 753 ASSERT(d_backing_inode(subdir));
754 754
755 _debug("mkdir -> %p{%p{ino=%lu}}", 755 _debug("mkdir -> %p{%p{ino=%lu}}",
756 subdir, 756 subdir,
757 subdir->d_inode, 757 d_backing_inode(subdir),
758 subdir->d_inode->i_ino); 758 d_backing_inode(subdir)->i_ino);
759 } 759 }
760 760
761 mutex_unlock(&dir->d_inode->i_mutex); 761 mutex_unlock(&d_inode(dir)->i_mutex);
762 762
763 /* we need to make sure the subdir is a directory */ 763 /* we need to make sure the subdir is a directory */
764 ASSERT(subdir->d_inode); 764 ASSERT(d_backing_inode(subdir));
765 765
766 if (!d_can_lookup(subdir)) { 766 if (!d_can_lookup(subdir)) {
767 pr_err("%s is not a directory\n", dirname); 767 pr_err("%s is not a directory\n", dirname);
@@ -770,18 +770,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
770 } 770 }
771 771
772 ret = -EPERM; 772 ret = -EPERM;
773 if (!subdir->d_inode->i_op->setxattr || 773 if (!d_backing_inode(subdir)->i_op->setxattr ||
774 !subdir->d_inode->i_op->getxattr || 774 !d_backing_inode(subdir)->i_op->getxattr ||
775 !subdir->d_inode->i_op->lookup || 775 !d_backing_inode(subdir)->i_op->lookup ||
776 !subdir->d_inode->i_op->mkdir || 776 !d_backing_inode(subdir)->i_op->mkdir ||
777 !subdir->d_inode->i_op->create || 777 !d_backing_inode(subdir)->i_op->create ||
778 (!subdir->d_inode->i_op->rename && 778 (!d_backing_inode(subdir)->i_op->rename &&
779 !subdir->d_inode->i_op->rename2) || 779 !d_backing_inode(subdir)->i_op->rename2) ||
780 !subdir->d_inode->i_op->rmdir || 780 !d_backing_inode(subdir)->i_op->rmdir ||
781 !subdir->d_inode->i_op->unlink) 781 !d_backing_inode(subdir)->i_op->unlink)
782 goto check_error; 782 goto check_error;
783 783
784 _leave(" = [%lu]", subdir->d_inode->i_ino); 784 _leave(" = [%lu]", d_backing_inode(subdir)->i_ino);
785 return subdir; 785 return subdir;
786 786
787check_error: 787check_error:
@@ -790,19 +790,19 @@ check_error:
790 return ERR_PTR(ret); 790 return ERR_PTR(ret);
791 791
792mkdir_error: 792mkdir_error:
793 mutex_unlock(&dir->d_inode->i_mutex); 793 mutex_unlock(&d_inode(dir)->i_mutex);
794 dput(subdir); 794 dput(subdir);
795 pr_err("mkdir %s failed with error %d\n", dirname, ret); 795 pr_err("mkdir %s failed with error %d\n", dirname, ret);
796 return ERR_PTR(ret); 796 return ERR_PTR(ret);
797 797
798lookup_error: 798lookup_error:
799 mutex_unlock(&dir->d_inode->i_mutex); 799 mutex_unlock(&d_inode(dir)->i_mutex);
800 ret = PTR_ERR(subdir); 800 ret = PTR_ERR(subdir);
801 pr_err("Lookup %s failed with error %d\n", dirname, ret); 801 pr_err("Lookup %s failed with error %d\n", dirname, ret);
802 return ERR_PTR(ret); 802 return ERR_PTR(ret);
803 803
804nomem_d_alloc: 804nomem_d_alloc:
805 mutex_unlock(&dir->d_inode->i_mutex); 805 mutex_unlock(&d_inode(dir)->i_mutex);
806 _leave(" = -ENOMEM"); 806 _leave(" = -ENOMEM");
807 return ERR_PTR(-ENOMEM); 807 return ERR_PTR(-ENOMEM);
808} 808}
@@ -827,7 +827,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
827 // dir, filename); 827 // dir, filename);
828 828
829 /* look up the victim */ 829 /* look up the victim */
830 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 830 mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
831 831
832 start = jiffies; 832 start = jiffies;
833 victim = lookup_one_len(filename, dir, strlen(filename)); 833 victim = lookup_one_len(filename, dir, strlen(filename));
@@ -836,13 +836,13 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
836 goto lookup_error; 836 goto lookup_error;
837 837
838 //_debug("victim -> %p %s", 838 //_debug("victim -> %p %s",
839 // victim, victim->d_inode ? "positive" : "negative"); 839 // victim, d_backing_inode(victim) ? "positive" : "negative");
840 840
841 /* if the object is no longer there then we probably retired the object 841 /* if the object is no longer there then we probably retired the object
842 * at the netfs's request whilst the cull was in progress 842 * at the netfs's request whilst the cull was in progress
843 */ 843 */
844 if (!victim->d_inode) { 844 if (d_is_negative(victim)) {
845 mutex_unlock(&dir->d_inode->i_mutex); 845 mutex_unlock(&d_inode(dir)->i_mutex);
846 dput(victim); 846 dput(victim);
847 _leave(" = -ENOENT [absent]"); 847 _leave(" = -ENOENT [absent]");
848 return ERR_PTR(-ENOENT); 848 return ERR_PTR(-ENOENT);
@@ -871,13 +871,13 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
871 871
872object_in_use: 872object_in_use:
873 read_unlock(&cache->active_lock); 873 read_unlock(&cache->active_lock);
874 mutex_unlock(&dir->d_inode->i_mutex); 874 mutex_unlock(&d_inode(dir)->i_mutex);
875 dput(victim); 875 dput(victim);
876 //_leave(" = -EBUSY [in use]"); 876 //_leave(" = -EBUSY [in use]");
877 return ERR_PTR(-EBUSY); 877 return ERR_PTR(-EBUSY);
878 878
879lookup_error: 879lookup_error:
880 mutex_unlock(&dir->d_inode->i_mutex); 880 mutex_unlock(&d_inode(dir)->i_mutex);
881 ret = PTR_ERR(victim); 881 ret = PTR_ERR(victim);
882 if (ret == -ENOENT) { 882 if (ret == -ENOENT) {
883 /* file or dir now absent - probably retired by netfs */ 883 /* file or dir now absent - probably retired by netfs */
@@ -913,7 +913,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
913 return PTR_ERR(victim); 913 return PTR_ERR(victim);
914 914
915 _debug("victim -> %p %s", 915 _debug("victim -> %p %s",
916 victim, victim->d_inode ? "positive" : "negative"); 916 victim, d_backing_inode(victim) ? "positive" : "negative");
917 917
918 /* okay... the victim is not being used so we can cull it 918 /* okay... the victim is not being used so we can cull it
919 * - start by marking it as stale 919 * - start by marking it as stale
@@ -936,7 +936,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
936 return 0; 936 return 0;
937 937
938error_unlock: 938error_unlock:
939 mutex_unlock(&dir->d_inode->i_mutex); 939 mutex_unlock(&d_inode(dir)->i_mutex);
940error: 940error:
941 dput(victim); 941 dput(victim);
942 if (ret == -ENOENT) { 942 if (ret == -ENOENT) {
@@ -971,7 +971,7 @@ int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir,
971 if (IS_ERR(victim)) 971 if (IS_ERR(victim))
972 return PTR_ERR(victim); 972 return PTR_ERR(victim);
973 973
974 mutex_unlock(&dir->d_inode->i_mutex); 974 mutex_unlock(&d_inode(dir)->i_mutex);
975 dput(victim); 975 dput(victim);
976 //_leave(" = 0"); 976 //_leave(" = 0");
977 return 0; 977 return 0;
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index c6cd8d7a4eef..3cbb0e834694 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -74,12 +74,12 @@ static int cachefiles_read_waiter(wait_queue_t *wait, unsigned mode,
74static int cachefiles_read_reissue(struct cachefiles_object *object, 74static int cachefiles_read_reissue(struct cachefiles_object *object,
75 struct cachefiles_one_read *monitor) 75 struct cachefiles_one_read *monitor)
76{ 76{
77 struct address_space *bmapping = object->backer->d_inode->i_mapping; 77 struct address_space *bmapping = d_backing_inode(object->backer)->i_mapping;
78 struct page *backpage = monitor->back_page, *backpage2; 78 struct page *backpage = monitor->back_page, *backpage2;
79 int ret; 79 int ret;
80 80
81 _enter("{ino=%lx},{%lx,%lx}", 81 _enter("{ino=%lx},{%lx,%lx}",
82 object->backer->d_inode->i_ino, 82 d_backing_inode(object->backer)->i_ino,
83 backpage->index, backpage->flags); 83 backpage->index, backpage->flags);
84 84
85 /* skip if the page was truncated away completely */ 85 /* skip if the page was truncated away completely */
@@ -157,7 +157,7 @@ static void cachefiles_read_copier(struct fscache_operation *_op)
157 object = container_of(op->op.object, 157 object = container_of(op->op.object,
158 struct cachefiles_object, fscache); 158 struct cachefiles_object, fscache);
159 159
160 _enter("{ino=%lu}", object->backer->d_inode->i_ino); 160 _enter("{ino=%lu}", d_backing_inode(object->backer)->i_ino);
161 161
162 max = 8; 162 max = 8;
163 spin_lock_irq(&object->work_lock); 163 spin_lock_irq(&object->work_lock);
@@ -247,7 +247,7 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
247 init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter); 247 init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter);
248 248
249 /* attempt to get hold of the backing page */ 249 /* attempt to get hold of the backing page */
250 bmapping = object->backer->d_inode->i_mapping; 250 bmapping = d_backing_inode(object->backer)->i_mapping;
251 newpage = NULL; 251 newpage = NULL;
252 252
253 for (;;) { 253 for (;;) {
@@ -408,7 +408,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
408 if (!object->backer) 408 if (!object->backer)
409 goto enobufs; 409 goto enobufs;
410 410
411 inode = object->backer->d_inode; 411 inode = d_backing_inode(object->backer);
412 ASSERT(S_ISREG(inode->i_mode)); 412 ASSERT(S_ISREG(inode->i_mode));
413 ASSERT(inode->i_mapping->a_ops->bmap); 413 ASSERT(inode->i_mapping->a_ops->bmap);
414 ASSERT(inode->i_mapping->a_ops->readpages); 414 ASSERT(inode->i_mapping->a_ops->readpages);
@@ -468,7 +468,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
468 struct list_head *list) 468 struct list_head *list)
469{ 469{
470 struct cachefiles_one_read *monitor = NULL; 470 struct cachefiles_one_read *monitor = NULL;
471 struct address_space *bmapping = object->backer->d_inode->i_mapping; 471 struct address_space *bmapping = d_backing_inode(object->backer)->i_mapping;
472 struct page *newpage = NULL, *netpage, *_n, *backpage = NULL; 472 struct page *newpage = NULL, *netpage, *_n, *backpage = NULL;
473 int ret = 0; 473 int ret = 0;
474 474
@@ -705,7 +705,7 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
705 if (cachefiles_has_space(cache, 0, *nr_pages) < 0) 705 if (cachefiles_has_space(cache, 0, *nr_pages) < 0)
706 space = 0; 706 space = 0;
707 707
708 inode = object->backer->d_inode; 708 inode = d_backing_inode(object->backer);
709 ASSERT(S_ISREG(inode->i_mode)); 709 ASSERT(S_ISREG(inode->i_mode));
710 ASSERT(inode->i_mapping->a_ops->bmap); 710 ASSERT(inode->i_mapping->a_ops->bmap);
711 ASSERT(inode->i_mapping->a_ops->readpages); 711 ASSERT(inode->i_mapping->a_ops->readpages);
diff --git a/fs/cachefiles/security.c b/fs/cachefiles/security.c
index 396c18ea2764..31bbc0528b11 100644
--- a/fs/cachefiles/security.c
+++ b/fs/cachefiles/security.c
@@ -55,14 +55,14 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache,
55{ 55{
56 int ret; 56 int ret;
57 57
58 ret = security_inode_mkdir(root->d_inode, root, 0); 58 ret = security_inode_mkdir(d_backing_inode(root), root, 0);
59 if (ret < 0) { 59 if (ret < 0) {
60 pr_err("Security denies permission to make dirs: error %d", 60 pr_err("Security denies permission to make dirs: error %d",
61 ret); 61 ret);
62 return ret; 62 return ret;
63 } 63 }
64 64
65 ret = security_inode_create(root->d_inode, root, 0); 65 ret = security_inode_create(d_backing_inode(root), root, 0);
66 if (ret < 0) 66 if (ret < 0)
67 pr_err("Security denies permission to create files: error %d", 67 pr_err("Security denies permission to create files: error %d",
68 ret); 68 ret);
@@ -95,7 +95,7 @@ int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
95 95
96 /* use the cache root dir's security context as the basis with 96 /* use the cache root dir's security context as the basis with
97 * which create files */ 97 * which create files */
98 ret = set_create_files_as(new, root->d_inode); 98 ret = set_create_files_as(new, d_backing_inode(root));
99 if (ret < 0) { 99 if (ret < 0) {
100 abort_creds(new); 100 abort_creds(new);
101 cachefiles_begin_secure(cache, _saved_cred); 101 cachefiles_begin_secure(cache, _saved_cred);
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index a8a68745e11d..d31c1a72d8a5 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -33,7 +33,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
33 int ret; 33 int ret;
34 34
35 ASSERT(dentry); 35 ASSERT(dentry);
36 ASSERT(dentry->d_inode); 36 ASSERT(d_backing_inode(dentry));
37 37
38 if (!object->fscache.cookie) 38 if (!object->fscache.cookie)
39 strcpy(type, "C3"); 39 strcpy(type, "C3");
@@ -52,7 +52,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
52 52
53 if (ret != -EEXIST) { 53 if (ret != -EEXIST) {
54 pr_err("Can't set xattr on %pd [%lu] (err %d)\n", 54 pr_err("Can't set xattr on %pd [%lu] (err %d)\n",
55 dentry, dentry->d_inode->i_ino, 55 dentry, d_backing_inode(dentry)->i_ino,
56 -ret); 56 -ret);
57 goto error; 57 goto error;
58 } 58 }
@@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
64 goto bad_type_length; 64 goto bad_type_length;
65 65
66 pr_err("Can't read xattr on %pd [%lu] (err %d)\n", 66 pr_err("Can't read xattr on %pd [%lu] (err %d)\n",
67 dentry, dentry->d_inode->i_ino, 67 dentry, d_backing_inode(dentry)->i_ino,
68 -ret); 68 -ret);
69 goto error; 69 goto error;
70 } 70 }
@@ -84,14 +84,14 @@ error:
84 84
85bad_type_length: 85bad_type_length:
86 pr_err("Cache object %lu type xattr length incorrect\n", 86 pr_err("Cache object %lu type xattr length incorrect\n",
87 dentry->d_inode->i_ino); 87 d_backing_inode(dentry)->i_ino);
88 ret = -EIO; 88 ret = -EIO;
89 goto error; 89 goto error;
90 90
91bad_type: 91bad_type:
92 xtype[2] = 0; 92 xtype[2] = 0;
93 pr_err("Cache object %pd [%lu] type %s not %s\n", 93 pr_err("Cache object %pd [%lu] type %s not %s\n",
94 dentry, dentry->d_inode->i_ino, 94 dentry, d_backing_inode(dentry)->i_ino,
95 xtype, type); 95 xtype, type);
96 ret = -EIO; 96 ret = -EIO;
97 goto error; 97 goto error;
@@ -165,7 +165,7 @@ int cachefiles_check_auxdata(struct cachefiles_object *object)
165 int ret; 165 int ret;
166 166
167 ASSERT(dentry); 167 ASSERT(dentry);
168 ASSERT(dentry->d_inode); 168 ASSERT(d_backing_inode(dentry));
169 ASSERT(object->fscache.cookie->def->check_aux); 169 ASSERT(object->fscache.cookie->def->check_aux);
170 170
171 auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, GFP_KERNEL); 171 auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, GFP_KERNEL);
@@ -204,7 +204,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object,
204 _enter("%p,#%d", object, auxdata->len); 204 _enter("%p,#%d", object, auxdata->len);
205 205
206 ASSERT(dentry); 206 ASSERT(dentry);
207 ASSERT(dentry->d_inode); 207 ASSERT(d_backing_inode(dentry));
208 208
209 auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, cachefiles_gfp); 209 auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, cachefiles_gfp);
210 if (!auxbuf) { 210 if (!auxbuf) {
@@ -225,7 +225,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object,
225 225
226 cachefiles_io_error_obj(object, 226 cachefiles_io_error_obj(object,
227 "Can't read xattr on %lu (err %d)", 227 "Can't read xattr on %lu (err %d)",
228 dentry->d_inode->i_ino, -ret); 228 d_backing_inode(dentry)->i_ino, -ret);
229 goto error; 229 goto error;
230 } 230 }
231 231
@@ -276,7 +276,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object,
276 cachefiles_io_error_obj(object, 276 cachefiles_io_error_obj(object,
277 "Can't update xattr on %lu" 277 "Can't update xattr on %lu"
278 " (error %d)", 278 " (error %d)",
279 dentry->d_inode->i_ino, -ret); 279 d_backing_inode(dentry)->i_ino, -ret);
280 goto error; 280 goto error;
281 } 281 }
282 } 282 }
@@ -291,7 +291,7 @@ error:
291 291
292bad_type_length: 292bad_type_length:
293 pr_err("Cache object %lu xattr length incorrect\n", 293 pr_err("Cache object %lu xattr length incorrect\n",
294 dentry->d_inode->i_ino); 294 d_backing_inode(dentry)->i_ino);
295 ret = -EIO; 295 ret = -EIO;
296 goto error; 296 goto error;
297 297
@@ -316,7 +316,7 @@ int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
316 cachefiles_io_error(cache, 316 cachefiles_io_error(cache,
317 "Can't remove xattr from %lu" 317 "Can't remove xattr from %lu"
318 " (error %d)", 318 " (error %d)",
319 dentry->d_inode->i_ino, -ret); 319 d_backing_inode(dentry)->i_ino, -ret);
320 } 320 }
321 321
322 _leave(" = %d", ret); 322 _leave(" = %d", ret);
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 11631c4c7d14..be5ea6af8366 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3422,7 +3422,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode,
3422int ceph_encode_dentry_release(void **p, struct dentry *dentry, 3422int ceph_encode_dentry_release(void **p, struct dentry *dentry,
3423 int mds, int drop, int unless) 3423 int mds, int drop, int unless)
3424{ 3424{
3425 struct inode *dir = dentry->d_parent->d_inode; 3425 struct inode *dir = d_inode(dentry->d_parent);
3426 struct ceph_mds_request_release *rel = *p; 3426 struct ceph_mds_request_release *rel = *p;
3427 struct ceph_dentry_info *di = ceph_dentry(dentry); 3427 struct ceph_dentry_info *di = ceph_dentry(dentry);
3428 int force = 0; 3428 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 e729b79812b4..4248307fea90 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;
@@ -543,7 +543,7 @@ int ceph_handle_snapdir(struct ceph_mds_request *req,
543 struct dentry *dentry, int err) 543 struct dentry *dentry, int err)
544{ 544{
545 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); 545 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
546 struct inode *parent = dentry->d_parent->d_inode; /* we hold i_mutex */ 546 struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */
547 547
548 /* .snap dir? */ 548 /* .snap dir? */
549 if (err == -ENOENT && 549 if (err == -ENOENT &&
@@ -579,8 +579,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
579 err = 0; 579 err = 0;
580 if (!req->r_reply_info.head->is_dentry) { 580 if (!req->r_reply_info.head->is_dentry) {
581 dout("ENOENT and no trace, dentry %p inode %p\n", 581 dout("ENOENT and no trace, dentry %p inode %p\n",
582 dentry, dentry->d_inode); 582 dentry, d_inode(dentry));
583 if (dentry->d_inode) { 583 if (d_really_is_positive(dentry)) {
584 d_drop(dentry); 584 d_drop(dentry);
585 err = -ENOENT; 585 err = -ENOENT;
586 } else { 586 } else {
@@ -627,7 +627,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
627 return ERR_PTR(err); 627 return ERR_PTR(err);
628 628
629 /* can we conclude ENOENT locally? */ 629 /* can we conclude ENOENT locally? */
630 if (dentry->d_inode == NULL) { 630 if (d_really_is_negative(dentry)) {
631 struct ceph_inode_info *ci = ceph_inode(dir); 631 struct ceph_inode_info *ci = ceph_inode(dir);
632 struct ceph_dentry_info *di = ceph_dentry(dentry); 632 struct ceph_dentry_info *di = ceph_dentry(dentry);
633 633
@@ -734,7 +734,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
734 ceph_mdsc_put_request(req); 734 ceph_mdsc_put_request(req);
735out: 735out:
736 if (!err) 736 if (!err)
737 ceph_init_inode_acls(dentry->d_inode, &acls); 737 ceph_init_inode_acls(d_inode(dentry), &acls);
738 else 738 else
739 d_drop(dentry); 739 d_drop(dentry);
740 ceph_release_acls_info(&acls); 740 ceph_release_acls_info(&acls);
@@ -835,7 +835,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
835 ceph_mdsc_put_request(req); 835 ceph_mdsc_put_request(req);
836out: 836out:
837 if (!err) 837 if (!err)
838 ceph_init_inode_acls(dentry->d_inode, &acls); 838 ceph_init_inode_acls(d_inode(dentry), &acls);
839 else 839 else
840 d_drop(dentry); 840 d_drop(dentry);
841 ceph_release_acls_info(&acls); 841 ceph_release_acls_info(&acls);
@@ -872,8 +872,8 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
872 if (err) { 872 if (err) {
873 d_drop(dentry); 873 d_drop(dentry);
874 } else if (!req->r_reply_info.head->is_dentry) { 874 } else if (!req->r_reply_info.head->is_dentry) {
875 ihold(old_dentry->d_inode); 875 ihold(d_inode(old_dentry));
876 d_instantiate(dentry, old_dentry->d_inode); 876 d_instantiate(dentry, d_inode(old_dentry));
877 } 877 }
878 ceph_mdsc_put_request(req); 878 ceph_mdsc_put_request(req);
879 return err; 879 return err;
@@ -906,7 +906,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
906{ 906{
907 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 907 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
908 struct ceph_mds_client *mdsc = fsc->mdsc; 908 struct ceph_mds_client *mdsc = fsc->mdsc;
909 struct inode *inode = dentry->d_inode; 909 struct inode *inode = d_inode(dentry);
910 struct ceph_mds_request *req; 910 struct ceph_mds_request *req;
911 int err = -EROFS; 911 int err = -EROFS;
912 int op; 912 int op;
@@ -975,8 +975,8 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
975 req->r_dentry_unless = CEPH_CAP_FILE_EXCL; 975 req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
976 /* release LINK_RDCACHE on source inode (mds will lock it) */ 976 /* release LINK_RDCACHE on source inode (mds will lock it) */
977 req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; 977 req->r_old_inode_drop = CEPH_CAP_LINK_SHARED;
978 if (new_dentry->d_inode) 978 if (d_really_is_positive(new_dentry))
979 req->r_inode_drop = drop_caps_for_unlink(new_dentry->d_inode); 979 req->r_inode_drop = drop_caps_for_unlink(d_inode(new_dentry));
980 err = ceph_mdsc_do_request(mdsc, old_dir, req); 980 err = ceph_mdsc_do_request(mdsc, old_dir, req);
981 if (!err && !req->r_reply_info.head->is_dentry) { 981 if (!err && !req->r_reply_info.head->is_dentry) {
982 /* 982 /*
@@ -1042,7 +1042,7 @@ static int dentry_lease_is_valid(struct dentry *dentry)
1042 if (di->lease_renew_after && 1042 if (di->lease_renew_after &&
1043 time_after(jiffies, di->lease_renew_after)) { 1043 time_after(jiffies, di->lease_renew_after)) {
1044 /* we should renew */ 1044 /* we should renew */
1045 dir = dentry->d_parent->d_inode; 1045 dir = d_inode(dentry->d_parent);
1046 session = ceph_get_mds_session(s); 1046 session = ceph_get_mds_session(s);
1047 seq = di->lease_seq; 1047 seq = di->lease_seq;
1048 di->lease_renew_after = 0; 1048 di->lease_renew_after = 0;
@@ -1092,22 +1092,22 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
1092 return -ECHILD; 1092 return -ECHILD;
1093 1093
1094 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, 1094 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
1095 dentry, dentry->d_inode, ceph_dentry(dentry)->offset); 1095 dentry, d_inode(dentry), ceph_dentry(dentry)->offset);
1096 1096
1097 dir = ceph_get_dentry_parent_inode(dentry); 1097 dir = ceph_get_dentry_parent_inode(dentry);
1098 1098
1099 /* always trust cached snapped dentries, snapdir dentry */ 1099 /* always trust cached snapped dentries, snapdir dentry */
1100 if (ceph_snap(dir) != CEPH_NOSNAP) { 1100 if (ceph_snap(dir) != CEPH_NOSNAP) {
1101 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, 1101 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
1102 dentry, dentry->d_inode); 1102 dentry, d_inode(dentry));
1103 valid = 1; 1103 valid = 1;
1104 } else if (dentry->d_inode && 1104 } else if (d_really_is_positive(dentry) &&
1105 ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) { 1105 ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) {
1106 valid = 1; 1106 valid = 1;
1107 } else if (dentry_lease_is_valid(dentry) || 1107 } else if (dentry_lease_is_valid(dentry) ||
1108 dir_lease_is_valid(dir, dentry)) { 1108 dir_lease_is_valid(dir, dentry)) {
1109 if (dentry->d_inode) 1109 if (d_really_is_positive(dentry))
1110 valid = ceph_is_any_caps(dentry->d_inode); 1110 valid = ceph_is_any_caps(d_inode(dentry));
1111 else 1111 else
1112 valid = 1; 1112 valid = 1;
1113 } 1113 }
@@ -1169,7 +1169,7 @@ static void ceph_d_prune(struct dentry *dentry)
1169 * we hold d_lock, so d_parent is stable, and d_fsdata is never 1169 * we hold d_lock, so d_parent is stable, and d_fsdata is never
1170 * cleared until d_release 1170 * cleared until d_release
1171 */ 1171 */
1172 ceph_dir_clear_complete(dentry->d_parent->d_inode); 1172 ceph_dir_clear_complete(d_inode(dentry->d_parent));
1173} 1173}
1174 1174
1175/* 1175/*
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 0a2eb32ffe43..84f37f34f9aa 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;
@@ -1732,7 +1732,7 @@ retry:
1732 seq = read_seqbegin(&rename_lock); 1732 seq = read_seqbegin(&rename_lock);
1733 rcu_read_lock(); 1733 rcu_read_lock();
1734 for (temp = dentry; !IS_ROOT(temp);) { 1734 for (temp = dentry; !IS_ROOT(temp);) {
1735 struct inode *inode = temp->d_inode; 1735 struct inode *inode = d_inode(temp);
1736 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) 1736 if (inode && ceph_snap(inode) == CEPH_SNAPDIR)
1737 len++; /* slash only */ 1737 len++; /* slash only */
1738 else if (stop_on_nosnap && inode && 1738 else if (stop_on_nosnap && inode &&
@@ -1756,7 +1756,7 @@ retry:
1756 struct inode *inode; 1756 struct inode *inode;
1757 1757
1758 spin_lock(&temp->d_lock); 1758 spin_lock(&temp->d_lock);
1759 inode = temp->d_inode; 1759 inode = d_inode(temp);
1760 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 1760 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
1761 dout("build_path path+%d: %p SNAPDIR\n", 1761 dout("build_path path+%d: %p SNAPDIR\n",
1762 pos, temp); 1762 pos, temp);
@@ -1790,7 +1790,7 @@ retry:
1790 goto retry; 1790 goto retry;
1791 } 1791 }
1792 1792
1793 *base = ceph_ino(temp->d_inode); 1793 *base = ceph_ino(d_inode(temp));
1794 *plen = len; 1794 *plen = len;
1795 dout("build_path on %p %d built %llx '%.*s'\n", 1795 dout("build_path on %p %d built %llx '%.*s'\n",
1796 dentry, d_count(dentry), *base, len, path); 1796 dentry, d_count(dentry), *base, len, path);
@@ -1803,8 +1803,8 @@ static int build_dentry_path(struct dentry *dentry,
1803{ 1803{
1804 char *path; 1804 char *path;
1805 1805
1806 if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) { 1806 if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) {
1807 *pino = ceph_ino(dentry->d_parent->d_inode); 1807 *pino = ceph_ino(d_inode(dentry->d_parent));
1808 *ppath = dentry->d_name.name; 1808 *ppath = dentry->d_name.name;
1809 *ppathlen = dentry->d_name.len; 1809 *ppathlen = dentry->d_name.len;
1810 return 0; 1810 return 0;
@@ -1945,7 +1945,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1945 releases = 0; 1945 releases = 0;
1946 if (req->r_inode_drop) 1946 if (req->r_inode_drop)
1947 releases += ceph_encode_inode_release(&p, 1947 releases += ceph_encode_inode_release(&p,
1948 req->r_inode ? req->r_inode : req->r_dentry->d_inode, 1948 req->r_inode ? req->r_inode : d_inode(req->r_dentry),
1949 mds, req->r_inode_drop, req->r_inode_unless, 0); 1949 mds, req->r_inode_drop, req->r_inode_unless, 0);
1950 if (req->r_dentry_drop) 1950 if (req->r_dentry_drop)
1951 releases += ceph_encode_dentry_release(&p, req->r_dentry, 1951 releases += ceph_encode_dentry_release(&p, req->r_dentry,
@@ -1955,7 +1955,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1955 mds, req->r_old_dentry_drop, req->r_old_dentry_unless); 1955 mds, req->r_old_dentry_drop, req->r_old_dentry_unless);
1956 if (req->r_old_inode_drop) 1956 if (req->r_old_inode_drop)
1957 releases += ceph_encode_inode_release(&p, 1957 releases += ceph_encode_inode_release(&p,
1958 req->r_old_dentry->d_inode, 1958 d_inode(req->r_old_dentry),
1959 mds, req->r_old_inode_drop, req->r_old_inode_unless, 0); 1959 mds, req->r_old_inode_drop, req->r_old_inode_unless, 0);
1960 1960
1961 if (drop_cap_releases) { 1961 if (drop_cap_releases) {
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index e463ebd69a9c..4e9905374078 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;
@@ -972,7 +972,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
972 if (IS_ERR(res)) 972 if (IS_ERR(res))
973 goto out_splat; 973 goto out_splat;
974 dout("root %p inode %p ino %llx.%llx\n", res, 974 dout("root %p inode %p ino %llx.%llx\n", res,
975 res->d_inode, ceph_vinop(res->d_inode)); 975 d_inode(res), ceph_vinop(d_inode(res)));
976 return res; 976 return res;
977 977
978out_splat: 978out_splat:
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 5c4c9c256931..cd7ffad4041d 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;
@@ -908,7 +908,7 @@ out:
908int __ceph_setxattr(struct dentry *dentry, const char *name, 908int __ceph_setxattr(struct dentry *dentry, const char *name,
909 const void *value, size_t size, int flags) 909 const void *value, size_t size, int flags)
910{ 910{
911 struct inode *inode = dentry->d_inode; 911 struct inode *inode = d_inode(dentry);
912 struct ceph_vxattr *vxattr; 912 struct ceph_vxattr *vxattr;
913 struct ceph_inode_info *ci = ceph_inode(inode); 913 struct ceph_inode_info *ci = ceph_inode(inode);
914 int issued; 914 int issued;
@@ -1002,7 +1002,7 @@ out:
1002int ceph_setxattr(struct dentry *dentry, const char *name, 1002int ceph_setxattr(struct dentry *dentry, const char *name,
1003 const void *value, size_t size, int flags) 1003 const void *value, size_t size, int flags)
1004{ 1004{
1005 if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) 1005 if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
1006 return -EROFS; 1006 return -EROFS;
1007 1007
1008 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 1008 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
@@ -1018,7 +1018,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
1018{ 1018{
1019 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); 1019 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
1020 struct ceph_mds_client *mdsc = fsc->mdsc; 1020 struct ceph_mds_client *mdsc = fsc->mdsc;
1021 struct inode *inode = dentry->d_inode; 1021 struct inode *inode = d_inode(dentry);
1022 struct ceph_mds_request *req; 1022 struct ceph_mds_request *req;
1023 int err; 1023 int err;
1024 1024
@@ -1041,7 +1041,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
1041 1041
1042int __ceph_removexattr(struct dentry *dentry, const char *name) 1042int __ceph_removexattr(struct dentry *dentry, const char *name)
1043{ 1043{
1044 struct inode *inode = dentry->d_inode; 1044 struct inode *inode = d_inode(dentry);
1045 struct ceph_vxattr *vxattr; 1045 struct ceph_vxattr *vxattr;
1046 struct ceph_inode_info *ci = ceph_inode(inode); 1046 struct ceph_inode_info *ci = ceph_inode(inode);
1047 int issued; 1047 int issued;
@@ -1107,7 +1107,7 @@ out:
1107 1107
1108int ceph_removexattr(struct dentry *dentry, const char *name) 1108int ceph_removexattr(struct dentry *dentry, const char *name)
1109{ 1109{
1110 if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) 1110 if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
1111 return -EROFS; 1111 return -EROFS;
1112 1112
1113 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 1113 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/dax.c b/fs/dax.c
index 0bb0aecb556c..6f65f00e58ec 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -209,7 +209,7 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
209 } 209 }
210 210
211 /* Protects against truncate */ 211 /* Protects against truncate */
212 atomic_inc(&inode->i_dio_count); 212 inode_dio_begin(inode);
213 213
214 retval = dax_io(inode, iter, pos, end, get_block, &bh); 214 retval = dax_io(inode, iter, pos, end, get_block, &bh);
215 215
@@ -219,7 +219,7 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
219 if ((retval > 0) && end_io) 219 if ((retval > 0) && end_io)
220 end_io(iocb, pos, retval, bh.b_private); 220 end_io(iocb, pos, retval, bh.b_private);
221 221
222 inode_dio_done(inode); 222 inode_dio_end(inode);
223 out: 223 out:
224 return retval; 224 return retval;
225} 225}
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 c9ee0dfe90b5..c1e7ffb0dab6 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 = {
@@ -270,20 +270,20 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
270 if (!parent) 270 if (!parent)
271 parent = debugfs_mount->mnt_root; 271 parent = debugfs_mount->mnt_root;
272 272
273 mutex_lock(&parent->d_inode->i_mutex); 273 mutex_lock(&d_inode(parent)->i_mutex);
274 dentry = lookup_one_len(name, parent, strlen(name)); 274 dentry = lookup_one_len(name, parent, strlen(name));
275 if (!IS_ERR(dentry) && dentry->d_inode) { 275 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
276 dput(dentry); 276 dput(dentry);
277 dentry = ERR_PTR(-EEXIST); 277 dentry = ERR_PTR(-EEXIST);
278 } 278 }
279 if (IS_ERR(dentry)) 279 if (IS_ERR(dentry))
280 mutex_unlock(&parent->d_inode->i_mutex); 280 mutex_unlock(&d_inode(parent)->i_mutex);
281 return dentry; 281 return dentry;
282} 282}
283 283
284static struct dentry *failed_creating(struct dentry *dentry) 284static struct dentry *failed_creating(struct dentry *dentry)
285{ 285{
286 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); 286 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex);
287 dput(dentry); 287 dput(dentry);
288 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 288 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
289 return NULL; 289 return NULL;
@@ -291,7 +291,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
291 291
292static struct dentry *end_creating(struct dentry *dentry) 292static struct dentry *end_creating(struct dentry *dentry)
293{ 293{
294 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); 294 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex);
295 return dentry; 295 return dentry;
296} 296}
297 297
@@ -344,7 +344,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
344 inode->i_fop = fops ? fops : &debugfs_file_operations; 344 inode->i_fop = fops ? fops : &debugfs_file_operations;
345 inode->i_private = data; 345 inode->i_private = data;
346 d_instantiate(dentry, inode); 346 d_instantiate(dentry, inode);
347 fsnotify_create(dentry->d_parent->d_inode, dentry); 347 fsnotify_create(d_inode(dentry->d_parent), dentry);
348 return end_creating(dentry); 348 return end_creating(dentry);
349} 349}
350EXPORT_SYMBOL_GPL(debugfs_create_file); 350EXPORT_SYMBOL_GPL(debugfs_create_file);
@@ -384,7 +384,7 @@ struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
384 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); 384 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
385 385
386 if (de) 386 if (de)
387 de->d_inode->i_size = file_size; 387 d_inode(de)->i_size = file_size;
388 return de; 388 return de;
389} 389}
390EXPORT_SYMBOL_GPL(debugfs_create_file_size); 390EXPORT_SYMBOL_GPL(debugfs_create_file_size);
@@ -426,8 +426,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
426 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 426 /* directory inodes start off with i_nlink == 2 (for "." entry) */
427 inc_nlink(inode); 427 inc_nlink(inode);
428 d_instantiate(dentry, inode); 428 d_instantiate(dentry, inode);
429 inc_nlink(dentry->d_parent->d_inode); 429 inc_nlink(d_inode(dentry->d_parent));
430 fsnotify_mkdir(dentry->d_parent->d_inode, dentry); 430 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
431 return end_creating(dentry); 431 return end_creating(dentry);
432} 432}
433EXPORT_SYMBOL_GPL(debugfs_create_dir); 433EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -525,9 +525,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
525 if (debugfs_positive(dentry)) { 525 if (debugfs_positive(dentry)) {
526 dget(dentry); 526 dget(dentry);
527 if (d_is_dir(dentry)) 527 if (d_is_dir(dentry))
528 ret = simple_rmdir(parent->d_inode, dentry); 528 ret = simple_rmdir(d_inode(parent), dentry);
529 else 529 else
530 simple_unlink(parent->d_inode, dentry); 530 simple_unlink(d_inode(parent), dentry);
531 if (!ret) 531 if (!ret)
532 d_delete(dentry); 532 d_delete(dentry);
533 dput(dentry); 533 dput(dentry);
@@ -557,12 +557,12 @@ void debugfs_remove(struct dentry *dentry)
557 return; 557 return;
558 558
559 parent = dentry->d_parent; 559 parent = dentry->d_parent;
560 if (!parent || !parent->d_inode) 560 if (!parent || d_really_is_negative(parent))
561 return; 561 return;
562 562
563 mutex_lock(&parent->d_inode->i_mutex); 563 mutex_lock(&d_inode(parent)->i_mutex);
564 ret = __debugfs_remove(dentry, parent); 564 ret = __debugfs_remove(dentry, parent);
565 mutex_unlock(&parent->d_inode->i_mutex); 565 mutex_unlock(&d_inode(parent)->i_mutex);
566 if (!ret) 566 if (!ret)
567 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 567 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
568} 568}
@@ -588,12 +588,12 @@ void debugfs_remove_recursive(struct dentry *dentry)
588 return; 588 return;
589 589
590 parent = dentry->d_parent; 590 parent = dentry->d_parent;
591 if (!parent || !parent->d_inode) 591 if (!parent || d_really_is_negative(parent))
592 return; 592 return;
593 593
594 parent = dentry; 594 parent = dentry;
595 down: 595 down:
596 mutex_lock(&parent->d_inode->i_mutex); 596 mutex_lock(&d_inode(parent)->i_mutex);
597 loop: 597 loop:
598 /* 598 /*
599 * The parent->d_subdirs is protected by the d_lock. Outside that 599 * The parent->d_subdirs is protected by the d_lock. Outside that
@@ -608,7 +608,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
608 /* perhaps simple_empty(child) makes more sense */ 608 /* perhaps simple_empty(child) makes more sense */
609 if (!list_empty(&child->d_subdirs)) { 609 if (!list_empty(&child->d_subdirs)) {
610 spin_unlock(&parent->d_lock); 610 spin_unlock(&parent->d_lock);
611 mutex_unlock(&parent->d_inode->i_mutex); 611 mutex_unlock(&d_inode(parent)->i_mutex);
612 parent = child; 612 parent = child;
613 goto down; 613 goto down;
614 } 614 }
@@ -629,10 +629,10 @@ void debugfs_remove_recursive(struct dentry *dentry)
629 } 629 }
630 spin_unlock(&parent->d_lock); 630 spin_unlock(&parent->d_lock);
631 631
632 mutex_unlock(&parent->d_inode->i_mutex); 632 mutex_unlock(&d_inode(parent)->i_mutex);
633 child = parent; 633 child = parent;
634 parent = parent->d_parent; 634 parent = parent->d_parent;
635 mutex_lock(&parent->d_inode->i_mutex); 635 mutex_lock(&d_inode(parent)->i_mutex);
636 636
637 if (child != dentry) 637 if (child != dentry)
638 /* go up */ 638 /* go up */
@@ -640,7 +640,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
640 640
641 if (!__debugfs_remove(child, parent)) 641 if (!__debugfs_remove(child, parent))
642 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 642 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
643 mutex_unlock(&parent->d_inode->i_mutex); 643 mutex_unlock(&d_inode(parent)->i_mutex);
644} 644}
645EXPORT_SYMBOL_GPL(debugfs_remove_recursive); 645EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
646 646
@@ -672,27 +672,27 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
672 672
673 trap = lock_rename(new_dir, old_dir); 673 trap = lock_rename(new_dir, old_dir);
674 /* Source or destination directories don't exist? */ 674 /* Source or destination directories don't exist? */
675 if (!old_dir->d_inode || !new_dir->d_inode) 675 if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir))
676 goto exit; 676 goto exit;
677 /* Source does not exist, cyclic rename, or mountpoint? */ 677 /* Source does not exist, cyclic rename, or mountpoint? */
678 if (!old_dentry->d_inode || old_dentry == trap || 678 if (d_really_is_negative(old_dentry) || old_dentry == trap ||
679 d_mountpoint(old_dentry)) 679 d_mountpoint(old_dentry))
680 goto exit; 680 goto exit;
681 dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); 681 dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
682 /* Lookup failed, cyclic rename or target exists? */ 682 /* Lookup failed, cyclic rename or target exists? */
683 if (IS_ERR(dentry) || dentry == trap || dentry->d_inode) 683 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry))
684 goto exit; 684 goto exit;
685 685
686 old_name = fsnotify_oldname_init(old_dentry->d_name.name); 686 old_name = fsnotify_oldname_init(old_dentry->d_name.name);
687 687
688 error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, 688 error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir),
689 dentry); 689 dentry);
690 if (error) { 690 if (error) {
691 fsnotify_oldname_free(old_name); 691 fsnotify_oldname_free(old_name);
692 goto exit; 692 goto exit;
693 } 693 }
694 d_move(old_dentry, dentry); 694 d_move(old_dentry, dentry);
695 fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, 695 fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name,
696 d_is_dir(old_dentry), 696 d_is_dir(old_dentry),
697 NULL, old_dentry); 697 NULL, old_dentry);
698 fsnotify_oldname_free(old_name); 698 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/direct-io.c b/fs/direct-io.c
index c3b560b24a46..745d2342651a 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -253,7 +253,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret,
253 if (dio->end_io && dio->result) 253 if (dio->end_io && dio->result)
254 dio->end_io(dio->iocb, offset, transferred, dio->private); 254 dio->end_io(dio->iocb, offset, transferred, dio->private);
255 255
256 inode_dio_done(dio->inode); 256 if (!(dio->flags & DIO_SKIP_DIO_COUNT))
257 inode_dio_end(dio->inode);
258
257 if (is_async) { 259 if (is_async) {
258 if (dio->rw & WRITE) { 260 if (dio->rw & WRITE) {
259 int err; 261 int err;
@@ -1195,7 +1197,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
1195 /* 1197 /*
1196 * Will be decremented at I/O completion time. 1198 * Will be decremented at I/O completion time.
1197 */ 1199 */
1198 atomic_inc(&inode->i_dio_count); 1200 if (!(dio->flags & DIO_SKIP_DIO_COUNT))
1201 inode_dio_begin(inode);
1199 1202
1200 retval = 0; 1203 retval = 0;
1201 sdio.blkbits = blkbits; 1204 sdio.blkbits = blkbits;
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 5d9213963fae..f460ae36d5b7 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1544,7 +1544,7 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
1544 1544
1545int ext2_setattr(struct dentry *dentry, struct iattr *iattr) 1545int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
1546{ 1546{
1547 struct inode *inode = dentry->d_inode; 1547 struct inode *inode = d_inode(dentry);
1548 int error; 1548 int error;
1549 1549
1550 error = inode_change_ok(inode, iattr); 1550 error = inode_change_ok(inode, iattr);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index ce422931f411..3e074a9ccbe6 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/*
@@ -208,7 +208,7 @@ out_fail:
208static int ext2_link (struct dentry * old_dentry, struct inode * dir, 208static int ext2_link (struct dentry * old_dentry, struct inode * dir,
209 struct dentry *dentry) 209 struct dentry *dentry)
210{ 210{
211 struct inode *inode = old_dentry->d_inode; 211 struct inode *inode = d_inode(old_dentry);
212 int err; 212 int err;
213 213
214 dquot_initialize(dir); 214 dquot_initialize(dir);
@@ -275,7 +275,7 @@ out_dir:
275 275
276static int ext2_unlink(struct inode * dir, struct dentry *dentry) 276static int ext2_unlink(struct inode * dir, struct dentry *dentry)
277{ 277{
278 struct inode * inode = dentry->d_inode; 278 struct inode * inode = d_inode(dentry);
279 struct ext2_dir_entry_2 * de; 279 struct ext2_dir_entry_2 * de;
280 struct page * page; 280 struct page * page;
281 int err = -ENOENT; 281 int err = -ENOENT;
@@ -299,7 +299,7 @@ out:
299 299
300static int ext2_rmdir (struct inode * dir, struct dentry *dentry) 300static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
301{ 301{
302 struct inode * inode = dentry->d_inode; 302 struct inode * inode = d_inode(dentry);
303 int err = -ENOTEMPTY; 303 int err = -ENOTEMPTY;
304 304
305 if (ext2_empty_dir(inode)) { 305 if (ext2_empty_dir(inode)) {
@@ -316,8 +316,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
316static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, 316static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
317 struct inode * new_dir, struct dentry * new_dentry ) 317 struct inode * new_dir, struct dentry * new_dentry )
318{ 318{
319 struct inode * old_inode = old_dentry->d_inode; 319 struct inode * old_inode = d_inode(old_dentry);
320 struct inode * new_inode = new_dentry->d_inode; 320 struct inode * new_inode = d_inode(new_dentry);
321 struct page * dir_page = NULL; 321 struct page * dir_page = NULL;
322 struct ext2_dir_entry_2 * dir_de = NULL; 322 struct ext2_dir_entry_2 * dir_de = NULL;
323 struct page * old_page; 323 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 f037b4b27300..a9312f0a54e5 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 24215dc09a18..7cf36501ccf4 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 e9d632e9aa4b..8850254136ae 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -55,7 +55,7 @@ static int ext4_sync_parent(struct inode *inode)
55 dentry = d_find_any_alias(inode); 55 dentry = d_find_any_alias(inode);
56 if (!dentry) 56 if (!dentry)
57 break; 57 break;
58 next = igrab(dentry->d_parent->d_inode); 58 next = igrab(d_inode(dentry->d_parent));
59 dput(dentry); 59 dput(dentry);
60 if (!next) 60 if (!next)
61 break; 61 break;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 2cf18a2d5c72..1eaa6cb96cd0 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -443,7 +443,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
443 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); 443 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
444 444
445 if (S_ISDIR(mode) && 445 if (S_ISDIR(mode) &&
446 ((parent == sb->s_root->d_inode) || 446 ((parent == d_inode(sb->s_root)) ||
447 (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { 447 (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) {
448 int best_ndir = inodes_per_group; 448 int best_ndir = inodes_per_group;
449 int ret = -1; 449 int ret = -1;
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 3580629e42d3..958824019509 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -682,11 +682,11 @@ retry:
682 * via ext4_inode_block_unlocked_dio(). Check inode's state 682 * via ext4_inode_block_unlocked_dio(). Check inode's state
683 * while holding extra i_dio_count ref. 683 * while holding extra i_dio_count ref.
684 */ 684 */
685 atomic_inc(&inode->i_dio_count); 685 inode_dio_begin(inode);
686 smp_mb(); 686 smp_mb();
687 if (unlikely(ext4_test_inode_state(inode, 687 if (unlikely(ext4_test_inode_state(inode,
688 EXT4_STATE_DIOREAD_LOCK))) { 688 EXT4_STATE_DIOREAD_LOCK))) {
689 inode_dio_done(inode); 689 inode_dio_end(inode);
690 goto locked; 690 goto locked;
691 } 691 }
692 if (IS_DAX(inode)) 692 if (IS_DAX(inode))
@@ -697,7 +697,7 @@ retry:
697 inode->i_sb->s_bdev, iter, 697 inode->i_sb->s_bdev, iter,
698 offset, ext4_get_block, NULL, 698 offset, ext4_get_block, NULL,
699 NULL, 0); 699 NULL, 0);
700 inode_dio_done(inode); 700 inode_dio_end(inode);
701 } else { 701 } else {
702locked: 702locked:
703 if (IS_DAX(inode)) 703 if (IS_DAX(inode))
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index feb2cafbeace..095c7a258d97 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1000,7 +1000,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
1000 struct ext4_iloc *iloc, 1000 struct ext4_iloc *iloc,
1001 void *inline_start, int inline_size) 1001 void *inline_start, int inline_size)
1002{ 1002{
1003 struct inode *dir = dentry->d_parent->d_inode; 1003 struct inode *dir = d_inode(dentry->d_parent);
1004 const char *name = dentry->d_name.name; 1004 const char *name = dentry->d_name.name;
1005 int namelen = dentry->d_name.len; 1005 int namelen = dentry->d_name.len;
1006 int err; 1006 int err;
@@ -1254,7 +1254,7 @@ int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry,
1254 int ret, inline_size; 1254 int ret, inline_size;
1255 void *inline_start; 1255 void *inline_start;
1256 struct ext4_iloc iloc; 1256 struct ext4_iloc iloc;
1257 struct inode *dir = dentry->d_parent->d_inode; 1257 struct inode *dir = d_inode(dentry->d_parent);
1258 1258
1259 ret = ext4_get_inode_loc(dir, &iloc); 1259 ret = ext4_get_inode_loc(dir, &iloc);
1260 if (ret) 1260 if (ret)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 366476e71e10..cbd0654a2675 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3077,7 +3077,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
3077 * overwrite DIO as i_dio_count needs to be incremented under i_mutex. 3077 * overwrite DIO as i_dio_count needs to be incremented under i_mutex.
3078 */ 3078 */
3079 if (iov_iter_rw(iter) == WRITE) 3079 if (iov_iter_rw(iter) == WRITE)
3080 atomic_inc(&inode->i_dio_count); 3080 inode_dio_begin(inode);
3081 3081
3082 /* If we do a overwrite dio, i_mutex locking can be released */ 3082 /* If we do a overwrite dio, i_mutex locking can be released */
3083 overwrite = *((int *)iocb->private); 3083 overwrite = *((int *)iocb->private);
@@ -3182,7 +3182,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
3182 3182
3183retake_lock: 3183retake_lock:
3184 if (iov_iter_rw(iter) == WRITE) 3184 if (iov_iter_rw(iter) == WRITE)
3185 inode_dio_done(inode); 3185 inode_dio_end(inode);
3186 /* take i_mutex locking again if we do a ovewrite dio */ 3186 /* take i_mutex locking again if we do a ovewrite dio */
3187 if (overwrite) { 3187 if (overwrite) {
3188 up_read(&EXT4_I(inode)->i_data_sem); 3188 up_read(&EXT4_I(inode)->i_data_sem);
@@ -4637,7 +4637,7 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
4637 */ 4637 */
4638int ext4_setattr(struct dentry *dentry, struct iattr *attr) 4638int ext4_setattr(struct dentry *dentry, struct iattr *attr)
4639{ 4639{
4640 struct inode *inode = dentry->d_inode; 4640 struct inode *inode = d_inode(dentry);
4641 int error, rc = 0; 4641 int error, rc = 0;
4642 int orphan = 0; 4642 int orphan = 0;
4643 const unsigned int ia_valid = attr->ia_valid; 4643 const unsigned int ia_valid = attr->ia_valid;
@@ -4785,7 +4785,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
4785 struct inode *inode; 4785 struct inode *inode;
4786 unsigned long long delalloc_blocks; 4786 unsigned long long delalloc_blocks;
4787 4787
4788 inode = dentry->d_inode; 4788 inode = d_inode(dentry);
4789 generic_fillattr(inode, stat); 4789 generic_fillattr(inode, stat);
4790 4790
4791 /* 4791 /*
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 ef22cd951c0c..7223b0b4bc38 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1664,7 +1664,7 @@ struct dentry *ext4_get_parent(struct dentry *child)
1664 struct ext4_dir_entry_2 * de; 1664 struct ext4_dir_entry_2 * de;
1665 struct buffer_head *bh; 1665 struct buffer_head *bh;
1666 1666
1667 bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); 1667 bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL);
1668 if (IS_ERR(bh)) 1668 if (IS_ERR(bh))
1669 return (struct dentry *) bh; 1669 return (struct dentry *) bh;
1670 if (!bh) 1670 if (!bh)
@@ -1672,13 +1672,13 @@ struct dentry *ext4_get_parent(struct dentry *child)
1672 ino = le32_to_cpu(de->inode); 1672 ino = le32_to_cpu(de->inode);
1673 brelse(bh); 1673 brelse(bh);
1674 1674
1675 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { 1675 if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) {
1676 EXT4_ERROR_INODE(child->d_inode, 1676 EXT4_ERROR_INODE(d_inode(child),
1677 "bad parent inode number: %u", ino); 1677 "bad parent inode number: %u", ino);
1678 return ERR_PTR(-EIO); 1678 return ERR_PTR(-EIO);
1679 } 1679 }
1680 1680
1681 return d_obtain_alias(ext4_iget_normal(child->d_inode->i_sb, ino)); 1681 return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino));
1682} 1682}
1683 1683
1684/* 1684/*
@@ -1988,7 +1988,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1988 struct inode *inode, struct ext4_dir_entry_2 *de, 1988 struct inode *inode, struct ext4_dir_entry_2 *de,
1989 struct buffer_head *bh) 1989 struct buffer_head *bh)
1990{ 1990{
1991 struct inode *dir = dentry->d_parent->d_inode; 1991 struct inode *dir = d_inode(dentry->d_parent);
1992 const char *name = dentry->d_name.name; 1992 const char *name = dentry->d_name.name;
1993 int namelen = dentry->d_name.len; 1993 int namelen = dentry->d_name.len;
1994 unsigned int blocksize = dir->i_sb->s_blocksize; 1994 unsigned int blocksize = dir->i_sb->s_blocksize;
@@ -2048,7 +2048,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
2048static int make_indexed_dir(handle_t *handle, struct dentry *dentry, 2048static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
2049 struct inode *inode, struct buffer_head *bh) 2049 struct inode *inode, struct buffer_head *bh)
2050{ 2050{
2051 struct inode *dir = dentry->d_parent->d_inode; 2051 struct inode *dir = d_inode(dentry->d_parent);
2052#ifdef CONFIG_EXT4_FS_ENCRYPTION 2052#ifdef CONFIG_EXT4_FS_ENCRYPTION
2053 struct ext4_fname_crypto_ctx *ctx = NULL; 2053 struct ext4_fname_crypto_ctx *ctx = NULL;
2054 int res; 2054 int res;
@@ -2202,7 +2202,7 @@ out_frames:
2202static int ext4_add_entry(handle_t *handle, struct dentry *dentry, 2202static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
2203 struct inode *inode) 2203 struct inode *inode)
2204{ 2204{
2205 struct inode *dir = dentry->d_parent->d_inode; 2205 struct inode *dir = d_inode(dentry->d_parent);
2206 struct buffer_head *bh = NULL; 2206 struct buffer_head *bh = NULL;
2207 struct ext4_dir_entry_2 *de; 2207 struct ext4_dir_entry_2 *de;
2208 struct ext4_dir_entry_tail *t; 2208 struct ext4_dir_entry_tail *t;
@@ -2287,7 +2287,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
2287 struct dx_entry *entries, *at; 2287 struct dx_entry *entries, *at;
2288 struct dx_hash_info hinfo; 2288 struct dx_hash_info hinfo;
2289 struct buffer_head *bh; 2289 struct buffer_head *bh;
2290 struct inode *dir = dentry->d_parent->d_inode; 2290 struct inode *dir = d_inode(dentry->d_parent);
2291 struct super_block *sb = dir->i_sb; 2291 struct super_block *sb = dir->i_sb;
2292 struct ext4_dir_entry_2 *de; 2292 struct ext4_dir_entry_2 *de;
2293 int err; 2293 int err;
@@ -3063,7 +3063,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
3063 /* Initialize quotas before so that eventual writes go in 3063 /* Initialize quotas before so that eventual writes go in
3064 * separate transaction */ 3064 * separate transaction */
3065 dquot_initialize(dir); 3065 dquot_initialize(dir);
3066 dquot_initialize(dentry->d_inode); 3066 dquot_initialize(d_inode(dentry));
3067 3067
3068 retval = -ENOENT; 3068 retval = -ENOENT;
3069 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); 3069 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
@@ -3072,7 +3072,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
3072 if (!bh) 3072 if (!bh)
3073 goto end_rmdir; 3073 goto end_rmdir;
3074 3074
3075 inode = dentry->d_inode; 3075 inode = d_inode(dentry);
3076 3076
3077 retval = -EIO; 3077 retval = -EIO;
3078 if (le32_to_cpu(de->inode) != inode->i_ino) 3078 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -3132,7 +3132,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
3132 /* Initialize quotas before so that eventual writes go 3132 /* Initialize quotas before so that eventual writes go
3133 * in separate transaction */ 3133 * in separate transaction */
3134 dquot_initialize(dir); 3134 dquot_initialize(dir);
3135 dquot_initialize(dentry->d_inode); 3135 dquot_initialize(d_inode(dentry));
3136 3136
3137 retval = -ENOENT; 3137 retval = -ENOENT;
3138 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); 3138 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
@@ -3141,7 +3141,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
3141 if (!bh) 3141 if (!bh)
3142 goto end_unlink; 3142 goto end_unlink;
3143 3143
3144 inode = dentry->d_inode; 3144 inode = d_inode(dentry);
3145 3145
3146 retval = -EIO; 3146 retval = -EIO;
3147 if (le32_to_cpu(de->inode) != inode->i_ino) 3147 if (le32_to_cpu(de->inode) != inode->i_ino)
@@ -3339,7 +3339,7 @@ static int ext4_link(struct dentry *old_dentry,
3339 struct inode *dir, struct dentry *dentry) 3339 struct inode *dir, struct dentry *dentry)
3340{ 3340{
3341 handle_t *handle; 3341 handle_t *handle;
3342 struct inode *inode = old_dentry->d_inode; 3342 struct inode *inode = d_inode(old_dentry);
3343 int err, retries = 0; 3343 int err, retries = 0;
3344 3344
3345 if (inode->i_nlink >= EXT4_LINK_MAX) 3345 if (inode->i_nlink >= EXT4_LINK_MAX)
@@ -3613,12 +3613,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
3613 struct ext4_renament old = { 3613 struct ext4_renament old = {
3614 .dir = old_dir, 3614 .dir = old_dir,
3615 .dentry = old_dentry, 3615 .dentry = old_dentry,
3616 .inode = old_dentry->d_inode, 3616 .inode = d_inode(old_dentry),
3617 }; 3617 };
3618 struct ext4_renament new = { 3618 struct ext4_renament new = {
3619 .dir = new_dir, 3619 .dir = new_dir,
3620 .dentry = new_dentry, 3620 .dentry = new_dentry,
3621 .inode = new_dentry->d_inode, 3621 .inode = d_inode(new_dentry),
3622 }; 3622 };
3623 int force_reread; 3623 int force_reread;
3624 int retval; 3624 int retval;
@@ -3809,12 +3809,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
3809 struct ext4_renament old = { 3809 struct ext4_renament old = {
3810 .dir = old_dir, 3810 .dir = old_dir,
3811 .dentry = old_dentry, 3811 .dentry = old_dentry,
3812 .inode = old_dentry->d_inode, 3812 .inode = d_inode(old_dentry),
3813 }; 3813 };
3814 struct ext4_renament new = { 3814 struct ext4_renament new = {
3815 .dir = new_dir, 3815 .dir = new_dir,
3816 .dentry = new_dentry, 3816 .dentry = new_dentry,
3817 .inode = new_dentry->d_inode, 3817 .inode = d_inode(new_dentry),
3818 }; 3818 };
3819 u8 new_file_type; 3819 u8 new_file_type;
3820 int retval; 3820 int retval;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 821f22dbe825..f06d0589ddba 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1556,7 +1556,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1556 return -1; 1556 return -1;
1557 } 1557 }
1558 1558
1559 journal_inode = path.dentry->d_inode; 1559 journal_inode = d_inode(path.dentry);
1560 if (!S_ISBLK(journal_inode->i_mode)) { 1560 if (!S_ISBLK(journal_inode->i_mode)) {
1561 ext4_msg(sb, KERN_ERR, "error: journal path %s " 1561 ext4_msg(sb, KERN_ERR, "error: journal path %s "
1562 "is not a block device", journal_path); 1562 "is not a block device", journal_path);
@@ -5217,7 +5217,7 @@ static int ext4_write_info(struct super_block *sb, int type)
5217 handle_t *handle; 5217 handle_t *handle;
5218 5218
5219 /* Data block + inode block */ 5219 /* Data block + inode block */
5220 handle = ext4_journal_start(sb->s_root->d_inode, EXT4_HT_QUOTA, 2); 5220 handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2);
5221 if (IS_ERR(handle)) 5221 if (IS_ERR(handle))
5222 return PTR_ERR(handle); 5222 return PTR_ERR(handle);
5223 ret = dquot_commit_info(sb, type); 5223 ret = dquot_commit_info(sb, type);
@@ -5265,7 +5265,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
5265 * all updates to the file when we bypass pagecache... 5265 * all updates to the file when we bypass pagecache...
5266 */ 5266 */
5267 if (EXT4_SB(sb)->s_journal && 5267 if (EXT4_SB(sb)->s_journal &&
5268 ext4_should_journal_data(path->dentry->d_inode)) { 5268 ext4_should_journal_data(d_inode(path->dentry))) {
5269 /* 5269 /*
5270 * We don't need to lock updates but journal_flush() could 5270 * We don't need to lock updates but journal_flush() could
5271 * otherwise be livelocked... 5271 * otherwise be livelocked...
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
index 136ca0e911fd..19f78f20975e 100644
--- a/fs/ext4/symlink.c
+++ b/fs/ext4/symlink.c
@@ -28,7 +28,7 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
28 struct page *cpage = NULL; 28 struct page *cpage = NULL;
29 char *caddr, *paddr = NULL; 29 char *caddr, *paddr = NULL;
30 struct ext4_str cstr, pstr; 30 struct ext4_str cstr, pstr;
31 struct inode *inode = dentry->d_inode; 31 struct inode *inode = d_inode(dentry);
32 struct ext4_fname_crypto_ctx *ctx = NULL; 32 struct ext4_fname_crypto_ctx *ctx = NULL;
33 struct ext4_encrypted_symlink_data *sd; 33 struct ext4_encrypted_symlink_data *sd;
34 loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1); 34 loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1);
@@ -43,8 +43,8 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
43 return ctx; 43 return ctx;
44 44
45 if (ext4_inode_is_fast_symlink(inode)) { 45 if (ext4_inode_is_fast_symlink(inode)) {
46 caddr = (char *) EXT4_I(dentry->d_inode)->i_data; 46 caddr = (char *) EXT4_I(inode)->i_data;
47 max_size = sizeof(EXT4_I(dentry->d_inode)->i_data); 47 max_size = sizeof(EXT4_I(inode)->i_data);
48 } else { 48 } else {
49 cpage = read_mapping_page(inode->i_mapping, 0, NULL); 49 cpage = read_mapping_page(inode->i_mapping, 0, NULL);
50 if (IS_ERR(cpage)) { 50 if (IS_ERR(cpage)) {
@@ -113,7 +113,7 @@ static void ext4_put_link(struct dentry *dentry, struct nameidata *nd,
113 113
114static void *ext4_follow_fast_link(struct dentry *dentry, struct nameidata *nd) 114static void *ext4_follow_fast_link(struct dentry *dentry, struct nameidata *nd)
115{ 115{
116 struct ext4_inode_info *ei = EXT4_I(dentry->d_inode); 116 struct ext4_inode_info *ei = EXT4_I(d_inode(dentry));
117 nd_set_link(nd, (char *) ei->i_data); 117 nd_set_link(nd, (char *) ei->i_data);
118 return NULL; 118 return NULL;
119} 119}
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 759842ff8af0..16e28c08d1e8 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -178,7 +178,7 @@ ext4_xattr_handler(int name_index)
178/* 178/*
179 * Inode operation listxattr() 179 * Inode operation listxattr()
180 * 180 *
181 * dentry->d_inode->i_mutex: don't care 181 * d_inode(dentry)->i_mutex: don't care
182 */ 182 */
183ssize_t 183ssize_t
184ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) 184ext4_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -423,7 +423,7 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
423static int 423static int
424ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) 424ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
425{ 425{
426 struct inode *inode = dentry->d_inode; 426 struct inode *inode = d_inode(dentry);
427 struct buffer_head *bh = NULL; 427 struct buffer_head *bh = NULL;
428 int error; 428 int error;
429 struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); 429 struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
@@ -460,7 +460,7 @@ cleanup:
460static int 460static int
461ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) 461ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
462{ 462{
463 struct inode *inode = dentry->d_inode; 463 struct inode *inode = d_inode(dentry);
464 struct ext4_xattr_ibody_header *header; 464 struct ext4_xattr_ibody_header *header;
465 struct ext4_inode *raw_inode; 465 struct ext4_inode *raw_inode;
466 struct ext4_iloc iloc; 466 struct ext4_iloc iloc;
@@ -501,7 +501,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
501{ 501{
502 int ret, ret2; 502 int ret, ret2;
503 503
504 down_read(&EXT4_I(dentry->d_inode)->xattr_sem); 504 down_read(&EXT4_I(d_inode(dentry))->xattr_sem);
505 ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size); 505 ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
506 if (ret < 0) 506 if (ret < 0)
507 goto errout; 507 goto errout;
@@ -514,7 +514,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
514 goto errout; 514 goto errout;
515 ret += ret2; 515 ret += ret2;
516errout: 516errout:
517 up_read(&EXT4_I(dentry->d_inode)->xattr_sem); 517 up_read(&EXT4_I(d_inode(dentry))->xattr_sem);
518 return ret; 518 return ret;
519} 519}
520 520
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 c06a25e5cec3..d8921cf2ba9a 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1482,7 +1482,7 @@ bool f2fs_empty_dir(struct inode *);
1482 1482
1483static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) 1483static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode)
1484{ 1484{
1485 return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, 1485 return __f2fs_add_link(d_inode(dentry->d_parent), &dentry->d_name,
1486 inode, inode->i_ino, inode->i_mode); 1486 inode, inode->i_ino, inode->i_mode);
1487} 1487}
1488 1488
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a6f3f6186588..2b52e48d7482 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -574,7 +574,7 @@ void f2fs_truncate(struct inode *inode)
574int f2fs_getattr(struct vfsmount *mnt, 574int f2fs_getattr(struct vfsmount *mnt,
575 struct dentry *dentry, struct kstat *stat) 575 struct dentry *dentry, struct kstat *stat)
576{ 576{
577 struct inode *inode = dentry->d_inode; 577 struct inode *inode = d_inode(dentry);
578 generic_fillattr(inode, stat); 578 generic_fillattr(inode, stat);
579 stat->blocks <<= 3; 579 stat->blocks <<= 3;
580 return 0; 580 return 0;
@@ -613,7 +613,7 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
613 613
614int f2fs_setattr(struct dentry *dentry, struct iattr *attr) 614int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
615{ 615{
616 struct inode *inode = dentry->d_inode; 616 struct inode *inode = d_inode(dentry);
617 struct f2fs_inode_info *fi = F2FS_I(inode); 617 struct f2fs_inode_info *fi = F2FS_I(inode);
618 int err; 618 int err;
619 619
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 407dde3d7a92..7e3794edae42 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -151,7 +151,7 @@ out:
151static int f2fs_link(struct dentry *old_dentry, struct inode *dir, 151static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
152 struct dentry *dentry) 152 struct dentry *dentry)
153{ 153{
154 struct inode *inode = old_dentry->d_inode; 154 struct inode *inode = d_inode(old_dentry);
155 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 155 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
156 int err; 156 int err;
157 157
@@ -182,10 +182,10 @@ out:
182struct dentry *f2fs_get_parent(struct dentry *child) 182struct dentry *f2fs_get_parent(struct dentry *child)
183{ 183{
184 struct qstr dotdot = QSTR_INIT("..", 2); 184 struct qstr dotdot = QSTR_INIT("..", 2);
185 unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot); 185 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot);
186 if (!ino) 186 if (!ino)
187 return ERR_PTR(-ENOENT); 187 return ERR_PTR(-ENOENT);
188 return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino)); 188 return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino));
189} 189}
190 190
191static int __recover_dot_dentries(struct inode *dir, nid_t pino) 191static int __recover_dot_dentries(struct inode *dir, nid_t pino)
@@ -263,7 +263,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
263static int f2fs_unlink(struct inode *dir, struct dentry *dentry) 263static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
264{ 264{
265 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 265 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
266 struct inode *inode = dentry->d_inode; 266 struct inode *inode = d_inode(dentry);
267 struct f2fs_dir_entry *de; 267 struct f2fs_dir_entry *de;
268 struct page *page; 268 struct page *page;
269 int err = -ENOENT; 269 int err = -ENOENT;
@@ -403,7 +403,7 @@ out_fail:
403 403
404static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) 404static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
405{ 405{
406 struct inode *inode = dentry->d_inode; 406 struct inode *inode = d_inode(dentry);
407 if (f2fs_empty_dir(inode)) 407 if (f2fs_empty_dir(inode))
408 return f2fs_unlink(dir, dentry); 408 return f2fs_unlink(dir, dentry);
409 return -ENOTEMPTY; 409 return -ENOTEMPTY;
@@ -451,8 +451,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
451 struct inode *new_dir, struct dentry *new_dentry) 451 struct inode *new_dir, struct dentry *new_dentry)
452{ 452{
453 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 453 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
454 struct inode *old_inode = old_dentry->d_inode; 454 struct inode *old_inode = d_inode(old_dentry);
455 struct inode *new_inode = new_dentry->d_inode; 455 struct inode *new_inode = d_inode(new_dentry);
456 struct page *old_dir_page; 456 struct page *old_dir_page;
457 struct page *old_page, *new_page; 457 struct page *old_page, *new_page;
458 struct f2fs_dir_entry *old_dir_entry = NULL; 458 struct f2fs_dir_entry *old_dir_entry = NULL;
@@ -578,8 +578,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
578 struct inode *new_dir, struct dentry *new_dentry) 578 struct inode *new_dir, struct dentry *new_dentry)
579{ 579{
580 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 580 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
581 struct inode *old_inode = old_dentry->d_inode; 581 struct inode *old_inode = d_inode(old_dentry);
582 struct inode *new_inode = new_dentry->d_inode; 582 struct inode *new_inode = d_inode(new_dentry);
583 struct page *old_dir_page, *new_dir_page; 583 struct page *old_dir_page, *new_dir_page;
584 struct page *old_page, *new_page; 584 struct page *old_page, *new_page;
585 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL; 585 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 b0fd2f2d0716..9757f65a05bc 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;
@@ -143,7 +143,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
143static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, 143static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
144 const void *value, size_t size, int flags, int type) 144 const void *value, size_t size, int flags, int type)
145{ 145{
146 struct inode *inode = dentry->d_inode; 146 struct inode *inode = d_inode(dentry);
147 147
148 if (strcmp(name, "") != 0) 148 if (strcmp(name, "") != 0)
149 return -EINVAL; 149 return -EINVAL;
@@ -444,7 +444,7 @@ cleanup:
444 444
445ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) 445ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
446{ 446{
447 struct inode *inode = dentry->d_inode; 447 struct inode *inode = d_inode(dentry);
448 struct f2fs_xattr_entry *entry; 448 struct f2fs_xattr_entry *entry;
449 void *base_addr; 449 void *base_addr;
450 int error = 0; 450 int error = 0;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index cf50d93565a2..442d50a0e33e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -305,7 +305,7 @@ void fat_truncate_blocks(struct inode *inode, loff_t offset)
305 305
306int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 306int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
307{ 307{
308 struct inode *inode = dentry->d_inode; 308 struct inode *inode = d_inode(dentry);
309 generic_fillattr(inode, stat); 309 generic_fillattr(inode, stat);
310 stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; 310 stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size;
311 311
@@ -377,7 +377,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
377int fat_setattr(struct dentry *dentry, struct iattr *attr) 377int fat_setattr(struct dentry *dentry, struct iattr *attr)
378{ 378{
379 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); 379 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
380 struct inode *inode = dentry->d_inode; 380 struct inode *inode = d_inode(dentry);
381 unsigned int ia_valid; 381 unsigned int ia_valid;
382 int error; 382 int error;
383 383
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index cc6a8541b668..b7e2b33aa793 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -308,7 +308,7 @@ out:
308static int msdos_rmdir(struct inode *dir, struct dentry *dentry) 308static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
309{ 309{
310 struct super_block *sb = dir->i_sb; 310 struct super_block *sb = dir->i_sb;
311 struct inode *inode = dentry->d_inode; 311 struct inode *inode = d_inode(dentry);
312 struct fat_slot_info sinfo; 312 struct fat_slot_info sinfo;
313 int err; 313 int err;
314 314
@@ -402,7 +402,7 @@ out:
402/***** Unlink a file */ 402/***** Unlink a file */
403static int msdos_unlink(struct inode *dir, struct dentry *dentry) 403static int msdos_unlink(struct inode *dir, struct dentry *dentry)
404{ 404{
405 struct inode *inode = dentry->d_inode; 405 struct inode *inode = d_inode(dentry);
406 struct super_block *sb = inode->i_sb; 406 struct super_block *sb = inode->i_sb;
407 struct fat_slot_info sinfo; 407 struct fat_slot_info sinfo;
408 int err; 408 int err;
@@ -440,8 +440,8 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
440 int err, old_attrs, is_dir, update_dotdot, corrupt = 0; 440 int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
441 441
442 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 442 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
443 old_inode = old_dentry->d_inode; 443 old_inode = d_inode(old_dentry);
444 new_inode = new_dentry->d_inode; 444 new_inode = d_inode(new_dentry);
445 445
446 err = fat_scan(old_dir, old_name, &old_sinfo); 446 err = fat_scan(old_dir, old_name, &old_sinfo);
447 if (err) { 447 if (err) {
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 7e0974eebd8e..7092584f424a 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -33,7 +33,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
33{ 33{
34 int ret = 1; 34 int ret = 1;
35 spin_lock(&dentry->d_lock); 35 spin_lock(&dentry->d_lock);
36 if (dentry->d_time != dentry->d_parent->d_inode->i_version) 36 if (dentry->d_time != d_inode(dentry->d_parent)->i_version)
37 ret = 0; 37 ret = 0;
38 spin_unlock(&dentry->d_lock); 38 spin_unlock(&dentry->d_lock);
39 return ret; 39 return ret;
@@ -45,7 +45,7 @@ static int vfat_revalidate(struct dentry *dentry, unsigned int flags)
45 return -ECHILD; 45 return -ECHILD;
46 46
47 /* This is not negative dentry. Always valid. */ 47 /* This is not negative dentry. Always valid. */
48 if (dentry->d_inode) 48 if (d_really_is_positive(dentry))
49 return 1; 49 return 1;
50 return vfat_revalidate_shortname(dentry); 50 return vfat_revalidate_shortname(dentry);
51} 51}
@@ -65,7 +65,7 @@ static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags)
65 * positive dentry isn't good idea. So it's unsupported like 65 * positive dentry isn't good idea. So it's unsupported like
66 * rename("filename", "FILENAME") for now. 66 * rename("filename", "FILENAME") for now.
67 */ 67 */
68 if (dentry->d_inode) 68 if (d_really_is_positive(dentry))
69 return 1; 69 return 1;
70 70
71 /* 71 /*
@@ -801,7 +801,7 @@ out:
801 801
802static int vfat_rmdir(struct inode *dir, struct dentry *dentry) 802static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
803{ 803{
804 struct inode *inode = dentry->d_inode; 804 struct inode *inode = d_inode(dentry);
805 struct super_block *sb = dir->i_sb; 805 struct super_block *sb = dir->i_sb;
806 struct fat_slot_info sinfo; 806 struct fat_slot_info sinfo;
807 int err; 807 int err;
@@ -832,7 +832,7 @@ out:
832 832
833static int vfat_unlink(struct inode *dir, struct dentry *dentry) 833static int vfat_unlink(struct inode *dir, struct dentry *dentry)
834{ 834{
835 struct inode *inode = dentry->d_inode; 835 struct inode *inode = d_inode(dentry);
836 struct super_block *sb = dir->i_sb; 836 struct super_block *sb = dir->i_sb;
837 struct fat_slot_info sinfo; 837 struct fat_slot_info sinfo;
838 int err; 838 int err;
@@ -915,8 +915,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
915 struct super_block *sb = old_dir->i_sb; 915 struct super_block *sb = old_dir->i_sb;
916 916
917 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 917 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
918 old_inode = old_dentry->d_inode; 918 old_inode = d_inode(old_dentry);
919 new_inode = new_dentry->d_inode; 919 new_inode = d_inode(new_dentry);
920 mutex_lock(&MSDOS_SB(sb)->s_lock); 920 mutex_lock(&MSDOS_SB(sb)->s_lock);
921 err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); 921 err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo);
922 if (err) 922 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 08bc84d7e768..1b3ca7a2e3fc 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;
@@ -1742,7 +1742,7 @@ out:
1742 1742
1743static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) 1743static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1744{ 1744{
1745 struct inode *inode = dentry->d_inode; 1745 struct inode *inode = d_inode(dentry);
1746 struct gfs2_inode *ip = GFS2_I(inode); 1746 struct gfs2_inode *ip = GFS2_I(inode);
1747 struct gfs2_holder i_gh; 1747 struct gfs2_holder i_gh;
1748 int error; 1748 int error;
@@ -1798,7 +1798,7 @@ out:
1798static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, 1798static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1799 struct kstat *stat) 1799 struct kstat *stat)
1800{ 1800{
1801 struct inode *inode = dentry->d_inode; 1801 struct inode *inode = d_inode(dentry);
1802 struct gfs2_inode *ip = GFS2_I(inode); 1802 struct gfs2_inode *ip = GFS2_I(inode);
1803 struct gfs2_holder gh; 1803 struct gfs2_holder gh;
1804 int error; 1804 int error;
@@ -1821,7 +1821,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1821static int gfs2_setxattr(struct dentry *dentry, const char *name, 1821static int gfs2_setxattr(struct dentry *dentry, const char *name,
1822 const void *data, size_t size, int flags) 1822 const void *data, size_t size, int flags)
1823{ 1823{
1824 struct inode *inode = dentry->d_inode; 1824 struct inode *inode = d_inode(dentry);
1825 struct gfs2_inode *ip = GFS2_I(inode); 1825 struct gfs2_inode *ip = GFS2_I(inode);
1826 struct gfs2_holder gh; 1826 struct gfs2_holder gh;
1827 int ret; 1827 int ret;
@@ -1841,7 +1841,7 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
1841static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, 1841static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1842 void *data, size_t size) 1842 void *data, size_t size)
1843{ 1843{
1844 struct inode *inode = dentry->d_inode; 1844 struct inode *inode = d_inode(dentry);
1845 struct gfs2_inode *ip = GFS2_I(inode); 1845 struct gfs2_inode *ip = GFS2_I(inode);
1846 struct gfs2_holder gh; 1846 struct gfs2_holder gh;
1847 int ret; 1847 int ret;
@@ -1862,7 +1862,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1862 1862
1863static int gfs2_removexattr(struct dentry *dentry, const char *name) 1863static int gfs2_removexattr(struct dentry *dentry, const char *name)
1864{ 1864{
1865 struct inode *inode = dentry->d_inode; 1865 struct inode *inode = d_inode(dentry);
1866 struct gfs2_inode *ip = GFS2_I(inode); 1866 struct gfs2_inode *ip = GFS2_I(inode);
1867 struct gfs2_holder gh; 1867 struct gfs2_holder gh;
1868 int ret; 1868 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 fd260ce8869a..4c096fa9e2a1 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 36d1a6ae7655..70788e03820a 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 3074609befc3..d0f39dcbb58e 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 b0afedbef12b..6dd107d7421e 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 8e98f5db6ad6..0624ce4e0702 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 89f262d8fcd8..416b1dbafe51 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -440,7 +440,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
440 return -ENOMEM; 440 return -ENOMEM;
441 strcpy(xattr_name, prefix); 441 strcpy(xattr_name, prefix);
442 strcpy(xattr_name + prefixlen, name); 442 strcpy(xattr_name + prefixlen, name);
443 res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size, 443 res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size,
444 flags); 444 flags);
445 kfree(xattr_name); 445 kfree(xattr_name);
446 return res; 446 return res;
@@ -600,7 +600,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
600 strcpy(xattr_name, prefix); 600 strcpy(xattr_name, prefix);
601 strcpy(xattr_name + prefixlen, name); 601 strcpy(xattr_name + prefixlen, name);
602 602
603 res = __hfsplus_getxattr(dentry->d_inode, xattr_name, value, size); 603 res = __hfsplus_getxattr(d_inode(dentry), xattr_name, value, size);
604 kfree(xattr_name); 604 kfree(xattr_name);
605 return res; 605 return res;
606 606
@@ -620,7 +620,7 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry,
620 char *buffer, size_t size) 620 char *buffer, size_t size)
621{ 621{
622 ssize_t res = 0; 622 ssize_t res = 0;
623 struct inode *inode = dentry->d_inode; 623 struct inode *inode = d_inode(dentry);
624 struct hfs_find_data fd; 624 struct hfs_find_data fd;
625 u16 entry_type; 625 u16 entry_type;
626 u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)]; 626 u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)];
@@ -688,7 +688,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
688{ 688{
689 ssize_t err; 689 ssize_t err;
690 ssize_t res = 0; 690 ssize_t res = 0;
691 struct inode *inode = dentry->d_inode; 691 struct inode *inode = d_inode(dentry);
692 struct hfs_find_data fd; 692 struct hfs_find_data fd;
693 u16 key_len = 0; 693 u16 key_len = 0;
694 struct hfsplus_attr_key attr_key; 694 struct hfsplus_attr_key attr_key;
@@ -868,7 +868,7 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
868 * creates), so we pass the name through unmodified (after 868 * creates), so we pass the name through unmodified (after
869 * ensuring it doesn't conflict with another namespace). 869 * ensuring it doesn't conflict with another namespace).
870 */ 870 */
871 return __hfsplus_getxattr(dentry->d_inode, name, buffer, size); 871 return __hfsplus_getxattr(d_inode(dentry), name, buffer, size);
872} 872}
873 873
874static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, 874static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
@@ -890,7 +890,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
890 * creates), so we pass the name through unmodified (after 890 * creates), so we pass the name through unmodified (after
891 * ensuring it doesn't conflict with another namespace). 891 * ensuring it doesn't conflict with another namespace).
892 */ 892 */
893 return __hfsplus_setxattr(dentry->d_inode, name, buffer, size, flags); 893 return __hfsplus_setxattr(d_inode(dentry), name, buffer, size, flags);
894} 894}
895 895
896static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, 896static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list,
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index b83a0343378b..ef263174acd2 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -807,7 +807,7 @@ static int hostfs_permission(struct inode *ino, int desired)
807 807
808static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) 808static int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
809{ 809{
810 struct inode *inode = dentry->d_inode; 810 struct inode *inode = d_inode(dentry);
811 struct hostfs_iattr attrs; 811 struct hostfs_iattr attrs;
812 char *name; 812 char *name;
813 int err; 813 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 2640d88b0e63..87724c1d7be6 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -393,7 +393,7 @@ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
393 393
394static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) 394static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
395{ 395{
396 struct inode *inode = dentry->d_inode; 396 struct inode *inode = d_inode(dentry);
397 struct hstate *h = hstate_inode(inode); 397 struct hstate *h = hstate_inode(inode);
398 int error; 398 int error;
399 unsigned int ia_valid = attr->ia_valid; 399 unsigned int ia_valid = attr->ia_valid;
@@ -587,7 +587,7 @@ static int hugetlbfs_migrate_page(struct address_space *mapping,
587static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) 587static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
588{ 588{
589 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); 589 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb);
590 struct hstate *h = hstate_inode(dentry->d_inode); 590 struct hstate *h = hstate_inode(d_inode(dentry));
591 591
592 buf->f_type = HUGETLBFS_MAGIC; 592 buf->f_type = HUGETLBFS_MAGIC;
593 buf->f_bsize = huge_page_size(h); 593 buf->f_bsize = huge_page_size(h);
diff --git a/fs/inode.c b/fs/inode.c
index f00b16f45507..ea37cd17b53f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1587,7 +1587,7 @@ static int update_time(struct inode *inode, struct timespec *time, int flags)
1587void touch_atime(const struct path *path) 1587void touch_atime(const struct path *path)
1588{ 1588{
1589 struct vfsmount *mnt = path->mnt; 1589 struct vfsmount *mnt = path->mnt;
1590 struct inode *inode = path->dentry->d_inode; 1590 struct inode *inode = d_inode(path->dentry);
1591 struct timespec now; 1591 struct timespec now;
1592 1592
1593 if (inode->i_flags & S_NOATIME) 1593 if (inode->i_flags & S_NOATIME)
@@ -1639,7 +1639,7 @@ EXPORT_SYMBOL(touch_atime);
1639 */ 1639 */
1640int should_remove_suid(struct dentry *dentry) 1640int should_remove_suid(struct dentry *dentry)
1641{ 1641{
1642 umode_t mode = dentry->d_inode->i_mode; 1642 umode_t mode = d_inode(dentry)->i_mode;
1643 int kill = 0; 1643 int kill = 0;
1644 1644
1645 /* suid always must be killed */ 1645 /* suid always must be killed */
@@ -1675,7 +1675,7 @@ static int __remove_suid(struct dentry *dentry, int kill)
1675int file_remove_suid(struct file *file) 1675int file_remove_suid(struct file *file)
1676{ 1676{
1677 struct dentry *dentry = file->f_path.dentry; 1677 struct dentry *dentry = file->f_path.dentry;
1678 struct inode *inode = dentry->d_inode; 1678 struct inode *inode = d_inode(dentry);
1679 int killsuid; 1679 int killsuid;
1680 int killpriv; 1680 int killpriv;
1681 int error = 0; 1681 int error = 0;
@@ -1946,20 +1946,6 @@ void inode_dio_wait(struct inode *inode)
1946EXPORT_SYMBOL(inode_dio_wait); 1946EXPORT_SYMBOL(inode_dio_wait);
1947 1947
1948/* 1948/*
1949 * inode_dio_done - signal finish of a direct I/O requests
1950 * @inode: inode the direct I/O happens on
1951 *
1952 * This is called once we've finished processing a direct I/O request,
1953 * and is used to wake up callers waiting for direct I/O to be quiesced.
1954 */
1955void inode_dio_done(struct inode *inode)
1956{
1957 if (atomic_dec_and_test(&inode->i_dio_count))
1958 wake_up_bit(&inode->i_state, __I_DIO_WAKEUP);
1959}
1960EXPORT_SYMBOL(inode_dio_done);
1961
1962/*
1963 * inode_set_flags - atomically set some inode flags 1949 * inode_set_flags - atomically set some inode flags
1964 * 1950 *
1965 * Note: the caller should be holding i_mutex, or else be sure that 1951 * Note: the caller should be holding i_mutex, or else be sure that
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 2eac55379239..f092fee5be50 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/libfs.c b/fs/libfs.c
index 0ab65122ee45..cb1fb4b9b637 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -22,13 +22,13 @@
22 22
23static inline int simple_positive(struct dentry *dentry) 23static inline int simple_positive(struct dentry *dentry)
24{ 24{
25 return dentry->d_inode && !d_unhashed(dentry); 25 return d_really_is_positive(dentry) && !d_unhashed(dentry);
26} 26}
27 27
28int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, 28int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
29 struct kstat *stat) 29 struct kstat *stat)
30{ 30{
31 struct inode *inode = dentry->d_inode; 31 struct inode *inode = d_inode(dentry);
32 generic_fillattr(inode, stat); 32 generic_fillattr(inode, stat);
33 stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9); 33 stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
34 return 0; 34 return 0;
@@ -94,7 +94,7 @@ EXPORT_SYMBOL(dcache_dir_close);
94loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) 94loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
95{ 95{
96 struct dentry *dentry = file->f_path.dentry; 96 struct dentry *dentry = file->f_path.dentry;
97 mutex_lock(&dentry->d_inode->i_mutex); 97 mutex_lock(&d_inode(dentry)->i_mutex);
98 switch (whence) { 98 switch (whence) {
99 case 1: 99 case 1:
100 offset += file->f_pos; 100 offset += file->f_pos;
@@ -102,7 +102,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
102 if (offset >= 0) 102 if (offset >= 0)
103 break; 103 break;
104 default: 104 default:
105 mutex_unlock(&dentry->d_inode->i_mutex); 105 mutex_unlock(&d_inode(dentry)->i_mutex);
106 return -EINVAL; 106 return -EINVAL;
107 } 107 }
108 if (offset != file->f_pos) { 108 if (offset != file->f_pos) {
@@ -129,7 +129,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
129 spin_unlock(&dentry->d_lock); 129 spin_unlock(&dentry->d_lock);
130 } 130 }
131 } 131 }
132 mutex_unlock(&dentry->d_inode->i_mutex); 132 mutex_unlock(&d_inode(dentry)->i_mutex);
133 return offset; 133 return offset;
134} 134}
135EXPORT_SYMBOL(dcache_dir_lseek); 135EXPORT_SYMBOL(dcache_dir_lseek);
@@ -169,7 +169,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
169 spin_unlock(&next->d_lock); 169 spin_unlock(&next->d_lock);
170 spin_unlock(&dentry->d_lock); 170 spin_unlock(&dentry->d_lock);
171 if (!dir_emit(ctx, next->d_name.name, next->d_name.len, 171 if (!dir_emit(ctx, next->d_name.name, next->d_name.len,
172 next->d_inode->i_ino, dt_type(next->d_inode))) 172 d_inode(next)->i_ino, dt_type(d_inode(next))))
173 return 0; 173 return 0;
174 spin_lock(&dentry->d_lock); 174 spin_lock(&dentry->d_lock);
175 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); 175 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
@@ -270,7 +270,7 @@ EXPORT_SYMBOL(simple_open);
270 270
271int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 271int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
272{ 272{
273 struct inode *inode = old_dentry->d_inode; 273 struct inode *inode = d_inode(old_dentry);
274 274
275 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 275 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
276 inc_nlink(inode); 276 inc_nlink(inode);
@@ -304,7 +304,7 @@ EXPORT_SYMBOL(simple_empty);
304 304
305int simple_unlink(struct inode *dir, struct dentry *dentry) 305int simple_unlink(struct inode *dir, struct dentry *dentry)
306{ 306{
307 struct inode *inode = dentry->d_inode; 307 struct inode *inode = d_inode(dentry);
308 308
309 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 309 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
310 drop_nlink(inode); 310 drop_nlink(inode);
@@ -318,7 +318,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
318 if (!simple_empty(dentry)) 318 if (!simple_empty(dentry))
319 return -ENOTEMPTY; 319 return -ENOTEMPTY;
320 320
321 drop_nlink(dentry->d_inode); 321 drop_nlink(d_inode(dentry));
322 simple_unlink(dir, dentry); 322 simple_unlink(dir, dentry);
323 drop_nlink(dir); 323 drop_nlink(dir);
324 return 0; 324 return 0;
@@ -328,16 +328,16 @@ EXPORT_SYMBOL(simple_rmdir);
328int simple_rename(struct inode *old_dir, struct dentry *old_dentry, 328int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
329 struct inode *new_dir, struct dentry *new_dentry) 329 struct inode *new_dir, struct dentry *new_dentry)
330{ 330{
331 struct inode *inode = old_dentry->d_inode; 331 struct inode *inode = d_inode(old_dentry);
332 int they_are_dirs = d_is_dir(old_dentry); 332 int they_are_dirs = d_is_dir(old_dentry);
333 333
334 if (!simple_empty(new_dentry)) 334 if (!simple_empty(new_dentry))
335 return -ENOTEMPTY; 335 return -ENOTEMPTY;
336 336
337 if (new_dentry->d_inode) { 337 if (d_really_is_positive(new_dentry)) {
338 simple_unlink(new_dir, new_dentry); 338 simple_unlink(new_dir, new_dentry);
339 if (they_are_dirs) { 339 if (they_are_dirs) {
340 drop_nlink(new_dentry->d_inode); 340 drop_nlink(d_inode(new_dentry));
341 drop_nlink(old_dir); 341 drop_nlink(old_dir);
342 } 342 }
343 } else if (they_are_dirs) { 343 } else if (they_are_dirs) {
@@ -368,7 +368,7 @@ EXPORT_SYMBOL(simple_rename);
368 */ 368 */
369int simple_setattr(struct dentry *dentry, struct iattr *iattr) 369int simple_setattr(struct dentry *dentry, struct iattr *iattr)
370{ 370{
371 struct inode *inode = dentry->d_inode; 371 struct inode *inode = d_inode(dentry);
372 int error; 372 int error;
373 373
374 error = inode_change_ok(inode, iattr); 374 error = inode_change_ok(inode, iattr);
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/namei.c b/fs/namei.c
index ffab2e06e147..4a8d998b7274 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1590,7 +1590,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
1590 1590
1591 if (should_follow_link(path->dentry, follow)) { 1591 if (should_follow_link(path->dentry, follow)) {
1592 if (nd->flags & LOOKUP_RCU) { 1592 if (nd->flags & LOOKUP_RCU) {
1593 if (unlikely(unlazy_walk(nd, path->dentry))) { 1593 if (unlikely(nd->path.mnt != path->mnt ||
1594 unlazy_walk(nd, path->dentry))) {
1594 err = -ECHILD; 1595 err = -ECHILD;
1595 goto out_err; 1596 goto out_err;
1596 } 1597 }
@@ -3045,7 +3046,8 @@ finish_lookup:
3045 3046
3046 if (should_follow_link(path->dentry, !symlink_ok)) { 3047 if (should_follow_link(path->dentry, !symlink_ok)) {
3047 if (nd->flags & LOOKUP_RCU) { 3048 if (nd->flags & LOOKUP_RCU) {
3048 if (unlikely(unlazy_walk(nd, path->dentry))) { 3049 if (unlikely(nd->path.mnt != path->mnt ||
3050 unlazy_walk(nd, path->dentry))) {
3049 error = -ECHILD; 3051 error = -ECHILD;
3050 goto out; 3052 goto out;
3051 } 3053 }
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..b2cbc3a6cdd9 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -386,7 +386,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
386 if (write) 386 if (write)
387 nfs_zap_mapping(inode, inode->i_mapping); 387 nfs_zap_mapping(inode, inode->i_mapping);
388 388
389 inode_dio_done(inode); 389 inode_dio_end(inode);
390 390
391 if (dreq->iocb) { 391 if (dreq->iocb) {
392 long res = (long) dreq->error; 392 long res = (long) dreq->error;
@@ -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);
@@ -486,7 +486,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
486 &nfs_direct_read_completion_ops); 486 &nfs_direct_read_completion_ops);
487 get_dreq(dreq); 487 get_dreq(dreq);
488 desc.pg_dreq = dreq; 488 desc.pg_dreq = dreq;
489 atomic_inc(&inode->i_dio_count); 489 inode_dio_begin(inode);
490 490
491 while (iov_iter_count(iter)) { 491 while (iov_iter_count(iter)) {
492 struct page **pagevec; 492 struct page **pagevec;
@@ -538,7 +538,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
538 * generic layer handle the completion. 538 * generic layer handle the completion.
539 */ 539 */
540 if (requested_bytes == 0) { 540 if (requested_bytes == 0) {
541 inode_dio_done(inode); 541 inode_dio_end(inode);
542 nfs_direct_req_release(dreq); 542 nfs_direct_req_release(dreq);
543 return result < 0 ? result : -EIO; 543 return result < 0 ? result : -EIO;
544 } 544 }
@@ -872,7 +872,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
872 &nfs_direct_write_completion_ops); 872 &nfs_direct_write_completion_ops);
873 desc.pg_dreq = dreq; 873 desc.pg_dreq = dreq;
874 get_dreq(dreq); 874 get_dreq(dreq);
875 atomic_inc(&inode->i_dio_count); 875 inode_dio_begin(inode);
876 876
877 NFS_I(inode)->write_io += iov_iter_count(iter); 877 NFS_I(inode)->write_io += iov_iter_count(iter);
878 while (iov_iter_count(iter)) { 878 while (iov_iter_count(iter)) {
@@ -928,7 +928,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
928 * generic layer handle the completion. 928 * generic layer handle the completion.
929 */ 929 */
930 if (requested_bytes == 0) { 930 if (requested_bytes == 0) {
931 inode_dio_done(inode); 931 inode_dio_end(inode);
932 nfs_direct_req_release(dreq); 932 nfs_direct_req_release(dreq);
933 return result < 0 ? result : -EIO; 933 return result < 0 ? result : -EIO;
934 } 934 }
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 759931088094..3612b4622337 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 900c3ae94adc..f79521a59747 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;
@@ -890,7 +890,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
890 printk("nfsd: exp_rootfh path not found %s", name); 890 printk("nfsd: exp_rootfh path not found %s", name);
891 return err; 891 return err;
892 } 892 }
893 inode = path.dentry->d_inode; 893 inode = d_inode(path.dentry);
894 894
895 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 895 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
896 name, path.dentry, clp->name, 896 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 eaf4605a4b9e..67242bf7c6cc 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;
@@ -780,7 +780,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
780 return error; 780 return error;
781 781
782 dentry = fhp->fh_dentry; 782 dentry = fhp->fh_dentry;
783 inode = dentry->d_inode; 783 inode = d_inode(dentry);
784 784
785 if (!inode->i_op->set_acl || !IS_POSIXACL(inode)) 785 if (!inode->i_op->set_acl || !IS_POSIXACL(inode))
786 return nfserr_attrnotsupp; 786 return nfserr_attrnotsupp;
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 4a8314f08a0e..864e2003e8de 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
@@ -1312,7 +1312,7 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
1312 if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls)) 1312 if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls))
1313 goto out_put_stid; 1313 goto out_put_stid;
1314 1314
1315 nfserr = ops->proc_layoutget(current_fh->fh_dentry->d_inode, 1315 nfserr = ops->proc_layoutget(d_inode(current_fh->fh_dentry),
1316 current_fh, lgp); 1316 current_fh, lgp);
1317 if (nfserr) 1317 if (nfserr)
1318 goto out_put_stid; 1318 goto out_put_stid;
@@ -1346,7 +1346,7 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
1346 ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type); 1346 ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type);
1347 if (!ops) 1347 if (!ops)
1348 goto out; 1348 goto out;
1349 inode = current_fh->fh_dentry->d_inode; 1349 inode = d_inode(current_fh->fh_dentry);
1350 1350
1351 nfserr = nfserr_inval; 1351 nfserr = nfserr_inval;
1352 if (new_size <= seg->offset) { 1352 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 d42786ee39af..38f2d7abe3a7 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4472,7 +4472,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
4472 struct nfs4_ol_stateid *stp = NULL; 4472 struct nfs4_ol_stateid *stp = NULL;
4473 struct nfs4_delegation *dp = NULL; 4473 struct nfs4_delegation *dp = NULL;
4474 struct svc_fh *current_fh = &cstate->current_fh; 4474 struct svc_fh *current_fh = &cstate->current_fh;
4475 struct inode *ino = current_fh->fh_dentry->d_inode; 4475 struct inode *ino = d_inode(current_fh->fh_dentry);
4476 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 4476 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
4477 struct file *file = NULL; 4477 struct file *file = NULL;
4478 __be32 status; 4478 __be32 status;
@@ -5170,7 +5170,7 @@ lookup_or_create_lock_state(struct nfsd4_compound_state *cstate,
5170 struct nfs4_file *fi = ost->st_stid.sc_file; 5170 struct nfs4_file *fi = ost->st_stid.sc_file;
5171 struct nfs4_openowner *oo = openowner(ost->st_stateowner); 5171 struct nfs4_openowner *oo = openowner(ost->st_stateowner);
5172 struct nfs4_client *cl = oo->oo_owner.so_client; 5172 struct nfs4_client *cl = oo->oo_owner.so_client;
5173 struct inode *inode = cstate->current_fh.fh_dentry->d_inode; 5173 struct inode *inode = d_inode(cstate->current_fh.fh_dentry);
5174 struct nfs4_lockowner *lo; 5174 struct nfs4_lockowner *lo;
5175 unsigned int strhashval; 5175 unsigned int strhashval;
5176 5176
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index a45032ce7b80..158badf945df 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 556ce2e47555..f982ae84f0cd 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -631,7 +631,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
631{ 631{
632 BUG_ON(!fhp->fh_pre_saved); 632 BUG_ON(!fhp->fh_pre_saved);
633 cinfo->atomic = fhp->fh_post_saved; 633 cinfo->atomic = fhp->fh_post_saved;
634 cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); 634 cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry));
635 635
636 cinfo->before_change = fhp->fh_pre_change; 636 cinfo->before_change = fhp->fh_pre_change;
637 cinfo->after_change = fhp->fh_post_change; 637 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 be936df4ba73..258d9fe2521a 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -835,7 +835,7 @@ void nilfs_evict_inode(struct inode *inode)
835int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) 835int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
836{ 836{
837 struct nilfs_transaction_info ti; 837 struct nilfs_transaction_info ti;
838 struct inode *inode = dentry->d_inode; 838 struct inode *inode = d_inode(dentry);
839 struct super_block *sb = inode->i_sb; 839 struct super_block *sb = inode->i_sb;
840 int err; 840 int err;
841 841
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 c1725f20a9d1..f47585bfeb01 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/nsfs.c b/fs/nsfs.c
index af1b24fa899d..99521e7c492b 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -13,7 +13,7 @@ static const struct file_operations ns_file_operations = {
13 13
14static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) 14static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
15{ 15{
16 struct inode *inode = dentry->d_inode; 16 struct inode *inode = d_inode(dentry);
17 const struct proc_ns_operations *ns_ops = dentry->d_fsdata; 17 const struct proc_ns_operations *ns_ops = dentry->d_fsdata;
18 18
19 return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", 19 return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]",
@@ -22,7 +22,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
22 22
23static void ns_prune_dentry(struct dentry *dentry) 23static void ns_prune_dentry(struct dentry *dentry)
24{ 24{
25 struct inode *inode = dentry->d_inode; 25 struct inode *inode = d_inode(dentry);
26 if (inode) { 26 if (inode) {
27 struct ns_common *ns = inode->i_private; 27 struct ns_common *ns = inode->i_private;
28 atomic_long_set(&ns->stashed, 0); 28 atomic_long_set(&ns->stashed, 0);
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 540dc4bdd042..827fc9809bc2 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 be71ca0937f7..b254416dc8d9 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 09f90cbf0e24..176fe6afd94e 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 df3a500789c7..d8c6af101f3f 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 4ca7533be479..d03bfbf3d27d 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
@@ -7257,7 +7257,7 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
7257{ 7257{
7258 if (strcmp(name, "") == 0) 7258 if (strcmp(name, "") == 0)
7259 return -EINVAL; 7259 return -EINVAL;
7260 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, 7260 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
7261 name, buffer, size); 7261 name, buffer, size);
7262} 7262}
7263 7263
@@ -7267,7 +7267,7 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
7267 if (strcmp(name, "") == 0) 7267 if (strcmp(name, "") == 0)
7268 return -EINVAL; 7268 return -EINVAL;
7269 7269
7270 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, 7270 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
7271 name, value, size, flags); 7271 name, value, size, flags);
7272} 7272}
7273 7273
@@ -7347,7 +7347,7 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
7347{ 7347{
7348 if (strcmp(name, "") == 0) 7348 if (strcmp(name, "") == 0)
7349 return -EINVAL; 7349 return -EINVAL;
7350 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, 7350 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
7351 name, buffer, size); 7351 name, buffer, size);
7352} 7352}
7353 7353
@@ -7357,7 +7357,7 @@ static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
7357 if (strcmp(name, "") == 0) 7357 if (strcmp(name, "") == 0)
7358 return -EINVAL; 7358 return -EINVAL;
7359 7359
7360 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, 7360 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
7361 name, value, size, flags); 7361 name, value, size, flags);
7362} 7362}
7363 7363
@@ -7399,7 +7399,7 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
7399 return -EINVAL; 7399 return -EINVAL;
7400 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7400 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7401 return -EOPNOTSUPP; 7401 return -EOPNOTSUPP;
7402 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_USER, name, 7402 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name,
7403 buffer, size); 7403 buffer, size);
7404} 7404}
7405 7405
@@ -7413,7 +7413,7 @@ static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
7413 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7413 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7414 return -EOPNOTSUPP; 7414 return -EOPNOTSUPP;
7415 7415
7416 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_USER, 7416 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER,
7417 name, value, size, flags); 7417 name, value, size, flags);
7418} 7418}
7419 7419
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/pipe.c b/fs/pipe.c
index 822da5b7cff0..8865f7963700 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -627,7 +627,7 @@ static struct vfsmount *pipe_mnt __read_mostly;
627static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen) 627static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen)
628{ 628{
629 return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", 629 return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
630 dentry->d_inode->i_ino); 630 d_inode(dentry)->i_ino);
631} 631}
632 632
633static const struct dentry_operations pipefs_dentry_operations = { 633static const struct dentry_operations pipefs_dentry_operations = {
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 3a48bb789c9f..84bb65b83570 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -774,12 +774,12 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
774 struct posix_acl *acl; 774 struct posix_acl *acl;
775 int error; 775 int error;
776 776
777 if (!IS_POSIXACL(dentry->d_inode)) 777 if (!IS_POSIXACL(d_backing_inode(dentry)))
778 return -EOPNOTSUPP; 778 return -EOPNOTSUPP;
779 if (d_is_symlink(dentry)) 779 if (d_is_symlink(dentry))
780 return -EOPNOTSUPP; 780 return -EOPNOTSUPP;
781 781
782 acl = get_acl(dentry->d_inode, type); 782 acl = get_acl(d_backing_inode(dentry), type);
783 if (IS_ERR(acl)) 783 if (IS_ERR(acl))
784 return PTR_ERR(acl); 784 return PTR_ERR(acl);
785 if (acl == NULL) 785 if (acl == NULL)
@@ -795,7 +795,7 @@ static int
795posix_acl_xattr_set(struct dentry *dentry, const char *name, 795posix_acl_xattr_set(struct dentry *dentry, const char *name,
796 const void *value, size_t size, int flags, int type) 796 const void *value, size_t size, int flags, int type)
797{ 797{
798 struct inode *inode = dentry->d_inode; 798 struct inode *inode = d_backing_inode(dentry);
799 struct posix_acl *acl = NULL; 799 struct posix_acl *acl = NULL;
800 int ret; 800 int ret;
801 801
@@ -834,7 +834,7 @@ posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size,
834 const char *xname; 834 const char *xname;
835 size_t size; 835 size_t size;
836 836
837 if (!IS_POSIXACL(dentry->d_inode)) 837 if (!IS_POSIXACL(d_backing_inode(dentry)))
838 return -EOPNOTSUPP; 838 return -EOPNOTSUPP;
839 if (d_is_symlink(dentry)) 839 if (d_is_symlink(dentry))
840 return -EOPNOTSUPP; 840 return -EOPNOTSUPP;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7a3b82f986dd..093ca14f5701 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) {
@@ -514,7 +514,7 @@ static int proc_fd_access_allowed(struct inode *inode)
514int proc_setattr(struct dentry *dentry, struct iattr *attr) 514int proc_setattr(struct dentry *dentry, struct iattr *attr)
515{ 515{
516 int error; 516 int error;
517 struct inode *inode = dentry->d_inode; 517 struct inode *inode = d_inode(dentry);
518 518
519 if (attr->ia_valid & ATTR_MODE) 519 if (attr->ia_valid & ATTR_MODE)
520 return -EPERM; 520 return -EPERM;
@@ -1362,7 +1362,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
1362 struct mm_struct *mm; 1362 struct mm_struct *mm;
1363 struct file *exe_file; 1363 struct file *exe_file;
1364 1364
1365 task = get_proc_task(dentry->d_inode); 1365 task = get_proc_task(d_inode(dentry));
1366 if (!task) 1366 if (!task)
1367 return -ENOENT; 1367 return -ENOENT;
1368 mm = get_task_mm(task); 1368 mm = get_task_mm(task);
@@ -1382,7 +1382,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
1382 1382
1383static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) 1383static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
1384{ 1384{
1385 struct inode *inode = dentry->d_inode; 1385 struct inode *inode = d_inode(dentry);
1386 struct path path; 1386 struct path path;
1387 int error = -EACCES; 1387 int error = -EACCES;
1388 1388
@@ -1427,7 +1427,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
1427static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen) 1427static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
1428{ 1428{
1429 int error = -EACCES; 1429 int error = -EACCES;
1430 struct inode *inode = dentry->d_inode; 1430 struct inode *inode = d_inode(dentry);
1431 struct path path; 1431 struct path path;
1432 1432
1433 /* Are we allowed to snoop on the tasks file descriptors? */ 1433 /* Are we allowed to snoop on the tasks file descriptors? */
@@ -1497,7 +1497,7 @@ out_unlock:
1497 1497
1498int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 1498int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1499{ 1499{
1500 struct inode *inode = dentry->d_inode; 1500 struct inode *inode = d_inode(dentry);
1501 struct task_struct *task; 1501 struct task_struct *task;
1502 const struct cred *cred; 1502 const struct cred *cred;
1503 struct pid_namespace *pid = dentry->d_sb->s_fs_info; 1503 struct pid_namespace *pid = dentry->d_sb->s_fs_info;
@@ -1554,7 +1554,7 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
1554 if (flags & LOOKUP_RCU) 1554 if (flags & LOOKUP_RCU)
1555 return -ECHILD; 1555 return -ECHILD;
1556 1556
1557 inode = dentry->d_inode; 1557 inode = d_inode(dentry);
1558 task = get_proc_task(inode); 1558 task = get_proc_task(inode);
1559 1559
1560 if (task) { 1560 if (task) {
@@ -1588,7 +1588,7 @@ int pid_delete_dentry(const struct dentry *dentry)
1588 * If so, then don't put the dentry on the lru list, 1588 * If so, then don't put the dentry on the lru list,
1589 * kill it immediately. 1589 * kill it immediately.
1590 */ 1590 */
1591 return proc_inode_is_dead(dentry->d_inode); 1591 return proc_inode_is_dead(d_inode(dentry));
1592} 1592}
1593 1593
1594const struct dentry_operations pid_dentry_operations = 1594const struct dentry_operations pid_dentry_operations =
@@ -1626,12 +1626,12 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
1626 child = d_alloc(dir, &qname); 1626 child = d_alloc(dir, &qname);
1627 if (!child) 1627 if (!child)
1628 goto end_instantiate; 1628 goto end_instantiate;
1629 if (instantiate(dir->d_inode, child, task, ptr) < 0) { 1629 if (instantiate(d_inode(dir), child, task, ptr) < 0) {
1630 dput(child); 1630 dput(child);
1631 goto end_instantiate; 1631 goto end_instantiate;
1632 } 1632 }
1633 } 1633 }
1634 inode = child->d_inode; 1634 inode = d_inode(child);
1635 ino = inode->i_ino; 1635 ino = inode->i_ino;
1636 type = inode->i_mode >> 12; 1636 type = inode->i_mode >> 12;
1637 dput(child); 1637 dput(child);
@@ -1674,7 +1674,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
1674 goto out_notask; 1674 goto out_notask;
1675 } 1675 }
1676 1676
1677 inode = dentry->d_inode; 1677 inode = d_inode(dentry);
1678 task = get_proc_task(inode); 1678 task = get_proc_task(inode);
1679 if (!task) 1679 if (!task)
1680 goto out_notask; 1680 goto out_notask;
@@ -1727,7 +1727,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path)
1727 int rc; 1727 int rc;
1728 1728
1729 rc = -ENOENT; 1729 rc = -ENOENT;
1730 task = get_proc_task(dentry->d_inode); 1730 task = get_proc_task(d_inode(dentry));
1731 if (!task) 1731 if (!task)
1732 goto out; 1732 goto out;
1733 1733
@@ -2863,13 +2863,13 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
2863 return 0; 2863 return 0;
2864 2864
2865 if (pos == TGID_OFFSET - 2) { 2865 if (pos == TGID_OFFSET - 2) {
2866 struct inode *inode = ns->proc_self->d_inode; 2866 struct inode *inode = d_inode(ns->proc_self);
2867 if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK)) 2867 if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK))
2868 return 0; 2868 return 0;
2869 ctx->pos = pos = pos + 1; 2869 ctx->pos = pos = pos + 1;
2870 } 2870 }
2871 if (pos == TGID_OFFSET - 1) { 2871 if (pos == TGID_OFFSET - 1) {
2872 struct inode *inode = ns->proc_thread_self->d_inode; 2872 struct inode *inode = d_inode(ns->proc_thread_self);
2873 if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK)) 2873 if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK))
2874 return 0; 2874 return 0;
2875 ctx->pos = pos = pos + 1; 2875 ctx->pos = pos = pos + 1;
@@ -3188,7 +3188,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
3188 3188
3189static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 3189static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
3190{ 3190{
3191 struct inode *inode = dentry->d_inode; 3191 struct inode *inode = d_inode(dentry);
3192 struct task_struct *p = get_proc_task(inode); 3192 struct task_struct *p = get_proc_task(inode);
3193 generic_fillattr(inode, stat); 3193 generic_fillattr(inode, stat);
3194 3194
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index af84ad04df77..6e5fcd00733e 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -91,7 +91,7 @@ static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags)
91 if (flags & LOOKUP_RCU) 91 if (flags & LOOKUP_RCU)
92 return -ECHILD; 92 return -ECHILD;
93 93
94 inode = dentry->d_inode; 94 inode = d_inode(dentry);
95 task = get_proc_task(inode); 95 task = get_proc_task(inode);
96 fd = proc_fd(inode); 96 fd = proc_fd(inode);
97 97
@@ -151,14 +151,14 @@ static int proc_fd_link(struct dentry *dentry, struct path *path)
151 struct task_struct *task; 151 struct task_struct *task;
152 int ret = -ENOENT; 152 int ret = -ENOENT;
153 153
154 task = get_proc_task(dentry->d_inode); 154 task = get_proc_task(d_inode(dentry));
155 if (task) { 155 if (task) {
156 files = get_files_struct(task); 156 files = get_files_struct(task);
157 put_task_struct(task); 157 put_task_struct(task);
158 } 158 }
159 159
160 if (files) { 160 if (files) {
161 int fd = proc_fd(dentry->d_inode); 161 int fd = proc_fd(d_inode(dentry));
162 struct file *fd_file; 162 struct file *fd_file;
163 163
164 spin_lock(&files->file_lock); 164 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 56e1ffda4d89..dc43b5f29305 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
@@ -376,7 +376,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
376 break; 376 break;
377 } 377 }
378 378
379 mutex_lock(&root->d_inode->i_mutex); 379 mutex_lock(&d_inode(root)->i_mutex);
380 380
381 dentry = d_alloc_name(root, name); 381 dentry = d_alloc_name(root, name);
382 if (!dentry) 382 if (!dentry)
@@ -396,12 +396,12 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
396 list_add(&private->list, &allpstore); 396 list_add(&private->list, &allpstore);
397 spin_unlock_irqrestore(&allpstore_lock, flags); 397 spin_unlock_irqrestore(&allpstore_lock, flags);
398 398
399 mutex_unlock(&root->d_inode->i_mutex); 399 mutex_unlock(&d_inode(root)->i_mutex);
400 400
401 return 0; 401 return 0;
402 402
403fail_lockedalloc: 403fail_lockedalloc:
404 mutex_unlock(&root->d_inode->i_mutex); 404 mutex_unlock(&d_inode(root)->i_mutex);
405 kfree(private); 405 kfree(private);
406fail_alloc: 406fail_alloc:
407 iput(inode); 407 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/quota/dquot.c b/fs/quota/dquot.c
index ecc25cf0ee6e..20d1f74561cf 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2328,7 +2328,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id,
2328 if (path->dentry->d_sb != sb) 2328 if (path->dentry->d_sb != sb)
2329 error = -EXDEV; 2329 error = -EXDEV;
2330 else 2330 else
2331 error = vfs_load_quota_inode(path->dentry->d_inode, type, 2331 error = vfs_load_quota_inode(d_inode(path->dentry), type,
2332 format_id, DQUOT_USAGE_ENABLED | 2332 format_id, DQUOT_USAGE_ENABLED |
2333 DQUOT_LIMITS_ENABLED); 2333 DQUOT_LIMITS_ENABLED);
2334 return error; 2334 return error;
@@ -2392,20 +2392,20 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
2392 struct dentry *dentry; 2392 struct dentry *dentry;
2393 int error; 2393 int error;
2394 2394
2395 mutex_lock(&sb->s_root->d_inode->i_mutex); 2395 mutex_lock(&d_inode(sb->s_root)->i_mutex);
2396 dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); 2396 dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name));
2397 mutex_unlock(&sb->s_root->d_inode->i_mutex); 2397 mutex_unlock(&d_inode(sb->s_root)->i_mutex);
2398 if (IS_ERR(dentry)) 2398 if (IS_ERR(dentry))
2399 return PTR_ERR(dentry); 2399 return PTR_ERR(dentry);
2400 2400
2401 if (!dentry->d_inode) { 2401 if (d_really_is_negative(dentry)) {
2402 error = -ENOENT; 2402 error = -ENOENT;
2403 goto out; 2403 goto out;
2404 } 2404 }
2405 2405
2406 error = security_quota_on(dentry); 2406 error = security_quota_on(dentry);
2407 if (!error) 2407 if (!error)
2408 error = vfs_load_quota_inode(dentry->d_inode, type, format_id, 2408 error = vfs_load_quota_inode(d_inode(dentry), type, format_id,
2409 DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 2409 DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
2410 2410
2411out: 2411out:
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 68b5f182984e..0111ad0466ed 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/stat.c b/fs/stat.c
index 19636af5e75c..cccc1aab9a8b 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL(generic_fillattr);
51 */ 51 */
52int vfs_getattr_nosec(struct path *path, struct kstat *stat) 52int vfs_getattr_nosec(struct path *path, struct kstat *stat)
53{ 53{
54 struct inode *inode = path->dentry->d_inode; 54 struct inode *inode = d_backing_inode(path->dentry);
55 55
56 if (inode->i_op->getattr) 56 if (inode->i_op->getattr)
57 return inode->i_op->getattr(path->mnt, path->dentry, stat); 57 return inode->i_op->getattr(path->mnt, path->dentry, stat);
@@ -326,7 +326,7 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
326retry: 326retry:
327 error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty); 327 error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty);
328 if (!error) { 328 if (!error) {
329 struct inode *inode = path.dentry->d_inode; 329 struct inode *inode = d_backing_inode(path.dentry);
330 330
331 error = empty ? -ENOENT : -EINVAL; 331 error = empty ? -ENOENT : -EINVAL;
332 if (inode->i_op->readlink) { 332 if (inode->i_op->readlink) {
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 02d1ee778df0..27060fc855d4 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -499,7 +499,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
499 struct dentry *dentry) 499 struct dentry *dentry)
500{ 500{
501 struct ubifs_info *c = dir->i_sb->s_fs_info; 501 struct ubifs_info *c = dir->i_sb->s_fs_info;
502 struct inode *inode = old_dentry->d_inode; 502 struct inode *inode = d_inode(old_dentry);
503 struct ubifs_inode *ui = ubifs_inode(inode); 503 struct ubifs_inode *ui = ubifs_inode(inode);
504 struct ubifs_inode *dir_ui = ubifs_inode(dir); 504 struct ubifs_inode *dir_ui = ubifs_inode(dir);
505 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); 505 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len);
@@ -554,7 +554,7 @@ out_cancel:
554static int ubifs_unlink(struct inode *dir, struct dentry *dentry) 554static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
555{ 555{
556 struct ubifs_info *c = dir->i_sb->s_fs_info; 556 struct ubifs_info *c = dir->i_sb->s_fs_info;
557 struct inode *inode = dentry->d_inode; 557 struct inode *inode = d_inode(dentry);
558 struct ubifs_inode *dir_ui = ubifs_inode(dir); 558 struct ubifs_inode *dir_ui = ubifs_inode(dir);
559 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); 559 int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
560 int err, budgeted = 1; 560 int err, budgeted = 1;
@@ -646,7 +646,7 @@ static int check_dir_empty(struct ubifs_info *c, struct inode *dir)
646static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) 646static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
647{ 647{
648 struct ubifs_info *c = dir->i_sb->s_fs_info; 648 struct ubifs_info *c = dir->i_sb->s_fs_info;
649 struct inode *inode = dentry->d_inode; 649 struct inode *inode = d_inode(dentry);
650 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); 650 int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
651 int err, budgeted = 1; 651 int err, budgeted = 1;
652 struct ubifs_inode *dir_ui = ubifs_inode(dir); 652 struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -662,7 +662,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
662 inode->i_ino, dir->i_ino); 662 inode->i_ino, dir->i_ino);
663 ubifs_assert(mutex_is_locked(&dir->i_mutex)); 663 ubifs_assert(mutex_is_locked(&dir->i_mutex));
664 ubifs_assert(mutex_is_locked(&inode->i_mutex)); 664 ubifs_assert(mutex_is_locked(&inode->i_mutex));
665 err = check_dir_empty(c, dentry->d_inode); 665 err = check_dir_empty(c, d_inode(dentry));
666 if (err) 666 if (err)
667 return err; 667 return err;
668 668
@@ -970,8 +970,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
970 struct inode *new_dir, struct dentry *new_dentry) 970 struct inode *new_dir, struct dentry *new_dentry)
971{ 971{
972 struct ubifs_info *c = old_dir->i_sb->s_fs_info; 972 struct ubifs_info *c = old_dir->i_sb->s_fs_info;
973 struct inode *old_inode = old_dentry->d_inode; 973 struct inode *old_inode = d_inode(old_dentry);
974 struct inode *new_inode = new_dentry->d_inode; 974 struct inode *new_inode = d_inode(new_dentry);
975 struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode); 975 struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode);
976 int err, release, sync = 0, move = (new_dir != old_dir); 976 int err, release, sync = 0, move = (new_dir != old_dir);
977 int is_dir = S_ISDIR(old_inode->i_mode); 977 int is_dir = S_ISDIR(old_inode->i_mode);
@@ -1136,7 +1136,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1136 struct kstat *stat) 1136 struct kstat *stat)
1137{ 1137{
1138 loff_t size; 1138 loff_t size;
1139 struct inode *inode = dentry->d_inode; 1139 struct inode *inode = d_inode(dentry);
1140 struct ubifs_inode *ui = ubifs_inode(inode); 1140 struct ubifs_inode *ui = ubifs_inode(inode);
1141 1141
1142 mutex_lock(&ui->ui_mutex); 1142 mutex_lock(&ui->ui_mutex);
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 3ba3fef64e9e..35efc103c39c 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1257,7 +1257,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1257int ubifs_setattr(struct dentry *dentry, struct iattr *attr) 1257int ubifs_setattr(struct dentry *dentry, struct iattr *attr)
1258{ 1258{
1259 int err; 1259 int err;
1260 struct inode *inode = dentry->d_inode; 1260 struct inode *inode = d_inode(dentry);
1261 struct ubifs_info *c = inode->i_sb->s_fs_info; 1261 struct ubifs_info *c = inode->i_sb->s_fs_info;
1262 1262
1263 dbg_gen("ino %lu, mode %#x, ia_valid %#x", 1263 dbg_gen("ino %lu, mode %#x, ia_valid %#x",
@@ -1302,7 +1302,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset,
1302 1302
1303static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) 1303static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd)
1304{ 1304{
1305 struct ubifs_inode *ui = ubifs_inode(dentry->d_inode); 1305 struct ubifs_inode *ui = ubifs_inode(d_inode(dentry));
1306 1306
1307 nd_set_link(nd, ui->data); 1307 nd_set_link(nd, ui->data);
1308 return NULL; 1308 return NULL;
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 90ae1a8439d9..0b9da5b6e0f9 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 3659b1934500..96f3448b6eb4 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 5dadad9960b9..7a95b8fed302 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -249,7 +249,7 @@ const struct file_operations udf_file_operations = {
249 249
250static int udf_setattr(struct dentry *dentry, struct iattr *attr) 250static int udf_setattr(struct dentry *dentry, struct iattr *attr)
251{ 251{
252 struct inode *inode = dentry->d_inode; 252 struct inode *inode = d_inode(dentry);
253 int error; 253 int error;
254 254
255 error = inode_change_ok(inode, attr); 255 error = inode_change_ok(inode, attr);
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 39661977c89c..5c03f0dfb98b 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -551,7 +551,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
551static int udf_add_nondir(struct dentry *dentry, struct inode *inode) 551static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
552{ 552{
553 struct udf_inode_info *iinfo = UDF_I(inode); 553 struct udf_inode_info *iinfo = UDF_I(inode);
554 struct inode *dir = dentry->d_parent->d_inode; 554 struct inode *dir = d_inode(dentry->d_parent);
555 struct udf_fileident_bh fibh; 555 struct udf_fileident_bh fibh;
556 struct fileIdentDesc cfi, *fi; 556 struct fileIdentDesc cfi, *fi;
557 int err; 557 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;
@@ -1038,8 +1038,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1038static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, 1038static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1039 struct inode *new_dir, struct dentry *new_dentry) 1039 struct inode *new_dir, struct dentry *new_dentry)
1040{ 1040{
1041 struct inode *old_inode = old_dentry->d_inode; 1041 struct inode *old_inode = d_inode(old_dentry);
1042 struct inode *new_inode = new_dentry->d_inode; 1042 struct inode *new_inode = d_inode(new_dentry);
1043 struct udf_fileident_bh ofibh, nfibh; 1043 struct udf_fileident_bh ofibh, nfibh;
1044 struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL; 1044 struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL;
1045 struct fileIdentDesc ocfi, ncfi; 1045 struct fileIdentDesc ocfi, ncfi;
@@ -1179,7 +1179,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
1179 struct fileIdentDesc cfi; 1179 struct fileIdentDesc cfi;
1180 struct udf_fileident_bh fibh; 1180 struct udf_fileident_bh fibh;
1181 1181
1182 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) 1182 if (!udf_find_entry(d_inode(child), &dotdot, &fibh, &cfi))
1183 return ERR_PTR(-EACCES); 1183 return ERR_PTR(-EACCES);
1184 1184
1185 if (fibh.sbh != fibh.ebh) 1185 if (fibh.sbh != fibh.ebh)
@@ -1187,7 +1187,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
1187 brelse(fibh.sbh); 1187 brelse(fibh.sbh);
1188 1188
1189 tloc = lelb_to_cpu(cfi.icb.extLocation); 1189 tloc = lelb_to_cpu(cfi.icb.extLocation);
1190 inode = udf_iget(child->d_inode->i_sb, &tloc); 1190 inode = udf_iget(d_inode(child)->i_sb, &tloc);
1191 if (IS_ERR(inode)) 1191 if (IS_ERR(inode))
1192 return ERR_CAST(inode); 1192 return ERR_CAST(inode);
1193 1193
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 8f9f854376c6..da82f1cb4b9b 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 5f4a396f5186..87f67c6b654c 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 2f1839e4dd1b..f4cd7204e236 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -304,7 +304,7 @@ xfs_vn_link(
304 struct inode *dir, 304 struct inode *dir,
305 struct dentry *dentry) 305 struct dentry *dentry)
306{ 306{
307 struct inode *inode = old_dentry->d_inode; 307 struct inode *inode = d_inode(old_dentry);
308 struct xfs_name name; 308 struct xfs_name name;
309 int error; 309 int error;
310 310
@@ -329,7 +329,7 @@ xfs_vn_unlink(
329 329
330 xfs_dentry_to_name(&name, dentry, 0); 330 xfs_dentry_to_name(&name, dentry, 0);
331 331
332 error = xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode)); 332 error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry)));
333 if (error) 333 if (error)
334 return error; 334 return error;
335 335
@@ -389,7 +389,7 @@ xfs_vn_rename(
389 struct dentry *ndentry, 389 struct dentry *ndentry,
390 unsigned int flags) 390 unsigned int flags)
391{ 391{
392 struct inode *new_inode = ndentry->d_inode; 392 struct inode *new_inode = d_inode(ndentry);
393 int omode = 0; 393 int omode = 0;
394 struct xfs_name oname; 394 struct xfs_name oname;
395 struct xfs_name nname; 395 struct xfs_name nname;
@@ -399,12 +399,12 @@ xfs_vn_rename(
399 399
400 /* if we are exchanging files, we need to set i_mode of both files */ 400 /* if we are exchanging files, we need to set i_mode of both files */
401 if (flags & RENAME_EXCHANGE) 401 if (flags & RENAME_EXCHANGE)
402 omode = ndentry->d_inode->i_mode; 402 omode = d_inode(ndentry)->i_mode;
403 403
404 xfs_dentry_to_name(&oname, odentry, omode); 404 xfs_dentry_to_name(&oname, odentry, omode);
405 xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); 405 xfs_dentry_to_name(&nname, ndentry, d_inode(odentry)->i_mode);
406 406
407 return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), 407 return xfs_rename(XFS_I(odir), &oname, XFS_I(d_inode(odentry)),
408 XFS_I(ndir), &nname, 408 XFS_I(ndir), &nname,
409 new_inode ? XFS_I(new_inode) : NULL, flags); 409 new_inode ? XFS_I(new_inode) : NULL, flags);
410} 410}
@@ -426,7 +426,7 @@ xfs_vn_follow_link(
426 if (!link) 426 if (!link)
427 goto out_err; 427 goto out_err;
428 428
429 error = xfs_readlink(XFS_I(dentry->d_inode), link); 429 error = xfs_readlink(XFS_I(d_inode(dentry)), link);
430 if (unlikely(error)) 430 if (unlikely(error))
431 goto out_kfree; 431 goto out_kfree;
432 432
@@ -446,7 +446,7 @@ xfs_vn_getattr(
446 struct dentry *dentry, 446 struct dentry *dentry,
447 struct kstat *stat) 447 struct kstat *stat)
448{ 448{
449 struct inode *inode = dentry->d_inode; 449 struct inode *inode = d_inode(dentry);
450 struct xfs_inode *ip = XFS_I(inode); 450 struct xfs_inode *ip = XFS_I(inode);
451 struct xfs_mount *mp = ip->i_mount; 451 struct xfs_mount *mp = ip->i_mount;
452 452
@@ -946,14 +946,14 @@ xfs_vn_setattr(
946 struct dentry *dentry, 946 struct dentry *dentry,
947 struct iattr *iattr) 947 struct iattr *iattr)
948{ 948{
949 struct xfs_inode *ip = XFS_I(dentry->d_inode); 949 struct xfs_inode *ip = XFS_I(d_inode(dentry));
950 int error; 950 int error;
951 951
952 if (iattr->ia_valid & ATTR_SIZE) { 952 if (iattr->ia_valid & ATTR_SIZE) {
953 uint iolock = XFS_IOLOCK_EXCL; 953 uint iolock = XFS_IOLOCK_EXCL;
954 954
955 xfs_ilock(ip, iolock); 955 xfs_ilock(ip, iolock);
956 error = xfs_break_layouts(dentry->d_inode, &iolock, true); 956 error = xfs_break_layouts(d_inode(dentry), &iolock, true);
957 if (!error) { 957 if (!error) {
958 xfs_ilock(ip, XFS_MMAPLOCK_EXCL); 958 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
959 iolock |= XFS_MMAPLOCK_EXCL; 959 iolock |= XFS_MMAPLOCK_EXCL;
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5f357ca97e76..858e1e62bbaa 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1048,7 +1048,7 @@ xfs_fs_statfs(
1048{ 1048{
1049 struct xfs_mount *mp = XFS_M(dentry->d_sb); 1049 struct xfs_mount *mp = XFS_M(dentry->d_sb);
1050 xfs_sb_t *sbp = &mp->m_sb; 1050 xfs_sb_t *sbp = &mp->m_sb;
1051 struct xfs_inode *ip = XFS_I(dentry->d_inode); 1051 struct xfs_inode *ip = XFS_I(d_inode(dentry));
1052 __uint64_t fakeinos, id; 1052 __uint64_t fakeinos, id;
1053 __uint64_t icount; 1053 __uint64_t icount;
1054 __uint64_t ifree; 1054 __uint64_t ifree;
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 /*