Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

don't bother with ->d_inode->i_sb - it's always equal to ->d_sb

... and neither can ever be NULL

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro fc64005c 04c57f45

+41 -50
+1 -1
fs/9p/vfs_inode.c
··· 1071 1071 if (IS_ERR(st)) 1072 1072 return PTR_ERR(st); 1073 1073 1074 - v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb); 1074 + v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb); 1075 1075 generic_fillattr(d_inode(dentry), stat); 1076 1076 1077 1077 p9stat_free(st);
+3 -3
fs/btrfs/tree-log.c
··· 4851 4851 goto out; 4852 4852 4853 4853 if (!S_ISDIR(inode->i_mode)) { 4854 - if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 4854 + if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) 4855 4855 goto out; 4856 4856 inode = d_inode(parent); 4857 4857 } ··· 4872 4872 break; 4873 4873 } 4874 4874 4875 - if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 4875 + if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) 4876 4876 break; 4877 4877 4878 4878 if (IS_ROOT(parent)) ··· 5285 5285 } 5286 5286 5287 5287 while (1) { 5288 - if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 5288 + if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) 5289 5289 break; 5290 5290 5291 5291 inode = d_inode(parent);
+1 -1
fs/cifs/cifs_dfs_ref.c
··· 302 302 if (full_path == NULL) 303 303 goto cdda_exit; 304 304 305 - cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb); 305 + cifs_sb = CIFS_SB(mntpt->d_sb); 306 306 tlink = cifs_sb_tlink(cifs_sb); 307 307 if (IS_ERR(tlink)) { 308 308 mnt = ERR_CAST(tlink);
+1 -2
fs/cifs/inode.c
··· 2418 2418 int 2419 2419 cifs_setattr(struct dentry *direntry, struct iattr *attrs) 2420 2420 { 2421 - struct inode *inode = d_inode(direntry); 2422 - struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 2421 + struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); 2423 2422 struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); 2424 2423 2425 2424 if (pTcon->unix_ext)
+1 -1
fs/cifs/readdir.c
··· 78 78 { 79 79 struct dentry *dentry, *alias; 80 80 struct inode *inode; 81 - struct super_block *sb = d_inode(parent)->i_sb; 81 + struct super_block *sb = parent->d_sb; 82 82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 83 83 84 84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
+4 -12
fs/cifs/xattr.c
··· 52 52 return -EIO; 53 53 if (d_really_is_negative(direntry)) 54 54 return -EIO; 55 - sb = d_inode(direntry)->i_sb; 56 - if (sb == NULL) 57 - return -EIO; 55 + sb = direntry->d_sb; 58 56 59 57 cifs_sb = CIFS_SB(sb); 60 58 tlink = cifs_sb_tlink(cifs_sb); ··· 111 113 return -EIO; 112 114 if (d_really_is_negative(direntry)) 113 115 return -EIO; 114 - sb = d_inode(direntry)->i_sb; 115 - if (sb == NULL) 116 - return -EIO; 116 + sb = direntry->d_sb; 117 117 118 118 cifs_sb = CIFS_SB(sb); 119 119 tlink = cifs_sb_tlink(cifs_sb); ··· 244 248 return -EIO; 245 249 if (d_really_is_negative(direntry)) 246 250 return -EIO; 247 - sb = d_inode(direntry)->i_sb; 248 - if (sb == NULL) 249 - return -EIO; 251 + sb = direntry->d_sb; 250 252 251 253 cifs_sb = CIFS_SB(sb); 252 254 tlink = cifs_sb_tlink(cifs_sb); ··· 378 384 return -EIO; 379 385 if (d_really_is_negative(direntry)) 380 386 return -EIO; 381 - sb = d_inode(direntry)->i_sb; 382 - if (sb == NULL) 383 - return -EIO; 387 + sb = direntry->d_sb; 384 388 385 389 cifs_sb = CIFS_SB(sb); 386 390 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
+1 -1
fs/efs/namei.c
··· 113 113 114 114 ino = efs_find_entry(d_inode(child), "..", 2); 115 115 if (ino) 116 - parent = d_obtain_alias(efs_iget(d_inode(child)->i_sb, ino)); 116 + parent = d_obtain_alias(efs_iget(child->d_sb, ino)); 117 117 118 118 return parent; 119 119 }
+1 -1
fs/exofs/super.c
··· 958 958 if (!ino) 959 959 return ERR_PTR(-ESTALE); 960 960 961 - return d_obtain_alias(exofs_iget(d_inode(child)->i_sb, ino)); 961 + return d_obtain_alias(exofs_iget(child->d_sb, ino)); 962 962 } 963 963 964 964 static struct inode *exofs_nfs_get_inode(struct super_block *sb,
+1 -1
fs/ext2/namei.c
··· 82 82 unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot); 83 83 if (!ino) 84 84 return ERR_PTR(-ENOENT); 85 - return d_obtain_alias(ext2_iget(d_inode(child)->i_sb, ino)); 85 + return d_obtain_alias(ext2_iget(child->d_sb, ino)); 86 86 } 87 87 88 88 /*
+2 -2
fs/ext4/namei.c
··· 1638 1638 ino = le32_to_cpu(de->inode); 1639 1639 brelse(bh); 1640 1640 1641 - if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) { 1641 + if (!ext4_valid_inum(child->d_sb, ino)) { 1642 1642 EXT4_ERROR_INODE(d_inode(child), 1643 1643 "bad parent inode number: %u", ino); 1644 1644 return ERR_PTR(-EFSCORRUPTED); 1645 1645 } 1646 1646 1647 - return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino)); 1647 + return d_obtain_alias(ext4_iget_normal(child->d_sb, ino)); 1648 1648 } 1649 1649 1650 1650 /*
+1 -1
fs/f2fs/namei.c
··· 202 202 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot); 203 203 if (!ino) 204 204 return ERR_PTR(-ENOENT); 205 - return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino)); 205 + return d_obtain_alias(f2fs_iget(child->d_sb, ino)); 206 206 } 207 207 208 208 static int __recover_dot_dentries(struct inode *dir, nid_t pino)
+1 -1
fs/gfs2/ops_fstype.c
··· 1360 1360 return ERR_PTR(error); 1361 1361 } 1362 1362 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, 1363 - d_inode(path.dentry)->i_sb->s_bdev); 1363 + path.dentry->d_sb->s_bdev); 1364 1364 path_put(&path); 1365 1365 if (IS_ERR(s)) { 1366 1366 pr_warn("gfs2 mount does not exist\n");
+1 -1
fs/gfs2/super.c
··· 1176 1176 1177 1177 static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf) 1178 1178 { 1179 - struct super_block *sb = d_inode(dentry)->i_sb; 1179 + struct super_block *sb = dentry->d_sb; 1180 1180 struct gfs2_sbd *sdp = sb->s_fs_info; 1181 1181 struct gfs2_statfs_change_host sc; 1182 1182 int error;
+1 -1
fs/jffs2/dir.c
··· 241 241 242 242 static 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(d_inode(old_dentry)->i_sb); 244 + struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dentry->d_sb); 245 245 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry)); 246 246 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 247 247 int ret;
+1 -1
fs/jffs2/super.c
··· 147 147 JFFS2_DEBUG("Parent of directory ino #%u is #%u\n", 148 148 f->inocache->ino, pino); 149 149 150 - return d_obtain_alias(jffs2_iget(d_inode(child)->i_sb, pino)); 150 + return d_obtain_alias(jffs2_iget(child->d_sb, pino)); 151 151 } 152 152 153 153 static const struct export_operations jffs2_export_ops = {
+1 -1
fs/jfs/namei.c
··· 1524 1524 parent_ino = 1525 1525 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot); 1526 1526 1527 - return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino)); 1527 + return d_obtain_alias(jfs_iget(dentry->d_sb, parent_ino)); 1528 1528 } 1529 1529 1530 1530 const struct inode_operations jfs_dir_inode_operations = {
+2 -2
fs/namei.c
··· 2653 2653 return NULL; 2654 2654 } 2655 2655 2656 - mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex); 2656 + mutex_lock(&p1->d_sb->s_vfs_rename_mutex); 2657 2657 2658 2658 p = d_ancestor(p2, p1); 2659 2659 if (p) { ··· 2680 2680 inode_unlock(p1->d_inode); 2681 2681 if (p1 != p2) { 2682 2682 inode_unlock(p2->d_inode); 2683 - mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); 2683 + mutex_unlock(&p1->d_sb->s_vfs_rename_mutex); 2684 2684 } 2685 2685 } 2686 2686 EXPORT_SYMBOL(unlock_rename);
+1 -1
fs/nfs/direct.c
··· 396 396 static void nfs_direct_readpage_release(struct nfs_page *req) 397 397 { 398 398 dprintk("NFS: direct read done (%s/%llu %d@%lld)\n", 399 - d_inode(req->wb_context->dentry)->i_sb->s_id, 399 + req->wb_context->dentry->d_sb->s_id, 400 400 (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)), 401 401 req->wb_bytes, 402 402 (long long)req_offset(req));
+2 -2
fs/nfsd/nfs3proc.c
··· 552 552 * different read/write sizes for file systems known to have 553 553 * problems with large blocks */ 554 554 if (nfserr == 0) { 555 - struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; 555 + struct super_block *sb = argp->fh.fh_dentry->d_sb; 556 556 557 557 /* Note that we don't care for remote fs's here */ 558 558 if (sb->s_magic == MSDOS_SUPER_MAGIC) { ··· 588 588 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); 589 589 590 590 if (nfserr == 0) { 591 - struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; 591 + struct super_block *sb = argp->fh.fh_dentry->d_sb; 592 592 593 593 /* Note that we don't care for remote fs's here */ 594 594 switch (sb->s_magic) {
+1 -1
fs/nfsd/nfs3xdr.c
··· 146 146 default: 147 147 case FSIDSOURCE_DEV: 148 148 p = xdr_encode_hyper(p, (u64)huge_encode_dev 149 - (d_inode(fhp->fh_dentry)->i_sb->s_dev)); 149 + (fhp->fh_dentry->d_sb->s_dev)); 150 150 break; 151 151 case FSIDSOURCE_FSID: 152 152 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
+1 -1
fs/nfsd/nfsfh.c
··· 426 426 427 427 static struct super_block *exp_sb(struct svc_export *exp) 428 428 { 429 - return d_inode(exp->ex_path.dentry)->i_sb; 429 + return exp->ex_path.dentry->d_sb; 430 430 } 431 431 432 432 static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
+1 -1
fs/nilfs2/namei.c
··· 457 457 458 458 root = NILFS_I(d_inode(child))->i_root; 459 459 460 - inode = nilfs_iget(d_inode(child)->i_sb, root, ino); 460 + inode = nilfs_iget(child->d_sb, root, ino); 461 461 if (IS_ERR(inode)) 462 462 return ERR_CAST(inode); 463 463
+1 -1
fs/ocfs2/file.c
··· 1290 1290 struct kstat *stat) 1291 1291 { 1292 1292 struct inode *inode = d_inode(dentry); 1293 - struct super_block *sb = d_inode(dentry)->i_sb; 1293 + struct super_block *sb = dentry->d_sb; 1294 1294 struct ocfs2_super *osb = sb->s_fs_info; 1295 1295 int err; 1296 1296
+1 -1
fs/udf/namei.c
··· 1250 1250 brelse(fibh.sbh); 1251 1251 1252 1252 tloc = lelb_to_cpu(cfi.icb.extLocation); 1253 - inode = udf_iget(d_inode(child)->i_sb, &tloc); 1253 + inode = udf_iget(child->d_sb, &tloc); 1254 1254 if (IS_ERR(inode)) 1255 1255 return ERR_CAST(inode); 1256 1256
+1 -1
fs/ufs/super.c
··· 132 132 ino = ufs_inode_by_name(d_inode(child), &dot_dot); 133 133 if (!ino) 134 134 return ERR_PTR(-ENOENT); 135 - return d_obtain_alias(ufs_iget(d_inode(child)->i_sb, ino)); 135 + return d_obtain_alias(ufs_iget(child->d_sb, ino)); 136 136 } 137 137 138 138 static const struct export_operations ufs_export_ops = {
+3 -3
include/trace/events/ext4.h
··· 872 872 TP_fast_assign( 873 873 struct dentry *dentry = file->f_path.dentry; 874 874 875 - __entry->dev = d_inode(dentry)->i_sb->s_dev; 875 + __entry->dev = dentry->d_sb->s_dev; 876 876 __entry->ino = d_inode(dentry)->i_ino; 877 877 __entry->datasync = datasync; 878 878 __entry->parent = d_inode(dentry->d_parent)->i_ino; ··· 1451 1451 ), 1452 1452 1453 1453 TP_fast_assign( 1454 - __entry->dev = d_inode(dentry)->i_sb->s_dev; 1454 + __entry->dev = dentry->d_sb->s_dev; 1455 1455 __entry->ino = d_inode(dentry)->i_ino; 1456 1456 __entry->parent = parent->i_ino; 1457 1457 __entry->size = d_inode(dentry)->i_size; ··· 1475 1475 ), 1476 1476 1477 1477 TP_fast_assign( 1478 - __entry->dev = d_inode(dentry)->i_sb->s_dev; 1478 + __entry->dev = dentry->d_sb->s_dev; 1479 1479 __entry->ino = d_inode(dentry)->i_ino; 1480 1480 __entry->ret = ret; 1481 1481 ),
+1 -1
kernel/audit_watch.c
··· 367 367 inode_unlock(d_backing_inode(parent->dentry)); 368 368 if (d_is_positive(d)) { 369 369 /* update watch filter fields */ 370 - watch->dev = d_backing_inode(d)->i_sb->s_dev; 370 + watch->dev = d->d_sb->s_dev; 371 371 watch->ino = d_backing_inode(d)->i_ino; 372 372 } 373 373 dput(d);
+2 -2
security/integrity/evm/evm_main.c
··· 299 299 return 0; 300 300 301 301 /* exception for pseudo filesystems */ 302 - if (dentry->d_inode->i_sb->s_magic == TMPFS_MAGIC 303 - || dentry->d_inode->i_sb->s_magic == SYSFS_MAGIC) 302 + if (dentry->d_sb->s_magic == TMPFS_MAGIC 303 + || dentry->d_sb->s_magic == SYSFS_MAGIC) 304 304 return 0; 305 305 306 306 integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
+1 -1
security/selinux/hooks.c
··· 1316 1316 u32 *sid) 1317 1317 { 1318 1318 int rc; 1319 - struct super_block *sb = dentry->d_inode->i_sb; 1319 + struct super_block *sb = dentry->d_sb; 1320 1320 char *buffer, *path; 1321 1321 1322 1322 buffer = (char *)__get_free_page(GFP_KERNEL);
+1 -1
security/smack/smack_lsm.c
··· 1444 1444 * XATTR_NAME_SMACKIPOUT 1445 1445 */ 1446 1446 if (strcmp(name, XATTR_NAME_SMACK) == 0) { 1447 - struct super_block *sbp = d_backing_inode(dentry)->i_sb; 1447 + struct super_block *sbp = dentry->d_sb; 1448 1448 struct superblock_smack *sbsp = sbp->s_security; 1449 1449 1450 1450 isp->smk_inode = sbsp->smk_default;