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

Merge tag 'pull-file_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull file_inode() updates from Al Vrio:
"whack-a-mole: cropped up open-coded file_inode() uses..."

* tag 'pull-file_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
orangefs: use ->f_mapping
_nfs42_proc_copy(): use ->f_mapping instead of file_inode()->i_mapping
dma_buf: no need to bother with file_inode()->i_mapping
nfs_finish_open(): don't open-code file_inode()
bprm_fill_uid(): don't open-code file_inode()
sgx: use ->f_mapping...
exfat_iterate(): don't open-code file_inode(file)
ibmvmc: don't open-code file_inode()

+13 -15
+1 -2
arch/x86/kernel/cpu/sgx/encl.c
··· 912 912 static struct page *sgx_encl_get_backing_page(struct sgx_encl *encl, 913 913 pgoff_t index) 914 914 { 915 - struct inode *inode = encl->backing->f_path.dentry->d_inode; 916 - struct address_space *mapping = inode->i_mapping; 915 + struct address_space *mapping = encl->backing->f_mapping; 917 916 gfp_t gfpmask = mapping_gfp_mask(mapping); 918 917 919 918 return shmem_read_mapping_page_gfp(mapping, index, gfpmask);
+1 -1
drivers/dma-buf/udmabuf.c
··· 213 213 memfd = fget(list[i].memfd); 214 214 if (!memfd) 215 215 goto err; 216 - mapping = file_inode(memfd)->i_mapping; 216 + mapping = memfd->f_mapping; 217 217 if (!shmem_mapping(mapping) && !is_file_hugepages(memfd)) 218 218 goto err; 219 219 seals = memfd_fcntl(memfd, F_GET_SEALS, 0);
+4 -2
drivers/misc/ibmvmc.c
··· 1039 1039 static ssize_t ibmvmc_write(struct file *file, const char *buffer, 1040 1040 size_t count, loff_t *ppos) 1041 1041 { 1042 + struct inode *inode; 1042 1043 struct ibmvmc_buffer *vmc_buffer; 1043 1044 struct ibmvmc_file_session *session; 1044 1045 struct crq_server_adapter *adapter; ··· 1123 1122 if (p == buffer) 1124 1123 goto out; 1125 1124 1126 - file->f_path.dentry->d_inode->i_mtime = current_time(file_inode(file)); 1127 - mark_inode_dirty(file->f_path.dentry->d_inode); 1125 + inode = file_inode(file); 1126 + inode->i_mtime = current_time(inode); 1127 + mark_inode_dirty(inode); 1128 1128 1129 1129 dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n", 1130 1130 (unsigned long)file, (unsigned long)count);
+1 -2
fs/exec.c
··· 1587 1587 { 1588 1588 /* Handle suid and sgid on files */ 1589 1589 struct user_namespace *mnt_userns; 1590 - struct inode *inode; 1590 + struct inode *inode = file_inode(file); 1591 1591 unsigned int mode; 1592 1592 kuid_t uid; 1593 1593 kgid_t gid; ··· 1598 1598 if (task_no_new_privs(current)) 1599 1599 return; 1600 1600 1601 - inode = file->f_path.dentry->d_inode; 1602 1601 mode = READ_ONCE(inode->i_mode); 1603 1602 if (!(mode & (S_ISUID|S_ISGID))) 1604 1603 return;
+3 -3
fs/exfat/dir.c
··· 212 212 213 213 /* skip iterating emit_dots when dir is empty */ 214 214 #define ITER_POS_FILLED_DOTS (2) 215 - static int exfat_iterate(struct file *filp, struct dir_context *ctx) 215 + static int exfat_iterate(struct file *file, struct dir_context *ctx) 216 216 { 217 - struct inode *inode = filp->f_path.dentry->d_inode; 217 + struct inode *inode = file_inode(file); 218 218 struct super_block *sb = inode->i_sb; 219 219 struct inode *tmp; 220 220 struct exfat_dir_entry de; ··· 228 228 mutex_lock(&EXFAT_SB(sb)->s_lock); 229 229 230 230 cpos = ctx->pos; 231 - if (!dir_emit_dots(filp, ctx)) 231 + if (!dir_emit_dots(file, ctx)) 232 232 goto unlock; 233 233 234 234 if (ctx->pos == ITER_POS_FILLED_DOTS) {
+1 -1
fs/nfs/dir.c
··· 2022 2022 err = finish_open(file, dentry, do_open); 2023 2023 if (err) 2024 2024 goto out; 2025 - if (S_ISREG(file->f_path.dentry->d_inode->i_mode)) 2025 + if (S_ISREG(file_inode(file)->i_mode)) 2026 2026 nfs_file_set_open_context(file, ctx); 2027 2027 else 2028 2028 err = -EOPENSTALE;
+1 -1
fs/nfs/nfs42proc.c
··· 341 341 return status; 342 342 } 343 343 } 344 - status = nfs_filemap_write_and_wait_range(file_inode(src)->i_mapping, 344 + status = nfs_filemap_write_and_wait_range(src->f_mapping, 345 345 pos_src, pos_src + (loff_t)count - 1); 346 346 if (status) 347 347 return status;
+1 -3
fs/orangefs/file.c
··· 417 417 * readahead cache (if any); this forces an expensive refresh of 418 418 * data for the next caller of mmap (or 'get_block' accesses) 419 419 */ 420 - if (file_inode(file) && 421 - file_inode(file)->i_mapping && 422 - mapping_nrpages(&file_inode(file)->i_data)) { 420 + if (mapping_nrpages(file->f_mapping)) { 423 421 if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { 424 422 gossip_debug(GOSSIP_INODE_DEBUG, 425 423 "calling flush_racache on %pU\n",