Whamcloud - gitweb
LU-6215 kernel: use f_path for inode dentry 98/14598/11
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 29 May 2015 00:39:39 +0000 (20:39 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 Jun 2015 01:47:04 +0000 (01:47 +0000)
Starting with linux kernel 2.6.17 the f_dentry field of
struct inode was moved to f_path from the top level. To
prevent breakage a backwards compatible macro was provided.
The linux kernel 3.18 removed that  macro which causes
lustre to fail to compile. This patch migrates the code
over to using the proper field.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I1497fa6667dfe1e72db0a6c7e2da78af9acdb1ee
Reviewed-on: http://review.whamcloud.com/14598
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
16 files changed:
libcfs/include/libcfs/linux/linux-fs.h
libcfs/libcfs/tracefile.c
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/llite/xattr.c
lustre/obdclass/lprocfs_status_server.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/ptlrpc/gss/gss_pipefs.c

index 0467b95..fedaf60 100644 (file)
@@ -60,7 +60,7 @@
        vfs_fsync_range(fp, start, end, datasync)
 #else
 #define ll_vfs_fsync_range(fp, start, end, datasync) \
-       vfs_fsync_range(fp, (fp)->f_dentry, start, end, datasync)
+       vfs_fsync_range(fp, (fp)->f_path.dentry, start, end, datasync)
 #endif
 
 #define flock_type(fl)                 ((fl)->fl_type)
index 2daf3da..7c674ba 100644 (file)
@@ -58,8 +58,6 @@ static int thread_running = 0;
 
 static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);
 
-#define filp_size(f)   (i_size_read((f)->f_dentry->d_inode))
-
 static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
                                        struct cfs_trace_cpu_data *tcd);
 
@@ -995,14 +993,15 @@ static int tracefiled(void *arg)
                set_fs(get_ds());
 
                list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
-                        static loff_t f_pos;
+                       struct dentry *de = filp->f_path.dentry;
+                       static loff_t f_pos;
 
-                        __LASSERT_TAGE_INVARIANT(tage);
+                       __LASSERT_TAGE_INVARIANT(tage);
 
-                        if (f_pos >= (off_t)cfs_tracefile_size)
-                                f_pos = 0;
-                       else if (f_pos > (off_t)filp_size(filp))
-                               f_pos = filp_size(filp);
+                       if (f_pos >= (off_t)cfs_tracefile_size)
+                               f_pos = 0;
+                       else if (f_pos > i_size_read(de->d_inode))
+                               f_pos = i_size_read(de->d_inode);
 
                        rc = vfs_write(filp, page_address(tage->page),
                                       tage->used, &f_pos);
index dbf82b8..fe0d1be 100644 (file)
@@ -325,7 +325,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_dentry->d_inode;
+       struct inode            *inode  = filp->f_path.dentry->d_inode;
        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;
@@ -358,11 +358,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_dentry->d_parent != NULL &&
-                   filp->f_dentry->d_parent->d_inode != NULL) {
+               if (filp->f_path.dentry->d_parent != NULL &&
+                   filp->f_path.dentry->d_parent->d_inode != NULL) {
                        __u64 ibits = MDS_INODELOCK_UPDATE;
                        struct inode *parent =
-                               filp->f_dentry->d_parent->d_inode;
+                               filp->f_path.dentry->d_parent->d_inode;
 
                        if (ll_have_md_lock(parent, &ibits, LCK_MINMODE))
                                op_data->op_fid3 = *ll_inode2fid(parent);
@@ -1065,7 +1065,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->f_path.dentry->d_inode;
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct obd_ioctl_data *data;
         int rc = 0;
@@ -1217,7 +1217,7 @@ lmv_out_free:
                                 RETURN(-EFAULT);
                 }
 
-                if (inode->i_sb->s_root == file->f_dentry)
+               if (inode->i_sb->s_root == file->f_path.dentry)
                         set_default = 1;
 
                 /* in v1 and v3 cases lumv1 points to data */
index fbc255c..e7aff29 100644 (file)
@@ -273,10 +273,16 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode)
 static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                       struct file *file)
 {
-        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
-        struct ll_inode_info *lli = ll_i2info(inode);
-        int rc = 0;
-        ENTRY;
+       ldlm_policy_data_t policy = {
+               .l_inodebits    = { MDS_INODELOCK_OPEN },
+       };
+       __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
+       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_inode_info *lli = ll_i2info(inode);
+       struct lustre_handle lockh;
+       int lockmode;
+       int rc = 0;
+       ENTRY;
 
        /* clear group lock, if present */
        if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
@@ -303,40 +309,25 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
 
         /* Let's see if we have good enough OPEN lock on the file and if
            we can skip talking to MDS */
-        if (file->f_dentry->d_inode) { /* Can this ever be false? */
-                int lockmode;
-               __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
-                struct lustre_handle lockh;
-                struct inode *inode = file->f_dentry->d_inode;
-                ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};
-
-               mutex_lock(&lli->lli_och_mutex);
-                if (fd->fd_omode & FMODE_WRITE) {
-                        lockmode = LCK_CW;
-                        LASSERT(lli->lli_open_fd_write_count);
-                        lli->lli_open_fd_write_count--;
-                } else if (fd->fd_omode & FMODE_EXEC) {
-                        lockmode = LCK_PR;
-                        LASSERT(lli->lli_open_fd_exec_count);
-                        lli->lli_open_fd_exec_count--;
-                } else {
-                        lockmode = LCK_CR;
-                        LASSERT(lli->lli_open_fd_read_count);
-                        lli->lli_open_fd_read_count--;
-                }
-               mutex_unlock(&lli->lli_och_mutex);
-
-                if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
-                                   LDLM_IBITS, &policy, lockmode,
-                                   &lockh)) {
-                        rc = ll_md_real_close(file->f_dentry->d_inode,
-                                              fd->fd_omode);
-                }
+       mutex_lock(&lli->lli_och_mutex);
+       if (fd->fd_omode & FMODE_WRITE) {
+               lockmode = LCK_CW;
+               LASSERT(lli->lli_open_fd_write_count);
+               lli->lli_open_fd_write_count--;
+       } else if (fd->fd_omode & FMODE_EXEC) {
+               lockmode = LCK_PR;
+               LASSERT(lli->lli_open_fd_exec_count);
+               lli->lli_open_fd_exec_count--;
        } else {
-               CERROR("released file has negative dentry: file = %p, "
-                      "dentry = %p, name = %s\n",
-                      file, file->f_dentry, file->f_dentry->d_name.name);
+               lockmode = LCK_CR;
+               LASSERT(lli->lli_open_fd_read_count);
+               lli->lli_open_fd_read_count--;
        }
+       mutex_unlock(&lli->lli_och_mutex);
+
+       if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
+                          LDLM_IBITS, &policy, lockmode, &lockh))
+               rc = ll_md_real_close(inode, fd->fd_omode);
 
 out:
        LUSTRE_FPRIVATE(file) = NULL;
@@ -376,7 +367,7 @@ int ll_file_release(struct inode *inode, struct file *file)
        }
 #endif
 
-        if (inode->i_sb->s_root != file->f_dentry)
+       if (inode->i_sb->s_root != file->f_path.dentry)
                 ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1);
         fd = LUSTRE_FPRIVATE(file);
         LASSERT(fd != NULL);
@@ -386,7 +377,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_dentry) {
+       if (inode->i_sb->s_root == file->f_path.dentry) {
                 LUSTRE_FPRIVATE(file) = NULL;
                 ll_file_data_put(fd);
                 RETURN(0);
@@ -409,7 +400,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_dentry;
+       struct dentry *de = file->f_path.dentry;
        struct ll_sb_info *sbi = ll_i2sbi(de->d_inode);
        struct dentry *parent = de->d_parent;
        const char *name = NULL;
@@ -490,7 +481,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->f_path.dentry->d_inode;
        ENTRY;
 
        LASSERT(!LUSTRE_FPRIVATE(file));
@@ -554,7 +545,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_dentry) {
+       if (inode->i_sb->s_root == file->f_path.dentry) {
                 LUSTRE_FPRIVATE(file) = fd;
                 RETURN(0);
         }
@@ -612,7 +603,7 @@ restart:
                                 GOTO(out_openerr, rc);
                         }
 
-                        ll_release_openhandle(file->f_dentry, it);
+                       ll_release_openhandle(file->f_path.dentry, it);
                 }
                 (*och_usecount)++;
 
@@ -1056,7 +1047,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_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
 
         io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
        if (write) {
@@ -1083,7 +1074,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_dentry->d_inode;
+       struct inode            *inode = file->f_path.dentry->d_inode;
        struct ll_inode_info    *lli = ll_i2info(inode);
        struct ll_file_data     *fd  = LUSTRE_FPRIVATE(file);
        struct cl_io            *io;
@@ -1094,7 +1085,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_dentry->d_name.name, iot, *ppos, count);
+               file->f_path.dentry->d_name.name, iot, *ppos, count);
 
 restart:
        io = vvp_env_thread_io(env);
@@ -1173,7 +1164,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_dentry->d_name.name,
+                      file->f_path.dentry->d_name.name,
                       iot == CIT_READ ? "read" : "write",
                       *ppos, count, result);
                goto restart;
@@ -1181,11 +1172,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(inode),
                                           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(inode),
                                           LPROC_LL_WRITE_BYTES, result);
                        fd->fd_write_failed = false;
                } else if (rc != -ERESTARTSYS) {
@@ -1431,7 +1422,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_dentry, &oit);
+       ll_release_openhandle(file->f_path.dentry, &oit);
 
 out_unlock:
        ll_inode_size_unlock(inode);
@@ -1950,8 +1941,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
        if (llss == NULL)
                RETURN(-ENOMEM);
 
-       llss->inode1 = file1->f_dentry->d_inode;
-       llss->inode2 = file2->f_dentry->d_inode;
+       llss->inode1 = file1->f_path.dentry->d_inode;
+       llss->inode2 = file2->f_path.dentry->d_inode;
 
        rc = ll_check_swap_layouts_validity(llss->inode1, llss->inode2);
        if (rc < 0)
@@ -2120,7 +2111,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
 
        mutex_lock(&inode->i_mutex);
 
-       rc = ll_setattr_raw(file->f_dentry, attr, true);
+       rc = ll_setattr_raw(file->f_path.dentry, attr, true);
        if (rc == -ENODATA)
                rc = 0;
 
@@ -2145,7 +2136,7 @@ static inline long ll_lease_type_from_fmode(fmode_t fmode)
 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->f_path.dentry->d_inode;
        struct ll_file_data     *fd = LUSTRE_FPRIVATE(file);
        int                      flags, rc;
        ENTRY;
@@ -2224,7 +2215,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_dentry->d_inode;
+                       inode2 = file2->f_path.dentry->d_inode;
                        rc = ll_swap_layouts_close(och, inode, inode2);
                } else {
                        rc = ll_swap_layouts(file, file2, &lsl);
@@ -2507,7 +2498,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_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
 
        switch (origin) {
        case SEEK_END:
@@ -2556,7 +2547,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_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
        loff_t retval, eof = 0;
 
        ENTRY;
@@ -2581,7 +2572,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->f_path.dentry->d_inode;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
        int rc, err;
@@ -2660,19 +2651,19 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 }
 
 /*
- * When dentry is provided (the 'else' case), *file->f_dentry may be
+ * When dentry is provided (the 'else' case), *file->f_path.dentry may be
  * null and dentry must be used directly rather than pulled from
- * *file->f_dentry as is done otherwise.
+ * *file->f_path.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_dentry;
+       struct dentry *dentry = file->f_path.dentry;
 #elif defined(HAVE_FILE_FSYNC_2ARGS)
 int ll_fsync(struct file *file, int datasync)
 {
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
        loff_t start = 0;
        loff_t end = LLONG_MAX;
 #else
@@ -2743,7 +2734,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_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct ldlm_enqueue_info einfo = {
                .ei_type        = LDLM_FLOCK,
@@ -2930,7 +2921,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_dentry, &qstr);
+       dchild = d_lookup(file->f_path.dentry, &qstr);
        if (dchild != NULL) {
                if (dchild->d_inode != NULL) {
                        child_inode = igrab(dchild->d_inode);
index c839528..c2b0361 100644 (file)
@@ -1369,7 +1369,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->f_path.dentry->d_inode;
 
         LASSERT(fd != NULL);
         return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
index 09bdc94..07168c5 100644 (file)
@@ -2789,8 +2789,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_dentry;
-       struct inode            *inode = file->f_dentry->d_inode;
+       struct dentry           *dentry = file->f_path.dentry;
+       struct inode            *inode = dentry->d_inode;
        struct linkea_data      *ldata;
        struct lu_buf            buf = LU_BUF_NULL;
        struct lu_name           ln;
index 41faa95..bc41042 100644 (file)
@@ -104,7 +104,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->f_path.dentry->d_inode;
        struct cl_io           *io;
        struct cl_fault_io     *fio;
        struct lu_env          *env;
@@ -217,9 +217,6 @@ 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 ll_inode_info *lli = ll_i2info(inode);
-
                 lock_page(vmpage);
                 if (vmpage->mapping == NULL) {
                         unlock_page(vmpage);
@@ -402,10 +399,12 @@ 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;
+
                        CWARN("app(%s): the page %lu of file "DFID" is under"
                              " heavy contention\n",
                              current->comm, vmf->pgoff,
-                             PFID(ll_inode2fid(vma->vm_file->f_dentry->d_inode)));
+                             PFID(ll_inode2fid(de->d_inode)));
                         printed = true;
                 }
         } while (retry);
@@ -439,7 +438,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    = vma->vm_file->f_path.dentry->d_inode;
        struct vvp_object *vob = cl_inode2vvp(inode);
 
        ENTRY;
@@ -454,7 +453,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 = vma->vm_file->f_path.dentry->d_inode;
        struct vvp_object *vob   = cl_inode2vvp(inode);
 
        ENTRY;
@@ -490,7 +489,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->f_path.dentry->d_inode;
         int rc;
         ENTRY;
 
index 4d9e49b..0e68b51 100644 (file)
@@ -188,7 +188,8 @@ 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 dentry        *de    = lo->lo_backing_file->f_path.dentry;
+       struct inode         *inode = de->d_inode;
         struct cl_object     *obj = ll_i2info(inode)->lli_clob;
         pgoff_t               offset;
         int                   ret;
@@ -652,9 +653,8 @@ lo_release(struct gendisk *disk, fmode_t mode)
 static int lo_ioctl(struct block_device *bdev, fmode_t mode,
                     unsigned int cmd, unsigned long arg)
 {
-        struct lloop_device *lo = bdev->bd_disk->private_data;
-        struct inode *inode = NULL;
-        int err = 0;
+       struct lloop_device *lo = bdev->bd_disk->private_data;
+       int err = 0;
 
        mutex_lock(&lloop_mutex);
         switch (cmd) {
@@ -665,16 +665,16 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
                 break;
         }
 
-        case LL_IOC_LLOOP_INFO: {
-                struct lu_fid fid;
+       case LL_IOC_LLOOP_INFO: {
+               struct inode *inode;
+               struct lu_fid fid;
 
                if (lo->lo_backing_file == NULL) {
                        err = -ENOENT;
                        break;
                }
-                if (inode == NULL)
-                        inode = lo->lo_backing_file->f_dentry->d_inode;
-                if (lo->lo_state == LLOOP_BOUND)
+               inode = lo->lo_backing_file->f_path.dentry->d_inode;
+               if (inode != NULL && lo->lo_state == LLOOP_BOUND)
                         fid = ll_i2info(inode)->lli_fid;
                 else
                         fid_zero(&fid);
@@ -726,10 +726,11 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
         CWARN("Enter llop_ioctl\n");
 
        mutex_lock(&lloop_mutex);
-        switch (cmd) {
-        case LL_IOC_LLOOP_ATTACH: {
-                struct lloop_device *lo_free = NULL;
-                int i;
+       switch (cmd) {
+       case LL_IOC_LLOOP_ATTACH: {
+               struct inode *inode = file->f_path.dentry->d_inode;
+               struct lloop_device *lo_free = NULL;
+               int i;
 
                 for (i = 0; i < max_loop; i++, lo = NULL) {
                         lo = &loop_dev[i];
@@ -738,12 +739,12 @@ 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)
-                                break;
-                }
-                if (lo || !lo_free)
-                        GOTO(out, err = -EBUSY);
+                       if (lo->lo_backing_file->f_path.dentry->d_inode ==
+                           inode)
+                               break;
+               }
+               if (lo || !lo_free)
+                       GOTO(out, err = -EBUSY);
 
                 lo = lo_free;
                 dev = MKDEV(lloop_major, lo->lo_number);
index ca19828..be4a94f 100644 (file)
@@ -1138,7 +1138,8 @@ 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 cl_object *clob = ll_i2info(file->f_dentry->d_inode)->lli_clob;
+       struct inode *inode = file->f_path.dentry->d_inode;
+       struct cl_object *clob = ll_i2info(inode)->lli_clob;
        struct ll_cl_context *lcc;
        const struct lu_env  *env;
        struct cl_io   *io;
index d3fbda3..8b37776 100644 (file)
@@ -776,7 +776,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_dentry->d_inode))
+           file->f_flags & O_SYNC || IS_SYNC(file->f_path.dentry->d_inode))
                result = vvp_io_write_commit(env, io);
 
        RETURN(result >= 0 ? copied : result);
index 2062551..0632084 100644 (file)
@@ -289,7 +289,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_dentry->d_inode);
+       LASSERT(inode == vio->vui_fd->fd_file->f_path.dentry->d_inode);
        vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime);
 
        return 0;
@@ -424,7 +424,8 @@ 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 dentry *de = vma->vm_file->f_path.dentry;
+                       struct inode *inode = de->d_inode;
                         int flags = CEF_MUST;
 
                        if (ll_file_nolock(vma->vm_file)) {
index 9fea17e..3a079d2 100644 (file)
@@ -253,7 +253,7 @@ int ll_setxattr(struct dentry *dentry, const char *name,
                                return 0; /* b=10667: ignore error */
 
                        memset(&f, 0, sizeof(f)); /* f.f_flags is used below */
-                       f.f_dentry = dentry;
+                       f.f_path.dentry = dentry;
                        rc = ll_lov_setstripe_ea_info(inode, &f, it_flags, lump,
                                                      lum_size);
                        /* b=10667: rc always be 0 here for now */
index 5e30671..4b8ea8c 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_dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
 
        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_dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
 
        atomic_dec(&obd->obd_evict_inprogress);
        wake_up(&obd->obd_evict_inprogress_waitq);
index 9c8ea63..3ceb854 100644 (file)
@@ -2984,7 +2984,7 @@ static int osd_object_sync(const struct lu_env *env, struct dt_object *dt,
 
        dentry->d_inode = inode;
        dentry->d_sb = inode->i_sb;
-       file->f_dentry = dentry;
+       file->f_path.dentry = dentry;
        file->f_mapping = inode->i_mapping;
        file->f_op = inode->i_fop;
        set_file_inode(file, inode);
@@ -4629,8 +4629,8 @@ static struct dt_it *osd_it_ea_init(const struct lu_env *env,
                file->f_mode    = FMODE_64BITHASH;
        else
                file->f_mode    = FMODE_32BITHASH;
-       file->f_dentry          = obj_dentry;
-       file->f_mapping         = obj->oo_inode->i_mapping;
+       file->f_path.dentry     = obj_dentry;
+       file->f_mapping         = obj->oo_inode->i_mapping;
        file->f_op              = obj->oo_inode->i_fop;
        set_file_inode(file, obj->oo_inode);
 
index 76895d3..458977f 100644 (file)
@@ -2006,7 +2006,7 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
        LASSERT(filldir != NULL);
 
        filp->f_pos = 0;
-       filp->f_dentry = dentry;
+       filp->f_path.dentry = dentry;
        filp->f_mode = FMODE_64BITHASH;
        filp->f_mapping = inode->i_mapping;
        filp->f_op = fops;
@@ -2383,7 +2383,7 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev)
                RETURN(PTR_ERR(filp));
        }
 
-       inode = filp->f_dentry->d_inode;
+       inode = filp->f_path.dentry->d_inode;
        /* '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 074795d..c717529 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_dentry->d_inode);
+       struct rpc_inode        *rpci = RPC_I(filp->f_path.dentry->d_inode);
         struct gss_upcall_msg   *gss_msg;
         struct ptlrpc_cli_ctx   *ctx;
         struct gss_cli_ctx      *gctx = NULL;