Commit ab296221 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 7a3353c5 4094d98e
...@@ -912,8 +912,7 @@ const cpumask_t *sgx_encl_cpumask(struct sgx_encl *encl) ...@@ -912,8 +912,7 @@ const cpumask_t *sgx_encl_cpumask(struct sgx_encl *encl)
static struct page *sgx_encl_get_backing_page(struct sgx_encl *encl, static struct page *sgx_encl_get_backing_page(struct sgx_encl *encl,
pgoff_t index) pgoff_t index)
{ {
struct inode *inode = encl->backing->f_path.dentry->d_inode; struct address_space *mapping = encl->backing->f_mapping;
struct address_space *mapping = inode->i_mapping;
gfp_t gfpmask = mapping_gfp_mask(mapping); gfp_t gfpmask = mapping_gfp_mask(mapping);
return shmem_read_mapping_page_gfp(mapping, index, gfpmask); return shmem_read_mapping_page_gfp(mapping, index, gfpmask);
......
...@@ -213,7 +213,7 @@ static long udmabuf_create(struct miscdevice *device, ...@@ -213,7 +213,7 @@ static long udmabuf_create(struct miscdevice *device,
memfd = fget(list[i].memfd); memfd = fget(list[i].memfd);
if (!memfd) if (!memfd)
goto err; goto err;
mapping = file_inode(memfd)->i_mapping; mapping = memfd->f_mapping;
if (!shmem_mapping(mapping) && !is_file_hugepages(memfd)) if (!shmem_mapping(mapping) && !is_file_hugepages(memfd))
goto err; goto err;
seals = memfd_fcntl(memfd, F_GET_SEALS, 0); seals = memfd_fcntl(memfd, F_GET_SEALS, 0);
......
...@@ -1039,6 +1039,7 @@ static unsigned int ibmvmc_poll(struct file *file, poll_table *wait) ...@@ -1039,6 +1039,7 @@ static unsigned int ibmvmc_poll(struct file *file, poll_table *wait)
static ssize_t ibmvmc_write(struct file *file, const char *buffer, static ssize_t ibmvmc_write(struct file *file, const char *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct inode *inode;
struct ibmvmc_buffer *vmc_buffer; struct ibmvmc_buffer *vmc_buffer;
struct ibmvmc_file_session *session; struct ibmvmc_file_session *session;
struct crq_server_adapter *adapter; struct crq_server_adapter *adapter;
...@@ -1122,8 +1123,9 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer, ...@@ -1122,8 +1123,9 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer,
if (p == buffer) if (p == buffer)
goto out; goto out;
file->f_path.dentry->d_inode->i_mtime = current_time(file_inode(file)); inode = file_inode(file);
mark_inode_dirty(file->f_path.dentry->d_inode); inode->i_mtime = current_time(inode);
mark_inode_dirty(inode);
dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n", dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n",
(unsigned long)file, (unsigned long)count); (unsigned long)file, (unsigned long)count);
......
...@@ -1587,7 +1587,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) ...@@ -1587,7 +1587,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file)
{ {
/* Handle suid and sgid on files */ /* Handle suid and sgid on files */
struct user_namespace *mnt_userns; struct user_namespace *mnt_userns;
struct inode *inode; struct inode *inode = file_inode(file);
unsigned int mode; unsigned int mode;
kuid_t uid; kuid_t uid;
kgid_t gid; kgid_t gid;
...@@ -1598,7 +1598,6 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) ...@@ -1598,7 +1598,6 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file)
if (task_no_new_privs(current)) if (task_no_new_privs(current))
return; return;
inode = file->f_path.dentry->d_inode;
mode = READ_ONCE(inode->i_mode); mode = READ_ONCE(inode->i_mode);
if (!(mode & (S_ISUID|S_ISGID))) if (!(mode & (S_ISUID|S_ISGID)))
return; return;
......
...@@ -212,9 +212,9 @@ static void exfat_free_namebuf(struct exfat_dentry_namebuf *nb) ...@@ -212,9 +212,9 @@ static void exfat_free_namebuf(struct exfat_dentry_namebuf *nb)
/* skip iterating emit_dots when dir is empty */ /* skip iterating emit_dots when dir is empty */
#define ITER_POS_FILLED_DOTS (2) #define ITER_POS_FILLED_DOTS (2)
static int exfat_iterate(struct file *filp, struct dir_context *ctx) static int exfat_iterate(struct file *file, struct dir_context *ctx)
{ {
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = file_inode(file);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct inode *tmp; struct inode *tmp;
struct exfat_dir_entry de; struct exfat_dir_entry de;
...@@ -228,7 +228,7 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx) ...@@ -228,7 +228,7 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx)
mutex_lock(&EXFAT_SB(sb)->s_lock); mutex_lock(&EXFAT_SB(sb)->s_lock);
cpos = ctx->pos; cpos = ctx->pos;
if (!dir_emit_dots(filp, ctx)) if (!dir_emit_dots(file, ctx))
goto unlock; goto unlock;
if (ctx->pos == ITER_POS_FILLED_DOTS) { if (ctx->pos == ITER_POS_FILLED_DOTS) {
......
...@@ -2022,7 +2022,7 @@ static int nfs_finish_open(struct nfs_open_context *ctx, ...@@ -2022,7 +2022,7 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
err = finish_open(file, dentry, do_open); err = finish_open(file, dentry, do_open);
if (err) if (err)
goto out; goto out;
if (S_ISREG(file->f_path.dentry->d_inode->i_mode)) if (S_ISREG(file_inode(file)->i_mode))
nfs_file_set_open_context(file, ctx); nfs_file_set_open_context(file, ctx);
else else
err = -EOPENSTALE; err = -EOPENSTALE;
......
...@@ -341,7 +341,7 @@ static ssize_t _nfs42_proc_copy(struct file *src, ...@@ -341,7 +341,7 @@ static ssize_t _nfs42_proc_copy(struct file *src,
return status; return status;
} }
} }
status = nfs_filemap_write_and_wait_range(file_inode(src)->i_mapping, status = nfs_filemap_write_and_wait_range(src->f_mapping,
pos_src, pos_src + (loff_t)count - 1); pos_src, pos_src + (loff_t)count - 1);
if (status) if (status)
return status; return status;
......
...@@ -417,9 +417,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file) ...@@ -417,9 +417,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
* readahead cache (if any); this forces an expensive refresh of * readahead cache (if any); this forces an expensive refresh of
* data for the next caller of mmap (or 'get_block' accesses) * data for the next caller of mmap (or 'get_block' accesses)
*/ */
if (file_inode(file) && if (mapping_nrpages(file->f_mapping)) {
file_inode(file)->i_mapping &&
mapping_nrpages(&file_inode(file)->i_data)) {
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
gossip_debug(GOSSIP_INODE_DEBUG, gossip_debug(GOSSIP_INODE_DEBUG,
"calling flush_racache on %pU\n", "calling flush_racache on %pU\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment