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

more file_inode() open-coded instances

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

Al Viro 6131ffaa 45e09bd5

+38 -45
+2 -4
arch/s390/hypfs/inode.c
··· 171 171 unsigned long nr_segs, loff_t offset) 172 172 { 173 173 int rc; 174 - struct super_block *sb; 175 - struct hypfs_sb_info *fs_info; 174 + struct super_block *sb = file_inode(iocb->ki_filp)->i_sb; 175 + struct hypfs_sb_info *fs_info = sb->s_fs_info; 176 176 size_t count = iov_length(iov, nr_segs); 177 177 178 - sb = iocb->ki_filp->f_path.dentry->d_inode->i_sb; 179 - fs_info = sb->s_fs_info; 180 178 /* 181 179 * Currently we only allow one update per second for two reasons: 182 180 * 1. diag 204 is VERY expensive
+4 -5
arch/x86/kernel/msr.c
··· 71 71 u32 __user *tmp = (u32 __user *) buf; 72 72 u32 data[2]; 73 73 u32 reg = *ppos; 74 - int cpu = iminor(file->f_path.dentry->d_inode); 74 + int cpu = iminor(file_inode(file)); 75 75 int err = 0; 76 76 ssize_t bytes = 0; 77 77 ··· 99 99 const u32 __user *tmp = (const u32 __user *)buf; 100 100 u32 data[2]; 101 101 u32 reg = *ppos; 102 - int cpu = iminor(file->f_path.dentry->d_inode); 102 + int cpu = iminor(file_inode(file)); 103 103 int err = 0; 104 104 ssize_t bytes = 0; 105 105 ··· 125 125 { 126 126 u32 __user *uregs = (u32 __user *)arg; 127 127 u32 regs[8]; 128 - int cpu = iminor(file->f_path.dentry->d_inode); 128 + int cpu = iminor(file_inode(file)); 129 129 int err; 130 130 131 131 switch (ioc) { ··· 171 171 172 172 static int msr_open(struct inode *inode, struct file *file) 173 173 { 174 - unsigned int cpu; 174 + unsigned int cpu = iminor(file_inode(file)); 175 175 struct cpuinfo_x86 *c; 176 176 177 177 if (!capable(CAP_SYS_RAWIO)) 178 178 return -EPERM; 179 179 180 - cpu = iminor(file->f_path.dentry->d_inode); 181 180 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) 182 181 return -ENXIO; /* No such CPU */ 183 182
+7 -7
drivers/staging/comedi/comedi_fops.c
··· 580 580 struct comedi_devinfo __user *arg, 581 581 struct file *file) 582 582 { 583 - const unsigned minor = iminor(file->f_dentry->d_inode); 583 + const unsigned minor = iminor(file_inode(file)); 584 584 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 585 585 struct comedi_subdevice *s; 586 586 struct comedi_devinfo devinfo; ··· 1615 1615 static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, 1616 1616 unsigned long arg) 1617 1617 { 1618 - const unsigned minor = iminor(file->f_dentry->d_inode); 1618 + const unsigned minor = iminor(file_inode(file)); 1619 1619 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 1620 1620 struct comedi_device *dev = comedi_dev_from_file_info(info); 1621 1621 int rc; ··· 1743 1743 1744 1744 static int comedi_mmap(struct file *file, struct vm_area_struct *vma) 1745 1745 { 1746 - const unsigned minor = iminor(file->f_dentry->d_inode); 1746 + const unsigned minor = iminor(file_inode(file)); 1747 1747 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 1748 1748 struct comedi_device *dev = comedi_dev_from_file_info(info); 1749 1749 struct comedi_subdevice *s; ··· 1823 1823 static unsigned int comedi_poll(struct file *file, poll_table *wait) 1824 1824 { 1825 1825 unsigned int mask = 0; 1826 - const unsigned minor = iminor(file->f_dentry->d_inode); 1826 + const unsigned minor = iminor(file_inode(file)); 1827 1827 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 1828 1828 struct comedi_device *dev = comedi_dev_from_file_info(info); 1829 1829 struct comedi_subdevice *s; ··· 1869 1869 struct comedi_async *async; 1870 1870 int n, m, count = 0, retval = 0; 1871 1871 DECLARE_WAITQUEUE(wait, current); 1872 - const unsigned minor = iminor(file->f_dentry->d_inode); 1872 + const unsigned minor = iminor(file_inode(file)); 1873 1873 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 1874 1874 struct comedi_device *dev = comedi_dev_from_file_info(info); 1875 1875 ··· 1964 1964 struct comedi_async *async; 1965 1965 int n, m, count = 0, retval = 0; 1966 1966 DECLARE_WAITQUEUE(wait, current); 1967 - const unsigned minor = iminor(file->f_dentry->d_inode); 1967 + const unsigned minor = iminor(file_inode(file)); 1968 1968 struct comedi_file_info *info = comedi_file_info_from_minor(minor); 1969 1969 struct comedi_device *dev = comedi_dev_from_file_info(info); 1970 1970 ··· 2133 2133 2134 2134 static int comedi_fasync(int fd, struct file *file, int on) 2135 2135 { 2136 - const unsigned minor = iminor(file->f_dentry->d_inode); 2136 + const unsigned minor = iminor(file_inode(file)); 2137 2137 struct comedi_device *dev = comedi_dev_from_minor(minor); 2138 2138 2139 2139 if (!dev)
+6 -10
drivers/tty/tty_io.c
··· 960 960 loff_t *ppos) 961 961 { 962 962 int i; 963 - struct inode *inode = file->f_path.dentry->d_inode; 964 963 struct tty_struct *tty = file_tty(file); 965 964 struct tty_ldisc *ld; 966 965 967 - if (tty_paranoia_check(tty, inode, "tty_read")) 966 + if (tty_paranoia_check(tty, file_inode(file), "tty_read")) 968 967 return -EIO; 969 968 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags))) 970 969 return -EIO; ··· 1131 1132 static ssize_t tty_write(struct file *file, const char __user *buf, 1132 1133 size_t count, loff_t *ppos) 1133 1134 { 1134 - struct inode *inode = file->f_path.dentry->d_inode; 1135 1135 struct tty_struct *tty = file_tty(file); 1136 1136 struct tty_ldisc *ld; 1137 1137 ssize_t ret; 1138 1138 1139 - if (tty_paranoia_check(tty, inode, "tty_write")) 1139 + if (tty_paranoia_check(tty, file_inode(file), "tty_write")) 1140 1140 return -EIO; 1141 1141 if (!tty || !tty->ops->write || 1142 1142 (test_bit(TTY_IO_ERROR, &tty->flags))) ··· 2045 2047 struct tty_ldisc *ld; 2046 2048 int ret = 0; 2047 2049 2048 - if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll")) 2050 + if (tty_paranoia_check(tty, file_inode(filp), "tty_poll")) 2049 2051 return 0; 2050 2052 2051 2053 ld = tty_ldisc_ref_wait(tty); ··· 2061 2063 unsigned long flags; 2062 2064 int retval = 0; 2063 2065 2064 - if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) 2066 + if (tty_paranoia_check(tty, file_inode(filp), "tty_fasync")) 2065 2067 goto out; 2066 2068 2067 2069 retval = fasync_helper(fd, filp, on, &tty->fasync); ··· 2635 2637 void __user *p = (void __user *)arg; 2636 2638 int retval; 2637 2639 struct tty_ldisc *ld; 2638 - struct inode *inode = file->f_dentry->d_inode; 2639 2640 2640 - if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2641 + if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl")) 2641 2642 return -EINVAL; 2642 2643 2643 2644 real_tty = tty_pair_get_tty(tty); ··· 2777 2780 static long tty_compat_ioctl(struct file *file, unsigned int cmd, 2778 2781 unsigned long arg) 2779 2782 { 2780 - struct inode *inode = file->f_dentry->d_inode; 2781 2783 struct tty_struct *tty = file_tty(file); 2782 2784 struct tty_ldisc *ld; 2783 2785 int retval = -ENOIOCTLCMD; 2784 2786 2785 - if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2787 + if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl")) 2786 2788 return -EINVAL; 2787 2789 2788 2790 if (tty->ops->compat_ioctl) {
+1 -1
fs/ext4/indirect.c
··· 1606 1606 1607 1607 int ext4_ind_punch_hole(struct file *file, loff_t offset, loff_t length) 1608 1608 { 1609 - struct inode *inode = file->f_path.dentry->d_inode; 1609 + struct inode *inode = file_inode(file); 1610 1610 struct super_block *sb = inode->i_sb; 1611 1611 ext4_lblk_t first_block, stop_block; 1612 1612 struct address_space *mapping = inode->i_mapping;
+3 -3
fs/f2fs/file.c
··· 29 29 struct vm_fault *vmf) 30 30 { 31 31 struct page *page = vmf->page; 32 - struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 32 + struct inode *inode = file_inode(vma->vm_file); 33 33 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 34 34 block_t old_blk_addr; 35 35 struct dnode_of_data dn; ··· 544 544 static long f2fs_fallocate(struct file *file, int mode, 545 545 loff_t offset, loff_t len) 546 546 { 547 - struct inode *inode = file->f_path.dentry->d_inode; 547 + struct inode *inode = file_inode(file); 548 548 long ret; 549 549 550 550 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) ··· 577 577 578 578 long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 579 579 { 580 - struct inode *inode = filp->f_dentry->d_inode; 580 + struct inode *inode = file_inode(filp); 581 581 struct f2fs_inode_info *fi = F2FS_I(inode); 582 582 unsigned int flags; 583 583 int ret;
+1 -1
fs/fuse/dev.c
··· 532 532 533 533 void fuse_force_forget(struct file *file, u64 nodeid) 534 534 { 535 - struct inode *inode = file->f_path.dentry->d_inode; 535 + struct inode *inode = file_inode(file); 536 536 struct fuse_conn *fc = get_fuse_conn(inode); 537 537 struct fuse_req *req; 538 538 struct fuse_forget_in inarg;
+12 -12
fs/fuse/file.c
··· 355 355 356 356 static int fuse_flush(struct file *file, fl_owner_t id) 357 357 { 358 - struct inode *inode = file->f_path.dentry->d_inode; 358 + struct inode *inode = file_inode(file); 359 359 struct fuse_conn *fc = get_fuse_conn(inode); 360 360 struct fuse_file *ff = file->private_data; 361 361 struct fuse_req *req; ··· 1215 1215 unsigned long nr_segs, loff_t *ppos) 1216 1216 { 1217 1217 ssize_t res; 1218 - struct inode *inode = file->f_path.dentry->d_inode; 1218 + struct inode *inode = file_inode(file); 1219 1219 1220 1220 if (is_bad_inode(inode)) 1221 1221 return -EIO; ··· 1238 1238 static ssize_t __fuse_direct_write(struct file *file, const struct iovec *iov, 1239 1239 unsigned long nr_segs, loff_t *ppos) 1240 1240 { 1241 - struct inode *inode = file->f_path.dentry->d_inode; 1241 + struct inode *inode = file_inode(file); 1242 1242 size_t count = iov_length(iov, nr_segs); 1243 1243 ssize_t res; 1244 1244 ··· 1258 1258 size_t count, loff_t *ppos) 1259 1259 { 1260 1260 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; 1261 - struct inode *inode = file->f_path.dentry->d_inode; 1261 + struct inode *inode = file_inode(file); 1262 1262 ssize_t res; 1263 1263 1264 1264 if (is_bad_inode(inode)) ··· 1485 1485 static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma) 1486 1486 { 1487 1487 if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) { 1488 - struct inode *inode = file->f_dentry->d_inode; 1488 + struct inode *inode = file_inode(file); 1489 1489 struct fuse_conn *fc = get_fuse_conn(inode); 1490 1490 struct fuse_inode *fi = get_fuse_inode(inode); 1491 1491 struct fuse_file *ff = file->private_data; ··· 1543 1543 const struct file_lock *fl, int opcode, pid_t pid, 1544 1544 int flock) 1545 1545 { 1546 - struct inode *inode = file->f_path.dentry->d_inode; 1546 + struct inode *inode = file_inode(file); 1547 1547 struct fuse_conn *fc = get_fuse_conn(inode); 1548 1548 struct fuse_file *ff = file->private_data; 1549 1549 struct fuse_lk_in *arg = &req->misc.lk_in; ··· 1565 1565 1566 1566 static int fuse_getlk(struct file *file, struct file_lock *fl) 1567 1567 { 1568 - struct inode *inode = file->f_path.dentry->d_inode; 1568 + struct inode *inode = file_inode(file); 1569 1569 struct fuse_conn *fc = get_fuse_conn(inode); 1570 1570 struct fuse_req *req; 1571 1571 struct fuse_lk_out outarg; ··· 1590 1590 1591 1591 static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) 1592 1592 { 1593 - struct inode *inode = file->f_path.dentry->d_inode; 1593 + struct inode *inode = file_inode(file); 1594 1594 struct fuse_conn *fc = get_fuse_conn(inode); 1595 1595 struct fuse_req *req; 1596 1596 int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; ··· 1622 1622 1623 1623 static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl) 1624 1624 { 1625 - struct inode *inode = file->f_path.dentry->d_inode; 1625 + struct inode *inode = file_inode(file); 1626 1626 struct fuse_conn *fc = get_fuse_conn(inode); 1627 1627 int err; 1628 1628 ··· 1645 1645 1646 1646 static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl) 1647 1647 { 1648 - struct inode *inode = file->f_path.dentry->d_inode; 1648 + struct inode *inode = file_inode(file); 1649 1649 struct fuse_conn *fc = get_fuse_conn(inode); 1650 1650 int err; 1651 1651 ··· 1702 1702 static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence) 1703 1703 { 1704 1704 loff_t retval; 1705 - struct inode *inode = file->f_path.dentry->d_inode; 1705 + struct inode *inode = file_inode(file); 1706 1706 1707 1707 /* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */ 1708 1708 if (whence == SEEK_CUR || whence == SEEK_SET) ··· 2079 2079 long fuse_ioctl_common(struct file *file, unsigned int cmd, 2080 2080 unsigned long arg, unsigned int flags) 2081 2081 { 2082 - struct inode *inode = file->f_dentry->d_inode; 2082 + struct inode *inode = file_inode(file); 2083 2083 struct fuse_conn *fc = get_fuse_conn(inode); 2084 2084 2085 2085 if (!fuse_allow_current_process(fc))
+1 -1
fs/seq_file.c
··· 339 339 /** 340 340 * seq_release - free the structures associated with sequential file. 341 341 * @file: file in question 342 - * @inode: file->f_path.dentry->d_inode 342 + * @inode: its inode 343 343 * 344 344 * Frees the structures associated with sequential file; can be used 345 345 * as ->f_op->release() if you don't have private data to destroy.
+1 -1
kernel/futex.c
··· 226 226 * Returns a negative error code or 0 227 227 * The key words are stored in *key on success. 228 228 * 229 - * For shared mappings, it's (page->index, vma->vm_file->f_path.dentry->d_inode, 229 + * For shared mappings, it's (page->index, file_inode(vma->vm_file), 230 230 * offset_within_page). For private mappings, it's (uaddr, current->mm). 231 231 * We can usually work out the index without swapping in the page. 232 232 *