]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
don't bother with ->d_inode->i_sb - it's always equal to ->d_sb
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 10 Apr 2016 05:33:30 +0000 (01:33 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 10 Apr 2016 21:11:51 +0000 (17:11 -0400)
... and neither can ever be NULL

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
30 files changed:
fs/9p/vfs_inode.c
fs/btrfs/tree-log.c
fs/cifs/cifs_dfs_ref.c
fs/cifs/inode.c
fs/cifs/readdir.c
fs/cifs/xattr.c
fs/efs/namei.c
fs/exofs/super.c
fs/ext2/namei.c
fs/ext4/namei.c
fs/f2fs/namei.c
fs/gfs2/ops_fstype.c
fs/gfs2/super.c
fs/jffs2/dir.c
fs/jffs2/super.c
fs/jfs/namei.c
fs/namei.c
fs/nfs/direct.c
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfsfh.c
fs/nilfs2/namei.c
fs/ocfs2/file.c
fs/udf/namei.c
fs/ufs/super.c
include/trace/events/ext4.h
kernel/audit_watch.c
security/integrity/evm/evm_main.c
security/selinux/hooks.c
security/smack/smack_lsm.c

index 3a08b3e6ff1d7a31a6b1ce6358b17e9350544da5..f4645c51526290e0d22a1e2589dbe21bf8e7148b 100644 (file)
@@ -1071,7 +1071,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        if (IS_ERR(st))
                return PTR_ERR(st);
 
-       v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb);
+       v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb);
        generic_fillattr(d_inode(dentry), stat);
 
        p9stat_free(st);
index 24d03c751149f56e484e32c3b1120dceb495b299..a82e20ecbee1672b4086bb4ffcbfedbe8274f438 100644 (file)
@@ -4851,7 +4851,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
                        goto out;
 
        if (!S_ISDIR(inode->i_mode)) {
-               if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
+               if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        goto out;
                inode = d_inode(parent);
        }
@@ -4872,7 +4872,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
                        break;
                }
 
-               if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
+               if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        break;
 
                if (IS_ROOT(parent))
@@ -5285,7 +5285,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
        }
 
        while (1) {
-               if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
+               if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        break;
 
                inode = d_inode(parent);
index e956cba94338184416c96925690f21493fc61ab6..94f2c8a9ae6d274202c9625fd88bdb73f7156190 100644 (file)
@@ -302,7 +302,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
        if (full_path == NULL)
                goto cdda_exit;
 
-       cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb);
+       cifs_sb = CIFS_SB(mntpt->d_sb);
        tlink = cifs_sb_tlink(cifs_sb);
        if (IS_ERR(tlink)) {
                mnt = ERR_CAST(tlink);
index aeb26dbfa1bf2dbfb2d111316064d240ef807336..4cd4705ebfadb8a62dc287c79ef567011f1d2dd7 100644 (file)
@@ -2418,8 +2418,7 @@ cifs_setattr_exit:
 int
 cifs_setattr(struct dentry *direntry, struct iattr *attrs)
 {
-       struct inode *inode = d_inode(direntry);
-       struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+       struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
        struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);
 
        if (pTcon->unix_ext)
index b30a4a6d98a0f002c235bf3128012aff06ba2bc3..4cfb4d9f88e275a1be60c2a93527e0b149733e31 100644 (file)
@@ -78,7 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
 {
        struct dentry *dentry, *alias;
        struct inode *inode;
-       struct super_block *sb = d_inode(parent)->i_sb;
+       struct super_block *sb = parent->d_sb;
        struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 
        cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
index f5dc2f0df4ad6f13b52e26ac8bd0bf12c5370ed8..612de933431f55c69f08f14ef509632e1dbf00f8 100644 (file)
@@ -52,9 +52,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
                return -EIO;
        if (d_really_is_negative(direntry))
                return -EIO;
-       sb = d_inode(direntry)->i_sb;
-       if (sb == NULL)
-               return -EIO;
+       sb = direntry->d_sb;
 
        cifs_sb = CIFS_SB(sb);
        tlink = cifs_sb_tlink(cifs_sb);
@@ -113,9 +111,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
                return -EIO;
        if (d_really_is_negative(direntry))
                return -EIO;
-       sb = d_inode(direntry)->i_sb;
-       if (sb == NULL)
-               return -EIO;
+       sb = direntry->d_sb;
 
        cifs_sb = CIFS_SB(sb);
        tlink = cifs_sb_tlink(cifs_sb);
@@ -248,9 +244,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
                return -EIO;
        if (d_really_is_negative(direntry))
                return -EIO;
-       sb = d_inode(direntry)->i_sb;
-       if (sb == NULL)
-               return -EIO;
+       sb = direntry->d_sb;
 
        cifs_sb = CIFS_SB(sb);
        tlink = cifs_sb_tlink(cifs_sb);
@@ -384,9 +378,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
                return -EIO;
        if (d_really_is_negative(direntry))
                return -EIO;
-       sb = d_inode(direntry)->i_sb;
-       if (sb == NULL)
-               return -EIO;
+       sb = direntry->d_sb;
 
        cifs_sb = CIFS_SB(sb);
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
index 40ba9cc41bf74d322c563c9db1ec66a2633a1020..d34a40edcdb27cd4bd98a9273e70180c240970e4 100644 (file)
@@ -113,7 +113,7 @@ struct dentry *efs_get_parent(struct dentry *child)
 
        ino = efs_find_entry(d_inode(child), "..", 2);
        if (ino)
-               parent = d_obtain_alias(efs_iget(d_inode(child)->i_sb, ino));
+               parent = d_obtain_alias(efs_iget(child->d_sb, ino));
 
        return parent;
 }
index 6658a50530a068fefb3ec22de0b7d961bc6dc869..192373653dfb0119ce55d7c294db0c47f6b9d135 100644 (file)
@@ -958,7 +958,7 @@ static struct dentry *exofs_get_parent(struct dentry *child)
        if (!ino)
                return ERR_PTR(-ESTALE);
 
-       return d_obtain_alias(exofs_iget(d_inode(child)->i_sb, ino));
+       return d_obtain_alias(exofs_iget(child->d_sb, ino));
 }
 
 static struct inode *exofs_nfs_get_inode(struct super_block *sb,
index 7a2be8f7f3c37a69135cab528b1244e51c5fc2a2..1a7eb49a115d39c52e560b387aaaf60a54ea602e 100644 (file)
@@ -82,7 +82,7 @@ struct dentry *ext2_get_parent(struct dentry *child)
        unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot);
        if (!ino)
                return ERR_PTR(-ENOENT);
-       return d_obtain_alias(ext2_iget(d_inode(child)->i_sb, ino));
+       return d_obtain_alias(ext2_iget(child->d_sb, ino));
 } 
 
 /*
index 48e4b8907826eca52a1e94e14bdfdb0fd2240c56..5611ec9348d7368abe2574b28899311375202118 100644 (file)
@@ -1638,13 +1638,13 @@ struct dentry *ext4_get_parent(struct dentry *child)
        ino = le32_to_cpu(de->inode);
        brelse(bh);
 
-       if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) {
+       if (!ext4_valid_inum(child->d_sb, ino)) {
                EXT4_ERROR_INODE(d_inode(child),
                                 "bad parent inode number: %u", ino);
                return ERR_PTR(-EFSCORRUPTED);
        }
 
-       return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino));
+       return d_obtain_alias(ext4_iget_normal(child->d_sb, ino));
 }
 
 /*
index 7876f10521019509bbae2888addea516e8cc1db2..db874ad3514a7a8bde574203315c2b48672ba122 100644 (file)
@@ -202,7 +202,7 @@ struct dentry *f2fs_get_parent(struct dentry *child)
        unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot);
        if (!ino)
                return ERR_PTR(-ENOENT);
-       return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino));
+       return d_obtain_alias(f2fs_iget(child->d_sb, ino));
 }
 
 static int __recover_dot_dentries(struct inode *dir, nid_t pino)
index 49b0bff18fe3a8d6164db404c7604bf6ff7a9f18..c09c63dcd7a2dc4f0883b05383a73022105f4f4f 100644 (file)
@@ -1360,7 +1360,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
                return ERR_PTR(error);
        }
        s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
-                d_inode(path.dentry)->i_sb->s_bdev);
+                path.dentry->d_sb->s_bdev);
        path_put(&path);
        if (IS_ERR(s)) {
                pr_warn("gfs2 mount does not exist\n");
index f8a0cd821290976bcf45846c11123bb31997bb61..9b2ff353e45f6e5317788536c1523f0f8d1c3f68 100644 (file)
@@ -1176,7 +1176,7 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s
 
 static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct super_block *sb = d_inode(dentry)->i_sb;
+       struct super_block *sb = dentry->d_sb;
        struct gfs2_sbd *sdp = sb->s_fs_info;
        struct gfs2_statfs_change_host sc;
        int error;
index 30c4c9ebb693faaecf249df4c913c01bbaa58f20..7a9579e03dbb2e5b194731b7a47dcca8501bc829 100644 (file)
@@ -241,7 +241,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
 
 static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry)
 {
-       struct jffs2_sb_info *c = JFFS2_SB_INFO(d_inode(old_dentry)->i_sb);
+       struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dentry->d_sb);
        struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry));
        struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
        int ret;
index 0a9a114bb9d1138b3060365986304cdb2df1428f..5ef21f4c4c77d12aa401eea175235cc85e0d6aa6 100644 (file)
@@ -147,7 +147,7 @@ static struct dentry *jffs2_get_parent(struct dentry *child)
        JFFS2_DEBUG("Parent of directory ino #%u is #%u\n",
                    f->inocache->ino, pino);
 
-       return d_obtain_alias(jffs2_iget(d_inode(child)->i_sb, pino));
+       return d_obtain_alias(jffs2_iget(child->d_sb, pino));
 }
 
 static const struct export_operations jffs2_export_ops = {
index 701f89370de7afb7d9a7402f1cbe4fe0d42b19fa..8a40941ac9a67009524cb1f4f9676d837de024d2 100644 (file)
@@ -1524,7 +1524,7 @@ struct dentry *jfs_get_parent(struct dentry *dentry)
        parent_ino =
                le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot);
 
-       return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino));
+       return d_obtain_alias(jfs_iget(dentry->d_sb, parent_ino));
 }
 
 const struct inode_operations jfs_dir_inode_operations = {
index 3498d53de26fe4e33aa0620f4cd5fcfb3f208149..c0d551fc43a0fba8049755e446aec601151cf387 100644 (file)
@@ -2653,7 +2653,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
                return NULL;
        }
 
-       mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
+       mutex_lock(&p1->d_sb->s_vfs_rename_mutex);
 
        p = d_ancestor(p2, p1);
        if (p) {
@@ -2680,7 +2680,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
        inode_unlock(p1->d_inode);
        if (p1 != p2) {
                inode_unlock(p2->d_inode);
-               mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
+               mutex_unlock(&p1->d_sb->s_vfs_rename_mutex);
        }
 }
 EXPORT_SYMBOL(unlock_rename);
index 7a0cfd3266e561620577bef3cf449171f10d9f92..e5daa932b82384729792c37196142a88891e633e 100644 (file)
@@ -396,7 +396,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
 static void nfs_direct_readpage_release(struct nfs_page *req)
 {
        dprintk("NFS: direct read done (%s/%llu %d@%lld)\n",
-               d_inode(req->wb_context->dentry)->i_sb->s_id,
+               req->wb_context->dentry->d_sb->s_id,
                (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)),
                req->wb_bytes,
                (long long)req_offset(req));
index 51c3b06e80365eadc9e810071e729e4669928f7f..d818e4ffd79f9acd01c5f08384cd99a1bfad7243 100644 (file)
@@ -552,7 +552,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle    *argp,
         * different read/write sizes for file systems known to have
         * problems with large blocks */
        if (nfserr == 0) {
-               struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb;
+               struct super_block *sb = argp->fh.fh_dentry->d_sb;
 
                /* Note that we don't care for remote fs's here */
                if (sb->s_magic == MSDOS_SUPER_MAGIC) {
@@ -588,7 +588,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle      *argp,
        nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
 
        if (nfserr == 0) {
-               struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb;
+               struct super_block *sb = argp->fh.fh_dentry->d_sb;
 
                /* Note that we don't care for remote fs's here */
                switch (sb->s_magic) {
index 2246454dec7654b3570f3c52bb5264567e32064c..93d5853f8c99b84e5b0c530eeaf044396699ecc6 100644 (file)
@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
        default:
        case FSIDSOURCE_DEV:
                p = xdr_encode_hyper(p, (u64)huge_encode_dev
-                                    (d_inode(fhp->fh_dentry)->i_sb->s_dev));
+                                    (fhp->fh_dentry->d_sb->s_dev));
                break;
        case FSIDSOURCE_FSID:
                p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
index c1681ce894c5e51f9c384e42c01fc6b440b6c70e..a8919444c46085545ef99bd9b4b72f984745557e 100644 (file)
@@ -426,7 +426,7 @@ static bool is_root_export(struct svc_export *exp)
 
 static struct super_block *exp_sb(struct svc_export *exp)
 {
-       return d_inode(exp->ex_path.dentry)->i_sb;
+       return exp->ex_path.dentry->d_sb;
 }
 
 static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
index 7ccdb961eea90d2ed313ef688feca1451112f5ba..38d67f3e25bc838468a56ba4b8488d3c4bb47bda 100644 (file)
@@ -457,7 +457,7 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
 
        root = NILFS_I(d_inode(child))->i_root;
 
-       inode = nilfs_iget(d_inode(child)->i_sb, root, ino);
+       inode = nilfs_iget(child->d_sb, root, ino);
        if (IS_ERR(inode))
                return ERR_CAST(inode);
 
index c18ab45f8d210ca2032864069b3701b948aa0cbd..c6fdcbd46bba428e4a3b486308e28c1b87c8a1e4 100644 (file)
@@ -1290,7 +1290,7 @@ int ocfs2_getattr(struct vfsmount *mnt,
                  struct kstat *stat)
 {
        struct inode *inode = d_inode(dentry);
-       struct super_block *sb = d_inode(dentry)->i_sb;
+       struct super_block *sb = dentry->d_sb;
        struct ocfs2_super *osb = sb->s_fs_info;
        int err;
 
index a2ba11eca9955ea873b25e93075273d2e7837ed8..c3e5c96793715da0feb1b4cc861e0f74d952e988 100644 (file)
@@ -1250,7 +1250,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
        brelse(fibh.sbh);
 
        tloc = lelb_to_cpu(cfi.icb.extLocation);
-       inode = udf_iget(d_inode(child)->i_sb, &tloc);
+       inode = udf_iget(child->d_sb, &tloc);
        if (IS_ERR(inode))
                return ERR_CAST(inode);
 
index 442fd52ebffe5aed31ee80a1da341d74a77e2fbd..f04ab232d08d452e5dfe9d0f32b1a8f9022072bd 100644 (file)
@@ -132,7 +132,7 @@ static struct dentry *ufs_get_parent(struct dentry *child)
        ino = ufs_inode_by_name(d_inode(child), &dot_dot);
        if (!ino)
                return ERR_PTR(-ENOENT);
-       return d_obtain_alias(ufs_iget(d_inode(child)->i_sb, ino));
+       return d_obtain_alias(ufs_iget(child->d_sb, ino));
 }
 
 static const struct export_operations ufs_export_ops = {
index 4e4b2fa786097c3638e78a6df76995e598a4cecf..09c71e9aaebf7d7bf83857294b9ec37a13d0920e 100644 (file)
@@ -872,7 +872,7 @@ TRACE_EVENT(ext4_sync_file_enter,
        TP_fast_assign(
                struct dentry *dentry = file->f_path.dentry;
 
-               __entry->dev            = d_inode(dentry)->i_sb->s_dev;
+               __entry->dev            = dentry->d_sb->s_dev;
                __entry->ino            = d_inode(dentry)->i_ino;
                __entry->datasync       = datasync;
                __entry->parent         = d_inode(dentry->d_parent)->i_ino;
@@ -1451,7 +1451,7 @@ TRACE_EVENT(ext4_unlink_enter,
        ),
 
        TP_fast_assign(
-               __entry->dev            = d_inode(dentry)->i_sb->s_dev;
+               __entry->dev            = dentry->d_sb->s_dev;
                __entry->ino            = d_inode(dentry)->i_ino;
                __entry->parent         = parent->i_ino;
                __entry->size           = d_inode(dentry)->i_size;
@@ -1475,7 +1475,7 @@ TRACE_EVENT(ext4_unlink_exit,
        ),
 
        TP_fast_assign(
-               __entry->dev            = d_inode(dentry)->i_sb->s_dev;
+               __entry->dev            = dentry->d_sb->s_dev;
                __entry->ino            = d_inode(dentry)->i_ino;
                __entry->ret            = ret;
        ),
index 3cf1c5978d39e4fbc7f44826017bbdd755f6c9df..d6709eb70970eb764bd14af1d1874fe5144b9053 100644 (file)
@@ -367,7 +367,7 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent)
        inode_unlock(d_backing_inode(parent->dentry));
        if (d_is_positive(d)) {
                /* update watch filter fields */
-               watch->dev = d_backing_inode(d)->i_sb->s_dev;
+               watch->dev = d->d_sb->s_dev;
                watch->ino = d_backing_inode(d)->i_ino;
        }
        dput(d);
index e6ea9d4b1de91a8d58e3ccab0fd3cef222ea6fcd..84c6d11fc096da3a5d5b695b9013b793b0f6d301 100644 (file)
@@ -299,8 +299,8 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
                        return 0;
 
                /* exception for pseudo filesystems */
-               if (dentry->d_inode->i_sb->s_magic == TMPFS_MAGIC
-                   || dentry->d_inode->i_sb->s_magic == SYSFS_MAGIC)
+               if (dentry->d_sb->s_magic == TMPFS_MAGIC
+                   || dentry->d_sb->s_magic == SYSFS_MAGIC)
                        return 0;
 
                integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
index 912deee3f01ef8da199b764b0679c98483676399..889cd59ca5a72a3f597b3250c6426a2c358fb5aa 100644 (file)
@@ -1316,7 +1316,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
                                 u32 *sid)
 {
        int rc;
-       struct super_block *sb = dentry->d_inode->i_sb;
+       struct super_block *sb = dentry->d_sb;
        char *buffer, *path;
 
        buffer = (char *)__get_free_page(GFP_KERNEL);
index 11f79013ae1f09c908072d42a0f85aa628710284..50bcca26c0b7020bec226c6e0b5ca4a264717ef6 100644 (file)
@@ -1444,7 +1444,7 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
         *      XATTR_NAME_SMACKIPOUT
         */
        if (strcmp(name, XATTR_NAME_SMACK) == 0) {
-               struct super_block *sbp = d_backing_inode(dentry)->i_sb;
+               struct super_block *sbp = dentry->d_sb;
                struct superblock_smack *sbsp = sbp->s_security;
 
                isp->smk_inode = sbsp->smk_default;