From 2a8a3597aa588d3c01868f8034429a2860d5a785 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 20 Oct 2014 18:02:33 -0400 Subject: [PATCH] lustre: use file_inode() Signed-off-by: Al Viro --- .../staging/lustre/lustre/libcfs/tracefile.c | 4 +-- drivers/staging/lustre/lustre/llite/dir.c | 4 +-- drivers/staging/lustre/lustre/llite/file.c | 27 +++++++++---------- .../lustre/lustre/llite/llite_internal.h | 2 +- .../staging/lustre/lustre/llite/llite_mmap.c | 12 ++++----- drivers/staging/lustre/lustre/llite/lloop.c | 7 +++-- drivers/staging/lustre/lustre/llite/vvp_io.c | 4 +-- 7 files changed, 29 insertions(+), 31 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index 7e3f6a45da00..7561030c96e6 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -1025,8 +1025,8 @@ static int tracefiled(void *arg) if (f_pos >= (off_t)cfs_tracefile_size) f_pos = 0; - else if (f_pos > i_size_read(filp->f_dentry->d_inode)) - f_pos = i_size_read(filp->f_dentry->d_inode); + else if (f_pos > i_size_read(file_inode(filp))) + f_pos = i_size_read(file_inode(filp)); buf = kmap(tage->page); rc = vfs_write(filp, (__force const char __user *)buf, diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b0bb7095dde5..fa639407fde7 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx) static int ll_readdir(struct file *filp, struct dir_context *ctx) { - struct inode *inode = filp->f_dentry->d_inode; + struct inode *inode = file_inode(filp); struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); struct ll_sb_info *sbi = ll_i2sbi(inode); int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; @@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename) static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_sb_info *sbi = ll_i2sbi(inode); struct obd_ioctl_data *data; int rc = 0; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 1fdc2fda6812..dd8e505defa5 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -489,7 +489,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, static int ll_local_open(struct file *file, struct lookup_intent *it, struct ll_file_data *fd, struct obd_client_handle *och) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); LASSERT(!LUSTRE_FPRIVATE(file)); @@ -1053,7 +1053,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, static bool file_is_noatime(const struct file *file) { const struct vfsmount *mnt = file->f_path.mnt; - const struct inode *inode = file->f_path.dentry->d_inode; + const struct inode *inode = file_inode(file); /* Adapted from file_accessed() and touch_atime().*/ if (file->f_flags & O_NOATIME) @@ -1079,7 +1079,7 @@ static bool file_is_noatime(const struct file *file) void ll_io_init(struct cl_io *io, const struct file *file, int write) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK; if (write) { @@ -1105,7 +1105,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, struct file *file, enum cl_io_type iot, loff_t *ppos, size_t count) { - struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); + struct ll_inode_info *lli = ll_i2info(file_inode(file)); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct cl_io *io; ssize_t result; @@ -1175,11 +1175,11 @@ out: if (iot == CIT_READ) { if (result >= 0) - ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), + ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_READ_BYTES, result); } else if (iot == CIT_WRITE) { if (result >= 0) { - ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), + ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_WRITE_BYTES, result); fd->fd_write_failed = false; } else if (result != -ERESTARTSYS) { @@ -1950,8 +1950,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, if (!llss) return -ENOMEM; - llss->inode1 = file1->f_dentry->d_inode; - llss->inode2 = file2->f_dentry->d_inode; + llss->inode1 = file_inode(file1); + llss->inode2 = file_inode(file2); if (!S_ISREG(llss->inode2->i_mode)) { rc = -EINVAL; @@ -2195,7 +2195,7 @@ out: static long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags, rc; @@ -2514,7 +2514,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); loff_t retval, eof = 0; retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : @@ -2538,7 +2538,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) static int ll_flush(struct file *file, fl_owner_t id) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int rc, err; @@ -2621,8 +2621,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) { - struct dentry *dentry = file->f_dentry; - struct inode *inode = dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); struct ptlrpc_request *req; struct obd_capa *oc; @@ -2675,7 +2674,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) static int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_sb_info *sbi = ll_i2sbi(inode); struct ldlm_enqueue_info einfo = { .ei_type = LDLM_FLOCK, diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 3c9e9803eac1..40dd3b50c478 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, static inline int ll_file_nolock(const struct file *file) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); LASSERT(fd != NULL); return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index ae605a6d9dc2..ba1c047ae927 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, unsigned long *ra_flags) { struct file *file = vma->vm_file; - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct cl_io *io; struct cl_fault_io *fio; struct lu_env *env; @@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, cfs_restore_sigs(set); if (result == 0) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ll_inode_info *lli = ll_i2info(inode); lock_page(vmpage); @@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) CWARN("app(%s): the page %lu of file %lu is under heavy" " contention.\n", current->comm, vmf->pgoff, - vma->vm_file->f_dentry->d_inode->i_ino); + file_inode(vma->vm_file)->i_ino); printed = true; } } while (retry); @@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) */ static void ll_vm_open(struct vm_area_struct *vma) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ccc_object *vob = cl_inode2ccc(inode); LASSERT(vma->vm_file); @@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma) */ static void ll_vm_close(struct vm_area_struct *vma) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ccc_object *vob = cl_inode2ccc(inode); LASSERT(vma->vm_file); @@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = { int ll_file_mmap(struct file *file, struct vm_area_struct *vma) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); int rc; if (ll_file_nolock(file)) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 264e5ec3fed6..9e31b789b790 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head) { const struct lu_env *env = lo->lo_env; struct cl_io *io = &lo->lo_io; - struct inode *inode = lo->lo_backing_file->f_dentry->d_inode; + struct inode *inode = file_inode(lo->lo_backing_file); struct cl_object *obj = ll_i2info(inode)->lli_clob; pgoff_t offset; int ret; @@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, break; } if (inode == NULL) - inode = lo->lo_backing_file->f_dentry->d_inode; + inode = file_inode(lo->lo_backing_file); if (lo->lo_state == LLOOP_BOUND) fid = ll_i2info(inode)->lli_fid; else @@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file, lo_free = lo; continue; } - if (lo->lo_backing_file->f_dentry->d_inode == - file->f_dentry->d_inode) + if (file_inode(lo->lo_backing_file) == file_inode(file)) break; } if (lo || !lo_free) { diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index d3f967a78138..e540a6d286f8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -108,7 +108,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, struct inode *inode = ccc_object_inode(ios->cis_obj); LASSERT(inode == - cl2ccc_io(env, ios)->cui_fd->fd_file->f_dentry->d_inode); + file_inode(cl2ccc_io(env, ios)->cui_fd->fd_file)); vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); return 0; } @@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env, down_read(&mm->mmap_sem); while ((vma = our_vma(mm, addr, count)) != NULL) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); int flags = CEF_MUST; if (ll_file_nolock(vma->vm_file)) { -- 2.39.5