Whamcloud - gitweb
LU-8176 libcfs: Add file_dentry() & file_inode() wrapper 76/20576/10
authorYang Sheng <yang.sheng@intel.com>
Mon, 20 Jun 2016 02:34:31 +0000 (22:34 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 27 Jun 2016 18:56:02 +0000 (18:56 +0000)
Use file_dentry() & file_inode() wrappers to sync
with upstream.

Signed-off-by: Yang Sheng <yang.sheng@intel.com>
Change-Id: I7e62871789617a07dfe083a60374885099d25d51
Reviewed-on: http://review.whamcloud.com/20576
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
15 files changed:
libcfs/include/libcfs/linux/linux-fs.h
libcfs/libcfs/tracefile.c
lustre/autoconf/lustre-core.m4
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/lloop.c
lustre/llite/rw.c
lustre/llite/rw26.c
lustre/llite/vvp_io.c
lustre/obdclass/lprocfs_status_server.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/ptlrpc/gss/gss_pipefs.c

index 5c4579c..4ab0590 100644 (file)
 #include <linux/backing-dev.h>
 #include <linux/posix_acl_xattr.h>
 
+#ifndef HAVE_FILE_DENTRY
+static inline struct dentry *file_dentry(const struct file *file)
+{
+       return file->f_path.dentry;
+}
+#endif
+
+#ifndef HAVE_FILE_INODE
+static inline struct inode *file_inode(const struct file *file)
+{
+       return file->f_path.dentry->d_inode;
+}
+#endif
+
 #if defined(HAVE_FILE_FSYNC_4ARGS) || defined(HAVE_FILE_FSYNC_2ARGS)
 #define ll_vfs_fsync_range(fp, start, end, datasync) \
        vfs_fsync_range(fp, start, end, datasync)
 #else
 #define ll_vfs_fsync_range(fp, start, end, datasync) \
-       vfs_fsync_range(fp, (fp)->f_path.dentry, start, end, datasync)
+       vfs_fsync_range(fp, file_dentry(fp), start, end, datasync)
 #endif
 
 #define flock_type(fl)                 ((fl)->fl_type)
index df3a8b9..28f7f18 100644 (file)
@@ -992,7 +992,7 @@ static int tracefiled(void *arg)
                set_fs(get_ds());
 
                list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
-                       struct dentry *de = filp->f_path.dentry;
+                       struct dentry *de = file_dentry(filp);
                        static loff_t f_pos;
 
                        __LASSERT_TAGE_INVARIANT(tage);
index b78e53c..9d74fcd 100644 (file)
@@ -2091,6 +2091,23 @@ key_payload_data_array, [
 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
 
 #
+# LC_HAVE_FILE_DENTRY
+#
+# 4.5 adds wrapper file_dentry
+#
+AC_DEFUN([LC_HAVE_FILE_DENTRY], [
+LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
+file_dentry, [
+       #include <linux/fs.h>
+],[
+       file_dentry(NULL);
+], [
+       AC_DEFINE(HAVE_FILE_DENTRY, 1,
+               [kernel has file_dentry])
+])
+]) # LC_HAVE_FILE_DENTRY
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2263,6 +2280,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_HAVE_QC_MAKE_REQUEST_FN
        LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
 
+       # 4.5
+       LC_HAVE_FILE_DENTRY
+
        #
        AS_IF([test "x$enable_server" != xno], [
                LC_FUNC_DEV_SET_RDONLY
index 160e328..d4d67d7 100644 (file)
@@ -328,7 +328,7 @@ static int ll_iterate(struct file *filp, struct dir_context *ctx)
 static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
 #endif
 {
-       struct inode            *inode  = filp->f_path.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;
@@ -361,11 +361,11 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
        if (unlikely(op_data->op_mea1 != NULL)) {
                /* This is only needed for striped dir to fill ..,
                 * see lmv_read_entry */
-               if (filp->f_path.dentry->d_parent != NULL &&
-                   filp->f_path.dentry->d_parent->d_inode != NULL) {
+               if (file_dentry(filp)->d_parent != NULL &&
+                   file_dentry(filp)->d_parent->d_inode != NULL) {
                        __u64 ibits = MDS_INODELOCK_UPDATE;
                        struct inode *parent =
-                               filp->f_path.dentry->d_parent->d_inode;
+                               file_dentry(filp)->d_parent->d_inode;
 
                        if (ll_have_md_lock(parent, &ibits, LCK_MINMODE))
                                op_data->op_fid3 = *ll_inode2fid(parent);
@@ -1091,7 +1091,7 @@ static char *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_path.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;
@@ -1243,7 +1243,7 @@ lmv_out_free:
                                 RETURN(-EFAULT);
                 }
 
-               if (inode->i_sb->s_root == file->f_path.dentry)
+               if (inode->i_sb->s_root == file_dentry(file))
                         set_default = 1;
 
                 /* in v1 and v3 cases lumv1 points to data */
index 483fce6..a163098 100644 (file)
@@ -322,7 +322,7 @@ int ll_file_release(struct inode *inode, struct file *file)
        CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
               PFID(ll_inode2fid(inode)), inode);
 
-       if (inode->i_sb->s_root != file->f_path.dentry)
+       if (inode->i_sb->s_root != file_dentry(file))
                 ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1);
         fd = LUSTRE_FPRIVATE(file);
         LASSERT(fd != NULL);
@@ -332,7 +332,7 @@ int ll_file_release(struct inode *inode, struct file *file)
        if (S_ISDIR(inode->i_mode) && lli->lli_opendir_key == fd)
                ll_deauthorize_statahead(inode, fd);
 
-       if (inode->i_sb->s_root == file->f_path.dentry) {
+       if (inode->i_sb->s_root == file_dentry(file)) {
                LUSTRE_FPRIVATE(file) = NULL;
                ll_file_data_put(fd);
                RETURN(0);
@@ -355,7 +355,7 @@ int ll_file_release(struct inode *inode, struct file *file)
 static int ll_intent_file_open(struct file *file, void *lmm, int lmmsize,
                                struct lookup_intent *itp)
 {
-       struct dentry *de = file->f_path.dentry;
+       struct dentry *de = file_dentry(file);
        struct ll_sb_info *sbi = ll_i2sbi(de->d_inode);
        struct dentry *parent = de->d_parent;
        const char *name = NULL;
@@ -435,7 +435,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_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        ENTRY;
 
        LASSERT(!LUSTRE_FPRIVATE(file));
@@ -499,7 +499,7 @@ int ll_file_open(struct inode *inode, struct file *file)
        if (S_ISDIR(inode->i_mode))
                ll_authorize_statahead(inode, fd);
 
-       if (inode->i_sb->s_root == file->f_path.dentry) {
+       if (inode->i_sb->s_root == file_dentry(file)) {
                 LUSTRE_FPRIVATE(file) = fd;
                 RETURN(0);
         }
@@ -557,7 +557,7 @@ restart:
                                 GOTO(out_openerr, rc);
                         }
 
-                       ll_release_openhandle(file->f_path.dentry, it);
+                       ll_release_openhandle(file_dentry(file), it);
                 }
                 (*och_usecount)++;
 
@@ -994,7 +994,7 @@ out_size_unlock:
 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((struct file *)file);
 
        /* Adapted from file_accessed() and touch_atime().*/
        if (file->f_flags & O_NOATIME)
@@ -1020,7 +1020,7 @@ static bool file_is_noatime(const struct file *file)
 
 static void ll_io_init(struct cl_io *io, const struct file *file, int write)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode((struct file *)file);
 
         io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
        if (write) {
@@ -1047,7 +1047,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
                   loff_t *ppos, size_t count)
 {
        struct vvp_io           *vio = vvp_env_io(env);
-       struct inode            *inode = file->f_path.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);
        struct cl_io            *io;
@@ -1058,7 +1058,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
        ENTRY;
 
        CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zu\n",
-               file->f_path.dentry->d_name.name, iot, *ppos, count);
+               file_dentry(file)->d_name.name, iot, *ppos, count);
 
 restart:
        io = vvp_env_thread_io(env);
@@ -1133,7 +1133,7 @@ out:
        if ((rc == 0 || rc == -ENODATA) && count > 0 && io->ci_need_restart) {
                CDEBUG(D_VFSTRACE,
                       "%s: restart %s from %lld, count:%zu, result: %zd\n",
-                      file->f_path.dentry->d_name.name,
+                      file_dentry(file)->d_name.name,
                       iot == CIT_READ ? "read" : "write",
                       *ppos, count, result);
                goto restart;
@@ -1472,7 +1472,7 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
        if (rc < 0)
                GOTO(out_unlock, rc);
 
-       ll_release_openhandle(file->f_path.dentry, &oit);
+       ll_release_openhandle(file_dentry(file), &oit);
 
 out_unlock:
        ll_inode_size_unlock(inode);
@@ -1993,8 +1993,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
        if (llss == NULL)
                RETURN(-ENOMEM);
 
-       llss->inode1 = file1->f_path.dentry->d_inode;
-       llss->inode2 = file2->f_path.dentry->d_inode;
+       llss->inode1 = file_inode(file1);
+       llss->inode2 = file_inode(file2);
 
        rc = ll_check_swap_layouts_validity(llss->inode1, llss->inode2);
        if (rc < 0)
@@ -2163,7 +2163,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
 
        mutex_lock(&inode->i_mutex);
 
-       rc = ll_setattr_raw(file->f_path.dentry, attr, true);
+       rc = ll_setattr_raw(file_dentry(file), attr, true);
        if (rc == -ENODATA)
                rc = 0;
 
@@ -2187,7 +2187,7 @@ static inline long ll_lease_type_from_fmode(fmode_t fmode)
 
 static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct iattr ia = {
                .ia_valid = ATTR_ATIME | ATTR_ATIME_SET |
                            ATTR_MTIME | ATTR_MTIME_SET |
@@ -2215,7 +2215,7 @@ static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
                RETURN(-EINVAL);
 
        mutex_lock(&inode->i_mutex);
-       rc = ll_setattr_raw(file->f_path.dentry, &ia, false);
+       rc = ll_setattr_raw(file_dentry(file), &ia, false);
        mutex_unlock(&inode->i_mutex);
 
        RETURN(rc);
@@ -2273,7 +2273,7 @@ static int ll_ladvise(struct inode *inode, struct file *file, __u64 flags,
 static long
 ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct inode            *inode = file->f_path.dentry->d_inode;
+       struct inode            *inode = file_inode(file);
        struct ll_file_data     *fd = LUSTRE_FPRIVATE(file);
        int                      flags, rc;
        ENTRY;
@@ -2352,7 +2352,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                        mutex_unlock(&lli->lli_och_mutex);
                        if (och == NULL)
                                GOTO(out, rc = -ENOLCK);
-                       inode2 = file2->f_path.dentry->d_inode;
+                       inode2 = file_inode(file2);
                        rc = ll_swap_layouts_close(och, inode, inode2);
                } else {
                        rc = ll_swap_layouts(file, file2, &lsl);
@@ -2694,7 +2694,7 @@ static loff_t
 generic_file_llseek_size(struct file *file, loff_t offset, int origin,
                 loff_t maxsize, loff_t eof)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        switch (origin) {
        case SEEK_END:
@@ -2743,7 +2743,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int origin,
 
 static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        loff_t retval, eof = 0;
 
        ENTRY;
@@ -2768,7 +2768,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_path.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;
@@ -2841,19 +2841,19 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 }
 
 /*
- * When dentry is provided (the 'else' case), *file->f_path.dentry may be
+ * When dentry is provided (the 'else' case), file_dentry() may be
  * null and dentry must be used directly rather than pulled from
- * *file->f_path.dentry as is done otherwise.
+ * file_dentry() as is done otherwise.
  */
 
 #ifdef HAVE_FILE_FSYNC_4ARGS
 int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
-       struct dentry *dentry = file->f_path.dentry;
+       struct dentry *dentry = file_dentry(file);
 #elif defined(HAVE_FILE_FSYNC_2ARGS)
 int ll_fsync(struct file *file, int datasync)
 {
-       struct dentry *dentry = file->f_path.dentry;
+       struct dentry *dentry = file_dentry(file);
        loff_t start = 0;
        loff_t end = LLONG_MAX;
 #else
@@ -2920,7 +2920,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, int datasync)
 static int
 ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 {
-       struct inode *inode = file->f_path.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,
@@ -3120,7 +3120,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
        qstr.hash = full_name_hash(name, namelen);
        qstr.name = name;
        qstr.len = namelen;
-       dchild = d_lookup(file->f_path.dentry, &qstr);
+       dchild = d_lookup(file_dentry(file), &qstr);
        if (dchild != NULL) {
                if (dchild->d_inode != NULL)
                        child_inode = igrab(dchild->d_inode);
index cbc42e2..f906ce2 100644 (file)
@@ -1305,7 +1305,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_path.dentry->d_inode;
+       struct inode *inode = file_inode((struct file *)file);
 
         LASSERT(fd != NULL);
         return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
@@ -1443,13 +1443,6 @@ void cl_inode_fini(struct inode *inode);
 u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
 u32 cl_fid_build_gen(const struct lu_fid *fid);
 
-#ifndef HAVE_FILE_INODE
-static inline struct inode *file_inode(struct file *file)
-{
-       return file->f_path.dentry->d_inode;
-}
-#endif
-
 #ifndef HAVE_IOV_ITER_TRUNCATE
 static inline void iov_iter_truncate(struct iov_iter *i, u64 count)
 {
index 62c348b..d442e22 100644 (file)
@@ -2721,8 +2721,8 @@ static int ll_linkea_decode(struct linkea_data *ldata, unsigned int linkno,
  */
 int ll_getparent(struct file *file, struct getparent __user *arg)
 {
-       struct dentry           *dentry = file->f_path.dentry;
-       struct inode            *inode = dentry->d_inode;
+       struct dentry           *dentry = file_dentry(file);
+       struct inode            *inode = file_inode(file);
        struct linkea_data      *ldata;
        struct lu_buf            buf = LU_BUF_NULL;
        struct lu_name           ln;
index 6194f2f..81c7b9e 100644 (file)
@@ -99,7 +99,7 @@ ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma,
                 pgoff_t index, unsigned long *ra_flags)
 {
        struct file            *file = vma->vm_file;
-       struct inode           *inode = file->f_path.dentry->d_inode;
+       struct inode           *inode = file_inode(file);
        struct cl_io           *io;
        struct cl_fault_io     *fio;
        int                     rc;
@@ -405,7 +405,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
                 result = ll_page_mkwrite0(vma, vmf->page, &retry);
 
                 if (!printed && ++count > 16) {
-                       const struct dentry *de = vma->vm_file->f_path.dentry;
+                       const struct dentry *de = file_dentry(vma->vm_file);
 
                        CWARN("app(%s): the page %lu of file "DFID" is under"
                              " heavy contention\n",
@@ -444,7 +444,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_path.dentry->d_inode;
+       struct inode *inode    = file_inode(vma->vm_file);
        struct vvp_object *vob = cl_inode2vvp(inode);
 
        ENTRY;
@@ -459,7 +459,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_path.dentry->d_inode;
+       struct inode      *inode = file_inode(vma->vm_file);
        struct vvp_object *vob   = cl_inode2vvp(inode);
 
        ENTRY;
@@ -495,7 +495,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_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
         int rc;
         ENTRY;
 
index b8ae0b5..475185a 100644 (file)
@@ -188,7 +188,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 dentry        *de    = lo->lo_backing_file->f_path.dentry;
+       struct dentry        *de    = file_dentry(lo->lo_backing_file);
        struct inode         *inode = de->d_inode;
         struct cl_object     *obj = ll_i2info(inode)->lli_clob;
         pgoff_t               offset;
@@ -680,7 +680,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
                        err = -ENOENT;
                        break;
                }
-               inode = lo->lo_backing_file->f_path.dentry->d_inode;
+               inode = file_inode(lo->lo_backing_file);
                if (inode != NULL && lo->lo_state == LLOOP_BOUND)
                         fid = ll_i2info(inode)->lli_fid;
                 else
@@ -735,7 +735,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
        mutex_lock(&lloop_mutex);
        switch (cmd) {
        case LL_IOC_LLOOP_ATTACH: {
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
                struct lloop_device *lo_free = NULL;
                int i;
 
@@ -746,8 +746,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
                                         lo_free = lo;
                                 continue;
                         }
-                       if (lo->lo_backing_file->f_path.dentry->d_inode ==
-                           inode)
+                       if (file_inode(lo->lo_backing_file) == inode)
                                break;
                }
                if (lo || !lo_free)
index 0f07927..f41f559 100644 (file)
@@ -1138,7 +1138,7 @@ static int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 
 int ll_readpage(struct file *file, struct page *vmpage)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cl_object *clob = ll_i2info(inode)->lli_clob;
        struct ll_cl_context *lcc;
        const struct lu_env  *env;
index d9482b2..1d1ebb3 100644 (file)
@@ -788,7 +788,7 @@ static int ll_write_end(struct file *file, struct address_space *mapping,
                unplug = true;
        }
        if (unplug ||
-           file->f_flags & O_SYNC || IS_SYNC(file->f_path.dentry->d_inode))
+           file->f_flags & O_SYNC || IS_SYNC(file_inode(file)))
                result = vvp_io_write_commit(env, io);
 
        if (result < 0)
index 871d3a7..2f9ce64 100644 (file)
@@ -290,7 +290,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env,
        struct vvp_io *vio   = cl2vvp_io(env, ios);
        struct inode  *inode = vvp_object_inode(ios->cis_obj);
 
-       LASSERT(inode == vio->vui_fd->fd_file->f_path.dentry->d_inode);
+       LASSERT(inode == file_inode(vio->vui_fd->fd_file));
        vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime);
 
        return 0;
@@ -424,7 +424,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 dentry *de = vma->vm_file->f_path.dentry;
+                       struct dentry *de = file_dentry(vma->vm_file);
                        struct inode *inode = de->d_inode;
                         int flags = CEF_MUST;
 
index 2790deb..79b05b4 100644 (file)
@@ -44,7 +44,7 @@
 
 int lprocfs_evict_client_open(struct inode *inode, struct file *f)
 {
-       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(file_inode(f));
 
        atomic_inc(&obd->obd_evict_inprogress);
        return 0;
@@ -52,7 +52,7 @@ int lprocfs_evict_client_open(struct inode *inode, struct file *f)
 
 int lprocfs_evict_client_release(struct inode *inode, struct file *f)
 {
-       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(file_inode(f));
 
        atomic_dec(&obd->obd_evict_inprogress);
        wake_up(&obd->obd_evict_inprogress_waitq);
index 0097497..3cd4e8c 100644 (file)
@@ -2527,7 +2527,7 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev)
                RETURN(PTR_ERR(filp));
        }
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
        /* 'What the @fid is' is not imporatant, because the object
         * has no OI mapping, and only is visible inside the OSD.*/
        lu_igif_build(fid, inode->i_ino, inode->i_generation);
index eec4c8d..d361e98 100644 (file)
@@ -828,7 +828,7 @@ ssize_t gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
 static
 ssize_t gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
 {
-       struct rpc_inode        *rpci = RPC_I(filp->f_path.dentry->d_inode);
+       struct rpc_inode        *rpci = RPC_I(file_inode(filp));
         struct gss_upcall_msg   *gss_msg;
         struct ptlrpc_cli_ctx   *ctx;
         struct gss_cli_ctx      *gctx = NULL;