size_t count, loff_t *pos)
 {
        int res;
-       srm_env_t       *entry = PDE(file->f_path.dentry->d_inode)->data;
+       srm_env_t       *entry = PDE(file_inode(file))->data;
        char            *buf = (char *) __get_free_page(GFP_USER);
        unsigned long   ret1, ret2;
 
 
 
 static int cplbinfo_open(struct inode *inode, struct file *file)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        char cplb_type;
        unsigned int cpu;
        int ret;
 
 
 static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
 {
-       int dev = MINOR(file->f_dentry->d_inode->i_rdev);
+       int dev = MINOR(file_inode(file)->i_rdev);
        unsigned int mask = 0;
        struct sync_port *port;
        DEBUGPOLL(static unsigned int prev_mask = 0);
        int return_val = 0;
        unsigned long flags;
 
-       int dev = MINOR(file->f_dentry->d_inode->i_rdev);
+       int dev = MINOR(file_inode(file)->i_rdev);
        struct sync_port *port;
 
        if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
 static ssize_t sync_serial_write(struct file *file, const char *buf,
        size_t count, loff_t *ppos)
 {
-       int dev = MINOR(file->f_dentry->d_inode->i_rdev);
+       int dev = MINOR(file_inode(file)->i_rdev);
        DECLARE_WAITQUEUE(wait, current);
        struct sync_port *port;
        unsigned long flags;
 static ssize_t sync_serial_read(struct file *file, char *buf,
                                size_t count, loff_t *ppos)
 {
-       int dev = MINOR(file->f_dentry->d_inode->i_rdev);
+       int dev = MINOR(file_inode(file)->i_rdev);
        int avail;
        struct sync_port *port;
        unsigned char *start;
 
 static long
 cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
        long ret;
 
        mutex_lock(&cryptocop_mutex);
-       ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
+       ret = cryptocop_ioctl_unlocked(file_inode(filp), filp, cmd, arg);
        mutex_unlock(&cryptocop_mutex);
 
        return ret;
 
 
 static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
 {
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        unsigned int mask = 0;
        sync_port *port;
        DEBUGPOLL( static unsigned int prev_mask = 0; );
 {
        int return_val = 0;
        int dma_w_size = regk_dma_set_w_size1;
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        sync_port *port;
        reg_sser_rw_tr_cfg tr_cfg;
        reg_sser_rw_rec_cfg rec_cfg;
 static ssize_t sync_serial_write(struct file *file, const char *buf,
                                 size_t count, loff_t *ppos)
 {
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        DECLARE_WAITQUEUE(wait, current);
        struct sync_port *port;
        int trunc_count;
 static ssize_t sync_serial_read(struct file * file, char * buf,
                                size_t count, loff_t *ppos)
 {
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        int avail;
        sync_port *port;
        unsigned char* start;
 
 static ssize_t
 salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct proc_dir_entry *entry = PDE(inode);
        struct salinfo_data *data = entry->data;
        char cmd[32];
 static ssize_t
 salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct proc_dir_entry *entry = PDE(inode);
        struct salinfo_data *data = entry->data;
        u8 *buf;
 static ssize_t
 salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct proc_dir_entry *entry = PDE(inode);
        struct salinfo_data *data = entry->data;
        char cmd[32];
 
 
 static unsigned int file_poll(struct file *file, poll_table * wait)
 {
-       int minor;
+       int minor = iminor(file_inode(file));
        unsigned int mask = 0;
 
-       minor = iminor(file->f_path.dentry->d_inode);
-
        poll_wait(file, &channel_wqs[minor].rt_queue, wait);
        poll_wait(file, &channel_wqs[minor].lx_queue, wait);
 
 static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
                         loff_t * ppos)
 {
-       int minor = iminor(file->f_path.dentry->d_inode);
+       int minor = iminor(file_inode(file));
 
        /* data available? */
        if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) {
 static ssize_t file_write(struct file *file, const char __user * buffer,
                          size_t count, loff_t * ppos)
 {
-       int minor;
-       struct rtlx_channel *rt;
-
-       minor = iminor(file->f_path.dentry->d_inode);
-       rt = &rtlx->channel[minor];
+       int minor = iminor(file_inode(file));
+       struct rtlx_channel *rt = &rtlx->channel[minor];
 
        /* any space left... */
        if (!rtlx_write_poll(minor)) {
 
        size_t ret = count;
        struct vpe *v;
 
-       if (iminor(file->f_path.dentry->d_inode) != minor)
+       if (iminor(file_inode(file)) != minor)
                return -ENODEV;
 
        v = get_vpe(tclimit);
 
 static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
                                   size_t count, loff_t *pos)
 {
-       int lineno = *(int *)PDE(file->f_path.dentry->d_inode)->data;
+       int lineno = *(int *)PDE(file_inode(file))->data;
        char kbuf[PVC_LINELEN];
        size_t len;
 
 
 static loff_t page_map_seek( struct file *file, loff_t off, int whence)
 {
        loff_t new;
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
 
        switch(whence) {
        case 0:
 static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
                              loff_t *ppos)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size);
 }
 
 static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
 
        if ((vma->vm_end - vma->vm_start) > dp->size)
                return -EINVAL;
 
 
 static int rtas_flash_release(struct inode *inode, struct file *file)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_update_flash_t *uf;
        
        uf = (struct rtas_update_flash_t *) dp->data;
 static ssize_t rtas_flash_read(struct file *file, char __user *buf,
                               size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_update_flash_t *uf;
        char msg[RTAS_MSG_MAXLEN];
 
 static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_update_flash_t *uf;
        char *p;
        int next_free;
 static ssize_t manage_flash_read(struct file *file, char __user *buf,
                               size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_manage_flash_t *args_buf;
        char msg[RTAS_MSG_MAXLEN];
        int msglen;
 static ssize_t manage_flash_write(struct file *file, const char __user *buf,
                                size_t count, loff_t *off)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_manage_flash_t *args_buf;
        const char reject_str[] = "0";
        const char commit_str[] = "1";
 static ssize_t validate_flash_read(struct file *file, char __user *buf,
                               size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_validate_flash_t *args_buf;
        char msg[RTAS_MSG_MAXLEN];
        int msglen;
 static ssize_t validate_flash_write(struct file *file, const char __user *buf,
                                    size_t count, loff_t *off)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_validate_flash_t *args_buf;
        int rc;
 
 
 static int validate_flash_release(struct inode *inode, struct file *file)
 {
-       struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *dp = PDE(file_inode(file));
        struct rtas_validate_flash_t *args_buf;
 
        args_buf = (struct rtas_validate_flash_t *) dp->data;
 
        struct spu_context *ctx;
        if (file->f_op != &spufs_context_fops)
                return 0;
-       ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
+       ctx = SPUFS_I(file_inode(file))->i_ctx;
        if (ctx->flags & SPU_CREATE_NOSCHED)
                return 0;
        return fd + 1;
                return NULL;
        *fd = n - 1;
        file = fcheck(*fd);
-       return SPUFS_I(file->f_dentry->d_inode)->i_ctx;
+       return SPUFS_I(file_inode(file))->i_ctx;
 }
 
 int spufs_coredump_extra_notes_size(void)
 
 
 static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
        if (!err) {
                mutex_lock(&inode->i_mutex);
 static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
                             size_t len, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
        int error = 0, cnt = 0;
 
 
 static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
        unsigned int mask = 0;
        int rc;
 
                        return ERR_PTR(-EINVAL);
 
                neighbor = get_spu_context(
-                               SPUFS_I(filp->f_dentry->d_inode)->i_ctx);
+                               SPUFS_I(file_inode(filp))->i_ctx);
 
                if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) &&
                    !list_is_last(&neighbor->aff_list, &gang->aff_list_head) &&
 
        if (filp->f_op != &spufs_context_fops)
                goto out;
 
-       i = SPUFS_I(filp->f_path.dentry->d_inode);
+       i = SPUFS_I(file_inode(filp));
        ret = spufs_run_spu(i->i_ctx, &npc, &status);
 
        if (put_user(npc, unpc))
 
 
        rc = seq_open(file, &hcall_inst_seq_ops);
        seq = file->private_data;
-       seq->private = file->f_path.dentry->d_inode->i_private;
+       seq->private = file_inode(file)->i_private;
 
        return rc;
 }
 
 static ssize_t scanlog_read(struct file *file, char __user *buf,
                            size_t count, loff_t *ppos)
 {
-        struct inode * inode = file->f_path.dentry->d_inode;
-       struct proc_dir_entry *dp;
-       unsigned int *data;
+       struct proc_dir_entry *dp = PDE(file_inode(file));
+       unsigned int *data = (unsigned int *)dp->data;
        int status;
        unsigned long len, off;
        unsigned int wait_time;
 
-        dp = PDE(inode);
-       data = (unsigned int *)dp->data;
-
        if (count > RTAS_DATA_BUF_SIZE)
                count = RTAS_DATA_BUF_SIZE;
 
 
        if (*ppos != 0)
                return 0;
 
-       df = file->f_path.dentry->d_inode->i_private;
+       df = file_inode(file)->i_private;
        mutex_lock(&df->lock);
        if (!df->data) {
                data = hypfs_dbfs_data_alloc(df);
 
 
 static int hypfs_open(struct inode *inode, struct file *filp)
 {
-       char *data = filp->f_path.dentry->d_inode->i_private;
+       char *data = file_inode(filp)->i_private;
        struct hypfs_sb_info *fs_info;
 
        if (filp->f_mode & FMODE_WRITE) {
 
        debug_info_t *debug_info, *debug_info_snapshot;
 
        mutex_lock(&debug_mutex);
-       debug_info = file->f_path.dentry->d_inode->i_private;
+       debug_info = file_inode(file)->i_private;
        /* find debug view */
        for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
                if (!debug_info->views[i])
 
 static int pci_perf_seq_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, pci_perf_show,
-                          filp->f_path.dentry->d_inode->i_private);
+                          file_inode(filp)->i_private);
 }
 
 static const struct file_operations debugfs_pci_perf_fops = {
 static int pci_debug_seq_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, pci_debug_show,
-                          filp->f_path.dentry->d_inode->i_private);
+                          file_inode(filp)->i_private);
 }
 
 static const struct file_operations debugfs_pci_debug_fops = {
 
 static ssize_t alignment_proc_write(struct file *file,
                const char __user *buffer, size_t count, loff_t *pos)
 {
-       int *data = PDE(file->f_path.dentry->d_inode)->data;
+       int *data = PDE(file_inode(file))->data;
        char mode;
 
        if (count > 0) {
 
        if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
             N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
            N_TRSIZE(ex) || N_DRSIZE(ex) ||
-           i_size_read(bprm->file->f_path.dentry->d_inode) <
+           i_size_read(file_inode(bprm->file)) <
            ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
                return -ENOEXEC;
        }
 
 static int load_aout_library(struct file *file)
 {
-       struct inode *inode;
        unsigned long bss, start_addr, len, error;
        int retval;
        struct exec ex;
 
-       inode = file->f_path.dentry->d_inode;
 
        retval = -ENOEXEC;
        error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
        /* We come in here for the regular a.out style of shared libraries */
        if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) ||
            N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) ||
-           i_size_read(inode) <
+           i_size_read(file_inode(file)) <
            ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
                goto out;
        }
 
 {
        char __user *tmp = buf;
        struct cpuid_regs cmd;
-       int cpu = iminor(file->f_path.dentry->d_inode);
+       int cpu = iminor(file_inode(file));
        u64 pos = *ppos;
        ssize_t bytes = 0;
        int err = 0;
        unsigned int cpu;
        struct cpuinfo_x86 *c;
 
-       cpu = iminor(file->f_path.dentry->d_inode);
+       cpu = iminor(file_inode(file));
        if (cpu >= nr_cpu_ids || !cpu_online(cpu))
                return -ENXIO;  /* No such CPU */
 
 
                                       const char __user *Buffer,
                                       size_t Count, loff_t *pos)
 {
-  DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file->f_path.dentry->d_inode)->data;
+  DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file_inode(file))->data;
   unsigned char CommandBuffer[80];
   int Length;
   if (Count > sizeof(CommandBuffer)-1) return -EINVAL;
 
                        return -EBUSY;
                file = fget(arg);
                if (file) {
-                       struct inode *inode = file->f_path.dentry->d_inode;
+                       struct inode *inode = file_inode(file);
                        if (S_ISSOCK(inode->i_mode)) {
                                nbd->file = file;
                                nbd->sock = SOCKET_I(inode);
 
 static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count,
                           loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int dev = iminor(inode) & 0x0f;
 
        switch(dev)
 static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count,
                            loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int dev = iminor(inode) & 0x0f;
 
        switch(dev)
 static long dsp56k_ioctl(struct file *file, unsigned int cmd,
                         unsigned long arg)
 {
-       int dev = iminor(file->f_path.dentry->d_inode) & 0x0f;
+       int dev = iminor(file_inode(file)) & 0x0f;
        void __user *argp = (void __user *)arg;
 
        switch(dev)
 #if 0
 static unsigned int dsp56k_poll(struct file *file, poll_table *wait)
 {
-       int dev = iminor(file->f_path.dentry->d_inode) & 0x0f;
+       int dev = iminor(file_inode(file)) & 0x0f;
 
        switch(dev)
        {
 
 static ssize_t dtlk_read(struct file *file, char __user *buf,
                         size_t count, loff_t * ppos)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        char ch;
        int i = 0, retries;
 
        }
 #endif
 
-       if (iminor(file->f_path.dentry->d_inode) != DTLK_MINOR)
+       if (iminor(file_inode(file)) != DTLK_MINOR)
                return -EINVAL;
 
        while (1) {
 
 static ssize_t lp_write(struct file * file, const char __user * buf,
                        size_t count, loff_t *ppos)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct parport *port = lp_table[minor].dev->port;
        char *kbuf = lp_table[minor].lp_buffer;
        ssize_t retv = 0;
                       size_t count, loff_t *ppos)
 {
        DEFINE_WAIT(wait);
-       unsigned int minor=iminor(file->f_path.dentry->d_inode);
+       unsigned int minor=iminor(file_inode(file));
        struct parport *port = lp_table[minor].dev->port;
        ssize_t retval = 0;
        char *kbuf = lp_table[minor].lp_buffer;
        struct timeval par_timeout;
        int ret;
 
-       minor = iminor(file->f_path.dentry->d_inode);
+       minor = iminor(file_inode(file));
        mutex_lock(&lp_mutex);
        switch (cmd) {
        case LPSETTIMEOUT:
        struct timeval par_timeout;
        int ret;
 
-       minor = iminor(file->f_path.dentry->d_inode);
+       minor = iminor(file_inode(file));
        mutex_lock(&lp_mutex);
        switch (cmd) {
        case LPSETTIMEOUT:
 
 {
        loff_t ret;
 
-       mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
+       mutex_lock(&file_inode(file)->i_mutex);
        switch (orig) {
        case SEEK_CUR:
                offset += file->f_pos;
        default:
                ret = -EINVAL;
        }
-       mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
+       mutex_unlock(&file_inode(file)->i_mutex);
        return ret;
 }
 
 
 ssize_t nsc_gpio_write(struct file *file, const char __user *data,
                       size_t len, loff_t *ppos)
 {
-       unsigned m = iminor(file->f_path.dentry->d_inode);
+       unsigned m = iminor(file_inode(file));
        struct nsc_gpio_ops *amp = file->private_data;
        struct device *dev = amp->dev;
        size_t i;
 ssize_t nsc_gpio_read(struct file *file, char __user * buf,
                      size_t len, loff_t * ppos)
 {
-       unsigned m = iminor(file->f_path.dentry->d_inode);
+       unsigned m = iminor(file_inode(file));
        int value;
        struct nsc_gpio_ops *amp = file->private_data;
 
 
 {
        struct cm4000_dev *dev = filp->private_data;
        unsigned int iobase = dev->p_dev->resource[0]->start;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pcmcia_device *link;
        int size;
        int rc;
 
 static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
                        loff_t * ppos)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct pp_struct *pp = file->private_data;
        char * kbuffer;
        ssize_t bytes_read = 0;
 static ssize_t pp_write (struct file * file, const char __user * buf,
                         size_t count, loff_t * ppos)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct pp_struct *pp = file->private_data;
        char * kbuffer;
        ssize_t bytes_written = 0;
 
 static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct pp_struct *pp = file->private_data;
        struct parport * port;
        void __user *argp = (void __user *)arg;
 
 
 static int ps3flash_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int err;
        mutex_lock(&inode->i_mutex);
        err = ps3flash_writeback(ps3flash_dev);
 
        filp->f_flags |= O_DIRECT;
        filp->f_mapping = bdev->bd_inode->i_mapping;
        if (++raw_devices[minor].inuse == 1)
-               filp->f_path.dentry->d_inode->i_mapping =
+               file_inode(filp)->i_mapping =
                        bdev->bd_inode->i_mapping;
        filp->private_data = bdev;
        mutex_unlock(&raw_mutex);
 
        }
 
        if (ret > 0) {
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
                inode->i_atime = current_fs_time(inode->i_sb);
        }
 
 
        unsigned int minor;
        char value;
 
-       minor = iminor(file->f_path.dentry->d_inode);
+       minor = iminor(file_inode(file));
        switch (minor) {
        case 0:
                value = get_led();
        int retval = 0;
        char c;
 
-       minor = iminor(file->f_path.dentry->d_inode);
+       minor = iminor(file_inode(file));
        switch (minor) {
        case 0:
                type = TYPE_LED;
 
        WARN_ON(gt->pages);
 
        /* This is the shared memory object that backs the GEM resource */
-       inode = gt->gem.filp->f_path.dentry->d_inode;
+       inode = file_inode(gt->gem.filp);
        mapping = inode->i_mapping;
 
        gt->pages = kmalloc(pages * sizeof(struct page *), GFP_KERNEL);
 
         * To do this we must instruct the shmfs to drop all of its
         * backing pages, *now*.
         */
-       inode = obj->base.filp->f_path.dentry->d_inode;
+       inode = file_inode(obj->base.filp);
        shmem_truncate_range(inode, 0, (loff_t)-1);
 
        obj->madv = __I915_MADV_PURGED;
         *
         * Fail silently without starting the shrinker
         */
-       mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping;
+       mapping = file_inode(obj->base.filp)->i_mapping;
        gfp = mapping_gfp_mask(mapping);
        gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD;
        gfp &= ~(__GFP_IO | __GFP_WAIT);
                mask |= __GFP_DMA32;
        }
 
-       mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping;
+       mapping = file_inode(obj->base.filp)->i_mapping;
        mapping_set_gfp_mask(mapping, mask);
 
        i915_gem_object_init(obj, &i915_gem_object_ops);
 void i915_gem_detach_phys_object(struct drm_device *dev,
                                 struct drm_i915_gem_object *obj)
 {
-       struct address_space *mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping;
+       struct address_space *mapping = file_inode(obj->base.filp)->i_mapping;
        char *vaddr;
        int i;
        int page_count;
                            int id,
                            int align)
 {
-       struct address_space *mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping;
+       struct address_space *mapping = file_inode(obj->base.filp)->i_mapping;
        drm_i915_private_t *dev_priv = dev->dev_private;
        int ret = 0;
        int page_count;
 
        swap_storage = ttm->swap_storage;
        BUG_ON(swap_storage == NULL);
 
-       swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
+       swap_space = file_inode(swap_storage)->i_mapping;
 
        for (i = 0; i < ttm->num_pages; ++i) {
                from_page = shmem_read_mapping_page(swap_space, i);
        } else
                swap_storage = persistent_swap_storage;
 
-       swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
+       swap_space = file_inode(swap_storage)->i_mapping;
 
        for (i = 0; i < ttm->num_pages; ++i) {
                from_page = ttm->pages[i];
 
        if (obj->pages == NULL)
                return -ENOMEM;
 
-       inode = obj->base.filp->f_path.dentry->d_inode;
+       inode = file_inode(obj->base.filp);
        mapping = inode->i_mapping;
        gfpmask |= mapping_gfp_mask(mapping);
 
 
 
 static long roccat_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 roccat_device *device;
        unsigned int minor = iminor(inode);
        long retval = 0;
 
  * This function is to be called with the minors_lock mutex held */
 static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct hid_device *dev;
        __u8 *buf;
        int ret = 0;
  *  mutex held. */
 static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type)
 {
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        struct hid_device *dev;
        __u8 *buf;
        int ret = 0, len;
 static long hidraw_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);
        unsigned int minor = iminor(inode);
        long ret = 0;
        struct hidraw *dev;
 
                return -ENOMEM;
 
        pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n",
-               iminor(file->f_path.dentry->d_inode), count);
+               iminor(file_inode(file)), count);
 
        ret = i2c_master_recv(client, tmp, count);
        if (ret >= 0)
                return PTR_ERR(tmp);
 
        pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n",
-               iminor(file->f_path.dentry->d_inode), count);
+               iminor(file_inode(file)), count);
 
        ret = i2c_master_send(client, tmp, count);
        kfree(tmp);
 
 static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer,
                                       size_t count, loff_t *pos)
 {
-       ide_drive_t     *drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data;
+       ide_drive_t     *drive = (ide_drive_t *) PDE(file_inode(file))->data;
        char            name[MAX_LEN + 1];
        int             for_real = 0, mul_factor, div_factor;
        unsigned long   n;
 static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer,
                                     size_t count, loff_t *pos)
 {
-       ide_drive_t     *drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data;
+       ide_drive_t     *drive = (ide_drive_t *) PDE(file_inode(file))->data;
        char name[32];
 
        if (!capable(CAP_SYS_ADMIN))
 
                        goto err_tree_mutex_unlock;
                }
 
-               inode = f.file->f_path.dentry->d_inode;
+               inode = file_inode(f.file);
                xrcd = find_xrcd(file->device, inode);
                if (!xrcd && !(cmd.oflags & O_CREAT)) {
                        /* no file descriptor. Need CREATE flag */
 
                goto done_chk_sdma;
        }
 
-       i_minor = iminor(fp->f_path.dentry->d_inode) - IPATH_USER_MINOR_BASE;
+       i_minor = iminor(file_inode(fp)) - IPATH_USER_MINOR_BASE;
        ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n",
-                  (long)fp->f_path.dentry->d_inode->i_rdev, i_minor);
+                  (long)file_inode(fp)->i_rdev, i_minor);
 
        if (i_minor)
                ret = find_free_port(i_minor - 1, fp, uinfo);
 
        struct infinipath_counters counters;
        struct ipath_devdata *dd;
 
-       dd = file->f_path.dentry->d_inode->i_private;
+       dd = file_inode(file)->i_private;
        dd->ipath_f_read_counters(dd, &counters);
 
        return simple_read_from_buffer(buf, count, ppos, &counters,
                goto bail;
        }
 
-       dd = file->f_path.dentry->d_inode->i_private;
+       dd = file_inode(file)->i_private;
        if (ipath_eeprom_read(dd, pos, tmp, count)) {
                ipath_dev_err(dd, "failed to read from flash\n");
                ret = -ENXIO;
                goto bail_tmp;
        }
 
-       dd = file->f_path.dentry->d_inode->i_private;
+       dd = file_inode(file)->i_private;
        if (ipath_eeprom_write(dd, pos, tmp, count)) {
                ret = -ENXIO;
                ipath_dev_err(dd, "failed to write to flash\n");
 
                }
        }
 
-       i_minor = iminor(fp->f_dentry->d_inode) - QIB_USER_MINOR_BASE;
+       i_minor = iminor(file_inode(fp)) - QIB_USER_MINOR_BASE;
        if (i_minor)
                ret = find_free_ctxt(i_minor - 1, fp, uinfo);
        else
 
 
 static struct super_block *qib_super;
 
-#define private2dd(file) ((file)->f_dentry->d_inode->i_private)
+#define private2dd(file) (file_inode(file)->i_private)
 
 static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
                       umode_t mode, const struct file_operations *fops,
 };
 
 /*
- * Could use file->f_dentry->d_inode->i_ino to figure out which file,
+ * Could use file_inode(file)->i_ino to figure out which file,
  * instead of separate routine for each, but for now, this works...
  */
 
 
 {
        struct smmu_debugfs_info *info;
        struct smmu_device *smmu;
-       struct dentry *dent;
        int i;
        enum {
                _OFF = 0,
        if (i == ARRAY_SIZE(command))
                return -EINVAL;
 
-       dent = file->f_dentry;
-       info = dent->d_inode->i_private;
+       info = file_inode(file)->i_private;
        smmu = info->smmu;
 
        offs = SMMU_CACHE_CONFIG(info->cache);
 
 static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
                                  size_t count, loff_t *pos)
 {
-       diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data;
+       diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
        PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
 
        if ((count == 1) || (count == 2)) {
 static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer,
                                    size_t count, loff_t *pos)
 {
-       diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data;
+       diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
        PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
 
        if ((count == 1) || (count == 2)) {
 static ssize_t info_proc_write(struct file *file, const char __user *buffer,
                               size_t count, loff_t *pos)
 {
-       diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data;
+       diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
        PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
        char c[4];
 
 
 {
        struct log_data *inf;
        int len;
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        struct procdata *pd = NULL;
        hysdn_card *card;
 
 hysdn_log_poll(struct file *file, poll_table *wait)
 {
        unsigned int mask = 0;
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        hysdn_card *card;
        struct procdata *pd = NULL;
 
 
 static ssize_t
 isdn_read(struct file *file, char __user *buf, size_t count, loff_t *off)
 {
-       uint minor = iminor(file->f_path.dentry->d_inode);
+       uint minor = iminor(file_inode(file));
        int len = 0;
        int drvidx;
        int chidx;
 static ssize_t
 isdn_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
 {
-       uint minor = iminor(file->f_path.dentry->d_inode);
+       uint minor = iminor(file_inode(file));
        int drvidx;
        int chidx;
        int retval;
 isdn_poll(struct file *file, poll_table *wait)
 {
        unsigned int mask = 0;
-       unsigned int minor = iminor(file->f_path.dentry->d_inode);
+       unsigned int minor = iminor(file_inode(file));
        int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
 
        mutex_lock(&isdn_mutex);
 static int
 isdn_ioctl(struct file *file, uint cmd, ulong arg)
 {
-       uint minor = iminor(file->f_path.dentry->d_inode);
+       uint minor = iminor(file_inode(file));
        isdn_ctrl c;
        int drvidx;
        int ret;
 
 
        if (is->debug & 0x2)
                printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n",
-                      iminor(file->f_path.dentry->d_inode));
+                      iminor(file_inode(file)));
 
        /* just registers wait_queue hook. This doesn't really wait. */
        poll_wait(file, &is->wq, wait);
 
                     struct page *page)
 {
        int ret = 0;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct buffer_head *bh;
        sector_t block;
 
                free_buffers(sb_page);
 
        if (file) {
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
                invalidate_mapping_pages(inode->i_mapping, 0, -1);
                fput(file);
        }
 
 static ssize_t zoran_write(struct file *file, const char __user *buffer,
                        size_t count, loff_t *ppos)
 {
-       struct zoran *zr = PDE(file->f_path.dentry->d_inode)->data;
+       struct zoran *zr = PDE(file_inode(file))->data;
        char *string, *sp;
        char *line, *ldelim, *varname, *svar, *tdelim;
 
 
 
 unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
 {
-       struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)];
+       struct irctl *ir = irctls[iminor(file_inode(file))];
        unsigned int ret;
 
        if (!ir) {
 {
        __u32 mode;
        int result = 0;
-       struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)];
+       struct irctl *ir = irctls[iminor(file_inode(file))];
 
        if (!ir) {
                printk(KERN_ERR "lirc_dev: %s: no irctl found!\n", __func__);
                          size_t length,
                          loff_t *ppos)
 {
-       struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)];
+       struct irctl *ir = irctls[iminor(file_inode(file))];
        unsigned char *buf;
        int ret = 0, written = 0;
        DECLARE_WAITQUEUE(wait, current);
 {
        void *data = NULL;
 
-       if (file && file->f_dentry && file->f_dentry->d_inode &&
-           file->f_dentry->d_inode->i_rdev) {
+       if (file && file->f_dentry && file_inode(file) &&
+           file_inode(file)->i_rdev) {
                struct irctl *ir;
-               ir = irctls[iminor(file->f_dentry->d_inode)];
+               ir = irctls[iminor(file_inode(file))];
                data = ir->d.data;
        }
 
 ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer,
                           size_t length, loff_t *ppos)
 {
-       struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)];
+       struct irctl *ir = irctls[iminor(file_inode(file))];
 
        if (!ir) {
                printk(KERN_ERR "%s: called with invalid irctl\n", __func__);
 
 
 struct video_device *video_devdata(struct file *file)
 {
-       return video_device[iminor(file->f_path.dentry->d_inode)];
+       return video_device[iminor(file_inode(file))];
 }
 EXPORT_SYMBOL(video_devdata);
 
 
 {
        struct ubi_volume_desc *desc = file->private_data;
        struct ubi_device *ubi = desc->vol->ubi;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int err;
        mutex_lock(&inode->i_mutex);
        err = ubi_sync(ubi->ubi_num);
 
                        loff_t *ppos)
 {
        loff_t pos = *ppos;
-       loff_t avail = file->f_path.dentry->d_inode->i_size;
+       loff_t avail = file_inode(file)->i_size;
        unsigned int mem = (uintptr_t)file->private_data & 3;
        struct adapter *adap = file->private_data - mem;
 
 
        int ret = 0;
 
        mutex_lock(&cosa_chardev_mutex);
-       if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS)
+       if ((n=iminor(file_inode(file))>>CARD_MINOR_BITS)
                >= nr_cards) {
                ret = -ENODEV;
                goto out;
        }
        cosa = cosa_cards+n;
 
-       if ((n=iminor(file->f_path.dentry->d_inode)
+       if ((n=iminor(file_inode(file))
                & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) {
                ret = -ENODEV;
                goto out;
 
                nr = nr * 10 + c;
                p++;
        } while (--len);
-       *(int *)PDE(file->f_path.dentry->d_inode)->data = nr;
+       *(int *)PDE(file_inode(file))->data = nr;
        return count;
 }
 
 
 static ssize_t led_proc_write(struct file *file, const char *buf,
        size_t count, loff_t *pos)
 {
-       void *data = PDE(file->f_path.dentry->d_inode)->data;
+       void *data = PDE(file_inode(file))->data;
        char *cur, lbuf[32];
        int d;
 
 
 proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
 {
        loff_t new = -1;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        mutex_lock(&inode->i_mutex);
        switch (whence) {
 static ssize_t
 proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-       const struct inode *ino = file->f_path.dentry->d_inode;
+       const struct inode *ino = file_inode(file);
        const struct proc_dir_entry *dp = PDE(ino);
        struct pci_dev *dev = dp->data;
        unsigned int pos = *ppos;
 static ssize_t
 proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos)
 {
-       struct inode *ino = file->f_path.dentry->d_inode;
+       struct inode *ino = file_inode(file);
        const struct proc_dir_entry *dp = PDE(ino);
        struct pci_dev *dev = dp->data;
        int pos = *ppos;
 static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
                               unsigned long arg)
 {
-       const struct proc_dir_entry *dp = PDE(file->f_dentry->d_inode);
+       const struct proc_dir_entry *dp = PDE(file_inode(file));
        struct pci_dev *dev = dp->data;
 #ifdef HAVE_PCI_MMAP
        struct pci_filp_private *fpriv = file->private_data;
 #ifdef HAVE_PCI_MMAP
 static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        const struct proc_dir_entry *dp = PDE(inode);
        struct pci_dev *dev = dp->data;
        struct pci_filp_private *fpriv = file->private_data;
 
        }
 
        if (ret > 0) {
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
                inode->i_atime = current_fs_time(inode->i_sb);
        }
 
 
                        const char __user *userbuf,
                        size_t count, loff_t *pos)
 {
-       struct ibm_struct *ibm = PDE(file->f_path.dentry->d_inode)->data;
+       struct ibm_struct *ibm = PDE(file_inode(file))->data;
        char *kernbuf;
        int ret;
 
 
 static ssize_t lcd_proc_write(struct file *file, const char __user *buf,
                              size_t count, loff_t *pos)
 {
-       struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data;
+       struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data;
        char cmd[42];
        size_t len;
        int value;
 static ssize_t video_proc_write(struct file *file, const char __user *buf,
                                size_t count, loff_t *pos)
 {
-       struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data;
+       struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data;
        char *cmd, *buffer;
        int ret;
        int value;
 static ssize_t fan_proc_write(struct file *file, const char __user *buf,
                              size_t count, loff_t *pos)
 {
-       struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data;
+       struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data;
        char cmd[42];
        size_t len;
        int value;
 static ssize_t keys_proc_write(struct file *file, const char __user *buf,
                               size_t count, loff_t *pos)
 {
-       struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data;
+       struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data;
        char cmd[42];
        size_t len;
        int value;
 
 static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
 {
        loff_t new = -1;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        mutex_lock(&inode->i_mutex);
        switch (whence) {
 static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
                                    size_t nbytes, loff_t * ppos)
 {
-       struct inode *ino = file->f_path.dentry->d_inode;
+       struct inode *ino = file_inode(file);
        struct proc_dir_entry *dp = PDE(ino);
        struct pnp_dev *dev = dp->data;
        int pos = *ppos;
 
 static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf,
                                  size_t count, loff_t *pos)
 {
-       void *data = PDE(file->f_path.dentry->d_inode)->data;
+       void *data = PDE(file_inode(file))->data;
        struct pnp_bios_node *node;
        int boot = (long)data >> 8;
        u8 nodenum = (long)data;
 
        struct idal_buffer *ib;
        int minor, rc = 0;
 
-       if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR)
+       if (imajor(file_inode(filp)) != IBM_FS3270_MAJOR)
                return -ENODEV;
-       minor = iminor(filp->f_path.dentry->d_inode);
+       minor = iminor(file_inode(filp));
        /* Check for minor 0 multiplexer. */
        if (minor == 0) {
                struct tty_struct *tty = get_current_tty();
 
        int minor, rc;
 
        DBF_EVENT(6, "TCHAR:open: %i:%i\n",
-               imajor(filp->f_path.dentry->d_inode),
-               iminor(filp->f_path.dentry->d_inode));
+               imajor(file_inode(filp)),
+               iminor(file_inode(filp)));
 
-       if (imajor(filp->f_path.dentry->d_inode) != tapechar_major)
+       if (imajor(file_inode(filp)) != tapechar_major)
                return -ENODEV;
 
-       minor = iminor(filp->f_path.dentry->d_inode);
+       minor = iminor(file_inode(filp));
        device = tape_find_device(minor / TAPE_MINORS_PER_DEV);
        if (IS_ERR(device)) {
                DBF_EVENT(3, "TCHAR:open: tape_find_device() failed\n");
 
         * We treat the minor number as the devno of the ur device
         * to find in the driver tree.
         */
-       devno = MINOR(file->f_dentry->d_inode->i_rdev);
+       devno = MINOR(file_inode(file)->i_rdev);
 
        urd = urdev_get_from_devno(devno);
        if (!urd) {
 
 static int qstat_seq_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, qstat_show,
-                          filp->f_path.dentry->d_inode->i_private);
+                          file_inode(filp)->i_private);
 }
 
 static const struct file_operations debugfs_fops = {
 static int qperf_seq_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, qperf_show,
-                          filp->f_path.dentry->d_inode->i_private);
+                          file_inode(filp)->i_private);
 }
 
 static struct file_operations debugfs_perf_fops = {
 
        int error = 0;
        u8 ireg = 0;
 
-       if (D7S_MINOR != iminor(file->f_path.dentry->d_inode))
+       if (D7S_MINOR != iminor(file_inode(file)))
                return -ENODEV;
 
        mutex_lock(&d7s_mutex);
 
 /* This function handles ioctl for the character device */
 static long twa_chrdev_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);
        long timeout;
        unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
        dma_addr_t dma_handle;
 
        dma_addr_t dma_handle;
        int request_id = 0;
        TW_Ioctl_Driver_Command driver_command;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        TW_Ioctl_Buf_Apache *tw_ioctl;
        TW_Command_Full *full_command_packet;
        TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)];
 
        unsigned long flags;
        unsigned int data_buffer_length = 0;
        unsigned long data_buffer_length_adjusted = 0;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        unsigned long *cpu_addr;
        long timeout;
        TW_New_Ioctl *tw_ioctl;
 
 csio_mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
        loff_t pos = *ppos;
-       loff_t avail = file->f_path.dentry->d_inode->i_size;
+       loff_t avail = file_inode(file)->i_size;
        unsigned int mem = (uintptr_t)file->private_data & 3;
        struct csio_hw *hw = file->private_data - mem;
 
 
        struct inode *inode;
        long ret;
  
-       inode = file->f_dentry->d_inode;
+       inode = file_inode(file);
  
        mutex_lock(&adpt_mutex);
        ret = adpt_ioctl(inode, file, cmd, arg);
        struct inode *inode;
        long ret;
  
-       inode = file->f_dentry->d_inode;
+       inode = file_inode(file);
  
        mutex_lock(&adpt_mutex);
  
 
        struct st_modedef *STm;
        struct st_partstat *STps;
        char *name = tape_name(STp);
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int mode = TAPE_MODE(inode);
 
        STp->ready = ST_READY;
 
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path);
                return -ENOENT;
        }
-       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc);
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)file_inode(flp)->i_size, loc);
        do_gettimeofday(&tv);
 
        BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)));
 
 static void invalidate_sub(struct fsg_lun *curlun)
 {
        struct file     *filp = curlun->filp;
-       struct inode    *inode = filp->f_path.dentry->d_inode;
+       struct inode    *inode = file_inode(filp);
        unsigned long   rc;
 
        rc = invalidate_mapping_pages(inode->i_mapping, 0, -1);
 
 static ssize_t rndis_proc_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *ppos)
 {
-       rndis_params *p = PDE(file->f_path.dentry->d_inode)->data;
+       rndis_params *p = PDE(file_inode(file))->data;
        u32 speed = 0;
        int i, fl_speed = 0;
 
 
        if (!(filp->f_mode & FMODE_WRITE))
                ro = 1;
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
        if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
                LINFO(curlun, "invalid file type: %s\n", filename);
                goto out;
 
        struct dgrp_proc_entry *entry;
        int ret = 0;
 
-       de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode);
+       de = (struct proc_dir_entry *) PDE(file_inode(file));
        if (!de || !de->data) {
                ret = -ENXIO;
                goto done;
        struct proc_dir_entry *de;
        struct dgrp_proc_entry *entry;
 
-       de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode);
+       de = (struct proc_dir_entry *) PDE(file_inode(file));
        if (!de || !de->data)
                goto done;
 
 
        int i, npages;
 
        /* This is the shared memory object that backs the GEM resource */
-       inode = obj->filp->f_path.dentry->d_inode;
+       inode = file_inode(obj->filp);
        mapping = inode->i_mapping;
 
        npages = obj->size >> PAGE_SHIFT;
 
                return NULL;
        }
 
-       inode = file->f_dentry->d_inode;
+       inode = file_inode(file);
 
        if (!inode || !S_ISSOCK(inode->i_mode)) {
                fput(file);
 
 static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
                        loff_t *ppos)
 {
-       unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
+       unsigned int minor = MINOR(file_inode(file)->i_rdev);
        ssize_t retval;
        size_t image_size;
        size_t okcount;
 static ssize_t vme_user_write(struct file *file, const char __user *buf,
                        size_t count, loff_t *ppos)
 {
-       unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
+       unsigned int minor = MINOR(file_inode(file)->i_rdev);
        ssize_t retval;
        size_t image_size;
        size_t okcount;
 static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
 {
        loff_t absolute = -1;
-       unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
+       unsigned int minor = MINOR(file_inode(file)->i_rdev);
        size_t image_size;
 
        if (minor == CONTROL_MINOR)
        int ret;
 
        mutex_lock(&vme_user_mutex);
-       ret = vme_user_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
+       ret = vme_user_ioctl(file_inode(file), file, cmd, arg);
        mutex_unlock(&vme_user_mutex);
 
        return ret;
 
                 * the expected virt_size for struct file w/o a backing struct
                 * block_device.
                 */
-               if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
+               if (S_ISBLK(file_inode(fd)->i_mode)) {
                        if (ret < 0 || ret != cmd->data_length) {
                                pr_err("%s() returned %d, expecting %u for "
                                                "S_ISBLK\n", __func__, ret,
 
        poll = kzalloc(sizeof(*poll), GFP_KERNEL);
        if (!poll)
                return NULL;
-       poll->cons_num = iminor(file->f_path.dentry->d_inode) & 127;
+       poll->cons_num = iminor(file_inode(file)) & 127;
        init_waitqueue_head(&poll->waitq);
        poll->notifier.notifier_call = vcs_notifier;
        if (register_vt_notifier(&poll->notifier) != 0) {
        int size;
 
        console_lock();
-       size = vcs_size(file->f_path.dentry->d_inode);
+       size = vcs_size(file_inode(file));
        console_unlock();
        if (size < 0)
                return size;
 static ssize_t
 vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        unsigned int currcons = iminor(inode);
        struct vc_data *vc;
        struct vcs_poll_data *poll;
 static ssize_t
 vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        unsigned int currcons = iminor(inode);
        struct vc_data *vc;
        long pos;
 
 {
        loff_t ret;
 
-       mutex_lock(&file->f_dentry->d_inode->i_mutex);
+       mutex_lock(&file_inode(file)->i_mutex);
 
        switch (orig) {
        case 0:
                ret = -EINVAL;
        }
 
-       mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+       mutex_unlock(&file_inode(file)->i_mutex);
        return ret;
 }
 
 
 {
        loff_t ret;
 
-       mutex_lock(&file->f_dentry->d_inode->i_mutex);
+       mutex_lock(&file_inode(file)->i_mutex);
 
        switch (orig) {
        case 0:
                ret = -EINVAL;
        }
 
-       mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+       mutex_unlock(&file_inode(file)->i_mutex);
        return ret;
 }
 
                                void __user *p)
 {
        struct dev_state *ps = file->private_data;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct usb_device *dev = ps->dev;
        int ret = -ENOTTY;
 
 
        if (!access_ok(VERIFY_WRITE, buf, nbytes))
                return -EFAULT;
 
-       mutex_lock(&file->f_dentry->d_inode->i_mutex);
+       mutex_lock(&file_inode(file)->i_mutex);
        list_for_each_entry_safe(req, tmp_req, queue, queue) {
                len = snprintf(tmpbuf, sizeof(tmpbuf),
                                "%8p %08x %c%c%c %5d %c%c%c\n",
                nbytes -= len;
                buf += len;
        }
-       mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+       mutex_unlock(&file_inode(file)->i_mutex);
 
        return actual;
 }
 static ssize_t regs_dbg_read(struct file *file, char __user *buf,
                size_t nbytes, loff_t *ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int ret;
 
        mutex_lock(&inode->i_mutex);
        ret = simple_read_from_buffer(buf, nbytes, ppos,
                        file->private_data,
-                       file->f_dentry->d_inode->i_size);
+                       file_inode(file)->i_size);
        mutex_unlock(&inode->i_mutex);
 
        return ret;
 
 static void invalidate_sub(struct fsg_lun *curlun)
 {
        struct file     *filp = curlun->filp;
-       struct inode    *inode = filp->f_path.dentry->d_inode;
+       struct inode    *inode = file_inode(filp);
        unsigned long   rc;
 
        rc = invalidate_mapping_pages(inode->i_mapping, 0, -1);
 
 printer_fsync(struct file *fd, loff_t start, loff_t end, int datasync)
 {
        struct printer_dev      *dev = fd->private_data;
-       struct inode *inode = fd->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(fd);
        unsigned long           flags;
        int                     tx_list_empty;
 
 
 static ssize_t rndis_proc_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *ppos)
 {
-       rndis_params *p = PDE(file->f_path.dentry->d_inode)->data;
+       rndis_params *p = PDE(file_inode(file))->data;
        u32 speed = 0;
        int i, fl_speed = 0;
 
 
        if (!(filp->f_mode & FMODE_WRITE))
                ro = 1;
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
        if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
                LINFO(curlun, "invalid file type: %s\n", filename);
                goto out;
 
 int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
        struct fb_info *info = file->private_data;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
        if (err)
                return err;
 
  */
 static struct fb_info *file_fb_info(struct file *file)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int fbidx = iminor(inode);
        struct fb_info *info = registered_fb[fbidx];
 
 
        if (f.file == NULL)
                return -1;
 
-       if (MAJOR(f.file->f_dentry->d_inode->i_rdev) == FB_MAJOR) {
+       if (MAJOR(file_inode(f.file)->i_rdev) == FB_MAJOR) {
                *start = info->fix.smem_start;
                *len = info->fix.smem_len;
        } else
 
                .identity               = DRIVER_NAME,
        };
        void __user *argp = (void __user *)arg;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int index = iminor(inode) - WD0_MINOR;
        struct cpwd *p = cpwd_device;
        int setopt = 0;
 static ssize_t cpwd_write(struct file *file, const char __user *buf,
                          size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cpwd *p = cpwd_device;
        int index = iminor(inode);
 
 
 proc_bus_zorro_lseek(struct file *file, loff_t off, int whence)
 {
        loff_t new = -1;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        mutex_lock(&inode->i_mutex);
        switch (whence) {
 static ssize_t
 proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-       struct inode *ino = file->f_path.dentry->d_inode;
+       struct inode *ino = file_inode(file);
        struct proc_dir_entry *dp = PDE(ino);
        struct zorro_dev *z = dp->data;
        struct ConfigDev cd;
 
 static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
        int res = 0;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
 
 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int ret = -ENOLCK;
 
        p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
 static int v9fs_file_flock_dotl(struct file *filp, int cmd,
        struct file_lock *fl)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int ret = -ENOLCK;
 
        p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
        if (!count)
                goto out;
 
-       retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode,
+       retval = v9fs_file_write_internal(file_inode(filp),
                                        filp->private_data,
                                        data, count, &origin, 1);
        /* update offset on successful write */
        struct v9fs_inode *v9inode;
        struct page *page = vmf->page;
        struct file *filp = vma->vm_file;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
 
        p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
 
 static int
 adfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
        struct object_info obj;
 
 static int
 affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode            *inode = filp->f_path.dentry->d_inode;
+       struct inode            *inode = file_inode(filp);
        struct super_block      *sb = inode->i_sb;
        struct buffer_head      *dir_bh;
        struct buffer_head      *fh_bh;
 
        int ret;
 
        _enter("{%Ld,{%lu}}",
-              file->f_pos, file->f_path.dentry->d_inode->i_ino);
+              file->f_pos, file_inode(file)->i_ino);
 
        ASSERT(file->private_data != NULL);
 
        fpos = file->f_pos;
-       ret = afs_dir_iterate(file->f_path.dentry->d_inode, &fpos,
+       ret = afs_dir_iterate(file_inode(file), &fpos,
                              cookie, filldir, file->private_data);
        file->f_pos = fpos;
 
 
  */
 int afs_lock(struct file *file, int cmd, struct file_lock *fl)
 {
-       struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
+       struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
 
        _enter("{%x:%u},%d,{t=%x,fl=%x,r=%Ld:%Ld}",
               vnode->fid.vid, vnode->fid.vnode, cmd,
  */
 int afs_flock(struct file *file, int cmd, struct file_lock *fl)
 {
-       struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
+       struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
 
        _enter("{%x:%u},%d,{t=%x,fl=%x}",
               vnode->fid.vid, vnode->fid.vnode, cmd,
 
                    struct page **pagep, void **fsdata)
 {
        struct afs_writeback *candidate, *wb;
-       struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
+       struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
        struct page *page;
        struct key *key = file->private_data;
        unsigned from = pos & (PAGE_CACHE_SIZE - 1);
                  loff_t pos, unsigned len, unsigned copied,
                  struct page *page, void *fsdata)
 {
-       struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
+       struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
        loff_t i_size, maybe_i_size;
 
        _enter("{%x:%u},{%lx}",
 ssize_t afs_file_write(struct kiocb *iocb, const struct iovec *iov,
                       unsigned long nr_segs, loff_t pos)
 {
-       struct dentry *dentry = iocb->ki_filp->f_path.dentry;
-       struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
+       struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));
        ssize_t result;
        size_t count = iov_length(iov, nr_segs);
 
 
 {
        if (!pipe->f_op || !pipe->f_op->write)
                return -EINVAL;
-       if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
+       if (!S_ISFIFO(file_inode(pipe)->i_mode))
                return -EINVAL;
        /* We want a packet pipe */
        pipe->f_flags |= O_DIRECT;
 
        struct inode *inode;
 
        if (f) {
-               inode = f->f_path.dentry->d_inode;
+               inode = file_inode(f);
                sbi = autofs4_sbi(inode->i_sb);
        }
        return sbi;
 
 static long autofs4_root_ioctl(struct file *filp,
                               unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
 }
 
 static long autofs4_root_compat_ioctl(struct file *filp,
                             unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int ret;
 
        if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
 
 static int
 befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
        befs_off_t value;
 
 
 static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
 {
-       struct inode *dir = f->f_path.dentry->d_inode;
+       struct inode *dir = file_inode(f);
        struct buffer_head *bh;
        struct bfs_dirent *de;
        struct bfs_sb_info *info = BFS_SB(dir->i_sb);
 
        if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
             N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
            N_TRSIZE(ex) || N_DRSIZE(ex) ||
-           i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
+           i_size_read(file_inode(bprm->file)) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
                return -ENOEXEC;
        }
 
        int retval;
        struct exec ex;
 
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
 
        retval = -ENOEXEC;
        error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
 
 
        /* By default, dump shared memory if mapped from an anonymous file. */
        if (vma->vm_flags & VM_SHARED) {
-               if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
+               if (file_inode(vma->vm_file)->i_nlink == 0 ?
                    FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED))
                        goto whole;
                return 0;
 
 
 dynamic_error:
        printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
-              what, file->f_path.dentry->d_inode->i_ino);
+              what, file_inode(file)->i_ino);
        return -ELIBBAD;
 }
 
 
        /* By default, dump shared memory if mapped from an anonymous file. */
        if (vma->vm_flags & VM_SHARED) {
-               if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
+               if (file_inode(vma->vm_file)->i_nlink == 0) {
                        dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
                        kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
                               vma->vm_flags, dump_ok ? "yes" : "no");
 
        int ret;
 
        hdr = ((struct flat_hdr *) bprm->buf);          /* exec-header */
-       inode = bprm->file->f_path.dentry->d_inode;
+       inode = file_inode(bprm->file);
 
        text_len  = ntohl(hdr->data_start);
        data_len  = ntohl(hdr->data_end) - ntohl(hdr->data_start);
 
 static ssize_t
 bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
 {
-       Node *e = file->f_path.dentry->d_inode->i_private;
+       Node *e = file_inode(file)->i_private;
        ssize_t res;
        char *page;
 
                                size_t count, loff_t *ppos)
 {
        struct dentry *root;
-       Node *e = file->f_path.dentry->d_inode->i_private;
+       Node *e = file_inode(file)->i_private;
        int res = parse_command(buffer, count);
 
        switch (res) {
 
 
 /*
  * private llseek:
- * for a block special file file->f_path.dentry->d_inode->i_size is zero
+ * for a block special file file_inode(file)->i_size is zero
  * so we compute the size by hand (just as in block_read/write above)
  */
 static loff_t block_llseek(struct file *file, loff_t offset, int whence)
 
        struct extent_state *cached_state = NULL;
        int i;
        unsigned long index = pos >> PAGE_CACHE_SHIFT;
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
        int err = 0;
        int faili = 0;
                                               struct iov_iter *i,
                                               loff_t pos)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct page **pages = NULL;
        unsigned long first_index;
                                    unsigned long nr_segs, loff_t pos)
 {
        struct file *file = iocb->ki_filp;
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        loff_t *ppos = &iocb->ki_pos;
        u64 start_pos;
 static long btrfs_fallocate(struct file *file, int mode,
                            loff_t offset, loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct extent_state *cached_state = NULL;
        u64 cur_offset;
        u64 last_byte;
 
 static int btrfs_real_readdir(struct file *filp, void *dirent,
                              filldir_t filldir)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_item *item;
        struct btrfs_dir_item *di;
 int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = fdentry(vma->vm_file)->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        struct btrfs_ordered_extent *ordered;
 
 
 static int btrfs_ioctl_getflags(struct file *file, void __user *arg)
 {
-       struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode);
+       struct btrfs_inode *ip = BTRFS_I(file_inode(file));
        unsigned int flags = btrfs_flags_to_ioctl(ip->flags);
 
        if (copy_to_user(arg, &flags, sizeof(flags)))
 
 static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_inode *ip = BTRFS_I(inode);
        struct btrfs_root *root = ip->root;
        struct btrfs_trans_handle *trans;
 
 static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        return put_user(inode->i_generation, arg);
 }
        u64 new_size;
        u64 old_size;
        u64 devid = 1;
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_vol_args *vol_args;
        struct btrfs_trans_handle *trans;
        struct btrfs_device *device = NULL;
                        goto out_drop_write;
                }
 
-               src_inode = src.file->f_path.dentry->d_inode;
-               if (src_inode->i_sb != file->f_path.dentry->d_inode->i_sb) {
+               src_inode = file_inode(src.file);
+               if (src_inode->i_sb != file_inode(file)->i_sb) {
                        printk(KERN_INFO "btrfs: Snapshot src from "
                               "another FS\n");
                        ret = -EINVAL;
 static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
                                                void __user *arg)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        int ret = 0;
        u64 flags = 0;
 static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
                                              void __user *arg)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_trans_handle *trans;
        u64 root_flags;
        if (IS_ERR(args))
                return PTR_ERR(args);
 
-       inode = fdentry(file)->d_inode;
+       inode = file_inode(file);
        ret = search_ioctl(inode, args);
        if (ret == 0 && copy_to_user(argp, args, sizeof(*args)))
                ret = -EFAULT;
        if (IS_ERR(args))
                return PTR_ERR(args);
 
-       inode = fdentry(file)->d_inode;
+       inode = file_inode(file);
 
        if (args->treeid == 0)
                args->treeid = BTRFS_I(inode)->root->root_key.objectid;
 
 static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_ioctl_defrag_range_args *range;
        int ret;
                        /* the rest are all set to zero by kzalloc */
                        range->len = (u64)-1;
                }
-               ret = btrfs_defrag_file(fdentry(file)->d_inode, file,
+               ret = btrfs_defrag_file(file_inode(file), file,
                                        range, 0, 0);
                if (ret > 0)
                        ret = 0;
 
 static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_vol_args *vol_args;
        int ret;
 
 static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                                       u64 off, u64 olen, u64 destoff)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct fd src_file;
        struct inode *src;
        if (src_file.file->f_path.mnt != file->f_path.mnt)
                goto out_fput;
 
-       src = src_file.file->f_dentry->d_inode;
+       src = file_inode(src_file.file);
 
        ret = -EINVAL;
        if (src == inode)
  */
 static long btrfs_ioctl_trans_start(struct file *file)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_trans_handle *trans;
        int ret;
 
 static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_root *new_root;
        struct btrfs_dir_item *di;
  */
 long btrfs_ioctl_trans_end(struct file *file)
 {
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_trans_handle *trans;
 
 
 static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_scrub_args *sa;
        int ret;
 
 
 static long btrfs_ioctl_balance(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_ioctl_balance_args *bargs;
        struct btrfs_balance_control *bctl;
 
 static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_quota_ctl_args *sa;
        struct btrfs_trans_handle *trans = NULL;
        int ret;
 
 static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_qgroup_assign_args *sa;
        struct btrfs_trans_handle *trans;
        int ret;
 
 static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_qgroup_create_args *sa;
        struct btrfs_trans_handle *trans;
        int ret;
 
 static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        struct btrfs_ioctl_qgroup_limit_args *sa;
        struct btrfs_trans_handle *trans;
        int ret;
                                            void __user *arg)
 {
        struct btrfs_ioctl_received_subvol_args *sa = NULL;
-       struct inode *inode = fdentry(file)->d_inode;
+       struct inode *inode = file_inode(file);
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_root_item *root_item = &root->root_item;
        struct btrfs_trans_handle *trans;
 long btrfs_ioctl(struct file *file, unsigned int
                cmd, unsigned long arg)
 {
-       struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
+       struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
        void __user *argp = (void __user *)arg;
 
        switch (cmd) {
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       send_root = BTRFS_I(fdentry(mnt_file)->d_inode)->root;
+       send_root = BTRFS_I(file_inode(mnt_file))->root;
        fs_info = send_root->fs_info;
 
        arg = memdup_user(arg_, sizeof(*arg));
 
                         get_block_t get_block)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        unsigned long end;
        loff_t size;
        int ret;
                   get_block_t get_block)
 {
        int ret;
-       struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb;
+       struct super_block *sb = file_inode(vma->vm_file)->i_sb;
 
        sb_start_pagefault(sb);
 
 
  */
 static int readpage_nounlock(struct file *filp, struct page *page)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc = 
                &ceph_inode_to_client(inode)->client->osdc;
 static int ceph_readpages(struct file *file, struct address_space *mapping,
                          struct list_head *page_list, unsigned nr_pages)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        int rc = 0;
        int max = 0;
                            loff_t pos, unsigned len,
                            struct page *page)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        loff_t page_off = pos & PAGE_CACHE_MASK;
                            loff_t pos, unsigned len, unsigned flags,
                            struct page **pagep, void **fsdata)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_file_info *fi = file->private_data;
        struct page *page;
                          loff_t pos, unsigned len, unsigned copied,
                          struct page *page, void *fsdata)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
  */
 static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       struct inode *inode = vma->vm_file->f_dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct page *page = vmf->page;
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        loff_t off = page_offset(page);
 
 static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
        struct ceph_file_info *fi = filp->private_data;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
                             loff_t *ppos)
 {
        struct ceph_file_info *cf = file->private_data;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        int left;
        const int bufsize = 1024;
 static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end,
                          int datasync)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct list_head *head = &ci->i_unsafe_dirops;
        struct ceph_mds_request *req;
 
 static ssize_t ceph_sync_read(struct file *file, char __user *data,
                              unsigned len, loff_t *poff, int *checkeof)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct page **pages;
        u64 off = *poff;
        int num_pages, ret;
 static ssize_t ceph_sync_write(struct file *file, const char __user *data,
                               size_t left, loff_t *offset)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_osd_request *req;
        int ret;
        struct timespec mtime = CURRENT_TIME;
 
-       if (ceph_snap(file->f_dentry->d_inode) != CEPH_NOSNAP)
+       if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
                return -EROFS;
 
        dout("sync_write on file %p %lld~%u %s\n", file, *offset,
        struct ceph_file_info *fi = filp->private_data;
        loff_t *ppos = &iocb->ki_pos;
        size_t len = iov->iov_len;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
        void __user *base = iov->iov_base;
        ssize_t ret;
 {
        struct file *file = iocb->ki_filp;
        struct ceph_file_info *fi = file->private_data;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc =
                &ceph_sb_to_client(inode->i_sb)->client->osdc;
 
  */
 static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
 {
-       struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
+       struct ceph_inode_info *ci = ceph_inode(file_inode(file));
        struct ceph_ioctl_layout l;
        int err;
 
-       err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
+       err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
        if (!err) {
                l.stripe_unit = ceph_file_layout_su(ci->i_layout);
                l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
 
 static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct inode *parent_inode;
        struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
-       struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
+       struct ceph_inode_info *ci = ceph_inode(file_inode(file));
        struct ceph_ioctl_layout nl;
        int err;
 
                return -EFAULT;
 
        /* validate changed params against current layout */
-       err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
+       err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
        if (err)
                return err;
 
  */
 static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
        int err;
 static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
 {
        struct ceph_ioctl_dataloc dl;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc =
                &ceph_sb_to_client(inode->i_sb)->client->osdc;
 static long ceph_ioctl_lazyio(struct file *file)
 {
        struct ceph_file_info *fi = file->private_data;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
 
        if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
 
 static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file,
                             int cmd, u8 wait, struct file_lock *fl)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ceph_mds_client *mdsc =
                ceph_sb_to_client(inode->i_sb)->mdsc;
        struct ceph_mds_request *req;
 
 static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
                                   unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        ssize_t written;
        int rc;
 
         */
        if (whence != SEEK_SET && whence != SEEK_CUR) {
                int rc;
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
 
                /*
                 * We need to be sure that all dirty pages are written and the
 {
        /* note that this is called by vfs setlease with lock_flocks held
           to protect *lease from going away */
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cifsFileInfo *cfile = file->private_data;
 
        if (!(S_ISREG(inode->i_mode)))
 
 cifs_posix_lock_test(struct file *file, struct file_lock *flock)
 {
        int rc = 0;
-       struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
+       struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
        unsigned char saved_type = flock->fl_type;
 
        if ((flock->fl_flags & FL_POSIX) == 0)
 static int
 cifs_posix_lock_set(struct file *file, struct file_lock *flock)
 {
-       struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
+       struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
        int rc = 1;
 
        if ((flock->fl_flags & FL_POSIX) == 0)
 
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
        netfid = cfile->fid.netfid;
-       cinode = CIFS_I(file->f_path.dentry->d_inode);
+       cinode = CIFS_I(file_inode(file));
 
        if (cap_unix(tcon->ses) &&
            (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
        struct cifs_tcon *tcon;
        struct TCP_Server_Info *server;
        struct cifsFileInfo *smbfile = file->private_data;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 
        rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
  */
 int cifs_flush(struct file *file, fl_owner_t id)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int rc = 0;
 
        if (file->f_mode & FMODE_WRITE)
        ssize_t written;
        struct inode *inode;
 
-       inode = iocb->ki_filp->f_path.dentry->d_inode;
+       inode = file_inode(iocb->ki_filp);
 
        /*
         * BB - optimize the way when signing is disabled. We can drop this
 cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
                   unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        struct cifsInodeInfo *cinode = CIFS_I(inode);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = (struct cifsFileInfo *)
 cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
                  unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        struct cifsInodeInfo *cinode = CIFS_I(inode);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = (struct cifsFileInfo *)
 int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
 {
        int rc, xid;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        xid = get_xid();
 
        int rc;
 
        /* Is the page cached? */
-       rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page);
+       rc = cifs_readpage_from_fscache(file_inode(file), page);
        if (rc == 0)
                goto read_complete;
 
        else
                cFYI(1, "Bytes read %d", rc);
 
-       file->f_path.dentry->d_inode->i_atime =
-               current_fs_time(file->f_path.dentry->d_inode->i_sb);
+       file_inode(file)->i_atime =
+               current_fs_time(file_inode(file)->i_sb);
 
        if (PAGE_CACHE_SIZE > rc)
                memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
        SetPageUptodate(page);
 
        /* send this page to the cache */
-       cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
+       cifs_readpage_to_fscache(file_inode(file), page);
 
        rc = 0;
 
 
        unsigned int xid;
        FILE_UNIX_BASIC_INFO find_data;
        struct cifs_fattr fattr;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = filp->private_data;
        struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
        unsigned int xid;
        FILE_ALL_INFO find_data;
        struct cifs_fattr fattr;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = filp->private_data;
        struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
 int cifs_revalidate_file_attr(struct file *filp)
 {
        int rc = 0;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
 
        if (!cifs_inode_needs_reval(inode))
 int cifs_revalidate_file(struct file *filp)
 {
        int rc;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        rc = cifs_revalidate_file_attr(filp);
        if (rc)
 
 
 long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 {
-       struct inode *inode = filep->f_dentry->d_inode;
+       struct inode *inode = file_inode(filep);
        int rc = -ENOTTY; /* strange error - but the precedent */
        unsigned int xid;
        struct cifs_sb_info *cifs_sb;
 
    whether we can use the cached search results from the previous search */
 static int is_dir_changed(struct file *file)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
 
        if (cifsInfo->time == 0)
        switch ((int) file->f_pos) {
        case 0:
                if (filldir(direntry, ".", 1, file->f_pos,
-                    file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
+                    file_inode(file)->i_ino, DT_DIR) < 0) {
                        cERROR(1, "Filldir for current dir failed");
                        rc = -ENOMEM;
                        break;
 
                 * We can't use vfs_readdir because we have to keep the file
                 * position in sync between the coda_file and the host_file.
                 * and as such we need grab the inode mutex. */
-               struct inode *host_inode = host_file->f_path.dentry->d_inode;
+               struct inode *host_inode = file_inode(host_file);
 
                mutex_lock(&host_inode->i_mutex);
                host_file->f_pos = coda_file->f_pos;
 
 static ssize_t
 coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       struct inode *host_inode, *coda_inode = coda_file->f_path.dentry->d_inode;
+       struct inode *host_inode, *coda_inode = file_inode(coda_file);
        struct coda_file_info *cfi;
        struct file *host_file;
        ssize_t ret;
        if (!host_file->f_op || !host_file->f_op->write)
                return -EINVAL;
 
-       host_inode = host_file->f_path.dentry->d_inode;
+       host_inode = file_inode(host_file);
        mutex_lock(&coda_inode->i_mutex);
 
        ret = host_file->f_op->write(host_file, buf, count, ppos);
        if (!host_file->f_op || !host_file->f_op->mmap)
                return -ENODEV;
 
-       coda_inode = coda_file->f_path.dentry->d_inode;
-       host_inode = host_file->f_path.dentry->d_inode;
+       coda_inode = file_inode(coda_file);
+       host_inode = file_inode(host_file);
 
        cii = ITOC(coda_inode);
        spin_lock(&cii->c_lock);
        err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
                          coda_flags, coda_file->f_cred->fsuid);
 
-       host_inode = cfi->cfi_container->f_path.dentry->d_inode;
+       host_inode = file_inode(cfi->cfi_container);
        cii = ITOC(coda_inode);
 
        /* did we mmap this file? */
 int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)
 {
        struct file *host_file;
-       struct inode *coda_inode = coda_file->f_path.dentry->d_inode;
+       struct inode *coda_inode = file_inode(coda_file);
        struct coda_file_info *cfi;
        int err;
 
 
        f = fdget(data->fd);
        if (!f.file)
                goto Ebadf;
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
        if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) {
                fdput(f);
                goto Ebadf;
 
        struct path path;
        int error;
        struct PioctlData data;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct inode *target_inode = NULL;
        struct coda_inode_info *cnp;
 
 
        case FIBMAP:
        case FIGETBSZ:
        case FIONREAD:
-               if (S_ISREG(f.file->f_path.dentry->d_inode->i_mode))
+               if (S_ISREG(file_inode(f.file)->i_mode))
                        break;
                /*FALL THROUGH*/
 
 
                        if (offset >= 0)
                                break;
                default:
-                       mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
+                       mutex_unlock(&file_inode(file)->i_mutex);
                        return -EINVAL;
        }
        if (offset != file->f_pos) {
 
 {
        struct pipe_inode_info *pipe;
 
-       pipe = file->f_path.dentry->d_inode->i_pipe;
+       pipe = file_inode(file)->i_pipe;
 
        pipe_lock(pipe);
        pipe->readers++;
                if (IS_ERR(cprm.file))
                        goto fail_unlock;
 
-               inode = cprm.file->f_path.dentry->d_inode;
+               inode = file_inode(cprm.file);
                if (inode->i_nlink > 1)
                        goto close_fail;
                if (d_unhashed(cprm.file->f_path.dentry))
 
  */
 static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        char *buf;
        unsigned int offset;
 
 
        lower_file = ecryptfs_file_to_lower(file);
        lower_file->f_pos = file->f_pos;
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
        memset(&buf, 0, sizeof(buf));
        buf.dirent = dirent;
        buf.dentry = file->f_path.dentry;
                goto out;
        if (rc >= 0)
                fsstack_copy_attr_atime(inode,
-                                       lower_file->f_path.dentry->d_inode);
+                                       file_inode(lower_file));
 out:
        return rc;
 }
 
 };
 
 static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct buffer_head *bh;
 
        struct efs_dir          *dirblock;
 
                goto out;
 
        error = -EINVAL;
-       if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
+       if (!S_ISREG(file_inode(file)->i_mode))
                goto exit;
 
        error = -EACCES;
                goto out;
 
        err = -EACCES;
-       if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
+       if (!S_ISREG(file_inode(file)->i_mode))
                goto exit;
 
        if (file->f_path.mnt->mnt_flags & MNT_NOEXEC)
 
 void would_dump(struct linux_binprm *bprm, struct file *file)
 {
-       if (inode_permission(file->f_path.dentry->d_inode, MAY_READ) < 0)
+       if (inode_permission(file_inode(file), MAY_READ) < 0)
                bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
 }
 EXPORT_SYMBOL(would_dump);
 int prepare_binprm(struct linux_binprm *bprm)
 {
        umode_t mode;
-       struct inode * inode = bprm->file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(bprm->file);
        int retval;
 
        mode = inode->i_mode;
 
 exofs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
        loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        unsigned int offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
        unsigned long npages = dir_pages(inode);
 
 ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 {
        loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        unsigned int offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
 
 
 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ext2_inode_info *ei = EXT2_I(inode);
        unsigned int flags;
        unsigned short rsv_window_size;
 
        int i, stored;
        struct ext3_dir_entry_2 *de;
        int err;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        int ret = 0;
        int dir_has_error = 0;
                 * We don't set the inode dirty flag since it's not
                 * critical that it get flushed back to the disk.
                 */
-               EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
+               EXT3_I(file_inode(filp))->i_flags &= ~EXT3_INDEX_FL;
        }
        stored = 0;
        offset = filp->f_pos & (sb->s_blocksize - 1);
 {
        struct dir_private_info *info = filp->private_data;
        loff_t  curr_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block * sb;
        int error;
 
                         void * dirent, filldir_t filldir)
 {
        struct dir_private_info *info = filp->private_data;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct fname *fname;
        int     ret;
 
 
 
 long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ext3_inode_info *ei = EXT3_I(inode);
        unsigned int flags;
        unsigned short rsv_window_size;
 
 
        dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
                       start_minor_hash));
-       dir = dir_file->f_path.dentry->d_inode;
+       dir = file_inode(dir_file);
        if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
                hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
                if (hinfo.hash_version <= DX_HASH_TEA)
        }
        hinfo.hash = start_hash;
        hinfo.minor_hash = 0;
-       frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
+       frame = dx_probe(NULL, file_inode(dir_file), &hinfo, frames, &err);
        if (!frame)
                return err;
 
 
        int i, stored;
        struct ext4_dir_entry_2 *de;
        int err;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        int ret = 0;
        int dir_has_error = 0;
                 * We don't set the inode dirty flag since it's not
                 * critical that it get flushed back to the disk.
                 */
-               ext4_clear_inode_flag(filp->f_path.dentry->d_inode,
+               ext4_clear_inode_flag(file_inode(filp),
                                      EXT4_INODE_INDEX);
        }
        stored = 0;
 {
        struct dir_private_info *info = filp->private_data;
        loff_t  curr_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb;
        int error;
 
                         void *dirent, filldir_t filldir)
 {
        struct dir_private_info *info = filp->private_data;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct fname *fname;
        int     ret;
 
 
  */
 long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        handle_t *handle;
        loff_t new_size;
        unsigned int max_blocks;
  */
 int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct super_block *sb = inode->i_sb;
        ext4_lblk_t first_block, stop_block;
        struct address_space *mapping = inode->i_mapping;
 
 ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
                unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        ssize_t ret;
 
        /*
 
        int i, stored;
        struct ext4_dir_entry_2 *de;
        struct super_block *sb;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int ret, inline_size = 0;
        struct ext4_iloc iloc;
        void *dir_buf = NULL;
 
                            ssize_t size, void *private, int ret,
                            bool is_async)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
         ext4_io_end_t *io_end = iocb->private;
 
        /* if not async direct IO or dio with 0 bytes write, just return */
 
 int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        if (!S_ISREG(inode->i_mode))
                return -EOPNOTSUPP;
 
        unsigned long len;
        int ret;
        struct file *file = vma->vm_file;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct address_space *mapping = inode->i_mapping;
        handle_t *handle;
        get_block_t *get_block;
 
 
 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        struct ext4_inode_info *ei = EXT4_I(inode);
        unsigned int flags;
 
                  pgoff_t orig_page_offset, int data_offset_in_page,
                  int block_len_in_page, int uninit, int *err)
 {
-       struct inode *orig_inode = o_filp->f_dentry->d_inode;
+       struct inode *orig_inode = file_inode(o_filp);
        struct page *pagep[2] = {NULL, NULL};
        handle_t *handle;
        ext4_lblk_t orig_blk_offset;
                 __u64 orig_start, __u64 donor_start, __u64 len,
                 __u64 *moved_len)
 {
-       struct inode *orig_inode = o_filp->f_dentry->d_inode;
-       struct inode *donor_inode = d_filp->f_dentry->d_inode;
+       struct inode *orig_inode = file_inode(o_filp);
+       struct inode *donor_inode = file_inode(d_filp);
        struct ext4_ext_path *orig_path = NULL, *holecheck_path = NULL;
        struct ext4_extent *ext_prev, *ext_cur, *ext_dummy;
        ext4_lblk_t block_start = orig_start;
 
 
        dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n",
                       start_hash, start_minor_hash));
-       dir = dir_file->f_path.dentry->d_inode;
+       dir = file_inode(dir_file);
        if (!(ext4_test_inode_flag(dir, EXT4_INODE_INDEX))) {
                hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
                if (hinfo.hash_version <= DX_HASH_TEA)
 
        va_list args;
        struct va_format vaf;
        struct ext4_super_block *es;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        char pathname[80], *path;
 
        es = EXT4_SB(inode->i_sb)->s_es;
 
 static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir)
 {
        unsigned long pos = file->f_pos;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        unsigned long npages = dir_blocks(inode);
        unsigned char *types = NULL;
        unsigned int bit_pos = 0, start_bit_pos = 0;
 
 
 static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        return __fat_readdir(inode, filp, dirent, filldir, 0, 0);
 }
 
 static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
                          unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
        int short_only, both;
 
 static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
                                 unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct compat_dirent __user *d1 = compat_ptr(arg);
        int short_only, both;
 
 
 
 static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
        int is_dir = S_ISDIR(inode->i_mode);
        u32 attr, oldattr;
 
 long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        u32 __user *user_attr = (u32 __user *)arg;
 
        switch (cmd) {
 
 
 static int setfl(int fd, struct file * filp, unsigned long arg)
 {
-       struct inode * inode = filp->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(filp);
        int error = 0;
 
        /*
 
 
        lg_global_lock(&files_lglock);
        do_file_list_for_each_entry(sb, f) {
-               if (!S_ISREG(f->f_path.dentry->d_inode->i_mode))
+               if (!S_ISREG(file_inode(f)->i_mode))
                       continue;
                if (!file_count(f))
                        continue;
 
 static int
 vxfs_readdir(struct file *fp, void *retp, filldir_t filler)
 {
-       struct inode            *ip = fp->f_path.dentry->d_inode;
+       struct inode            *ip = file_inode(fp);
        struct super_block      *sbp = ip->i_sb;
        u_long                  bsize = sbp->s_blocksize;
        u_long                  page, npages, block, pblocks, nblocks, offset;
 
 {
        struct fuse_conn *fc;
        mutex_lock(&fuse_mutex);
-       fc = file->f_path.dentry->d_inode->i_private;
+       fc = file_inode(file)->i_private;
        if (fc)
                fc = fuse_conn_get(fc);
        mutex_unlock(&fuse_mutex);
 
        int err;
        size_t nbytes;
        struct page *page;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct fuse_conn *fc = get_fuse_conn(inode);
        struct fuse_req *req;
 
 
 
 static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_holder gh;
        int error;
  */
 static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct buffer_head *bh;
 
 static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        u32 fsflags, gfsflags;
 
        if (get_user(fsflags, ptr))
 
 static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
 {
-       struct inode *inode = filep->f_dentry->d_inode;
+       struct inode *inode = file_inode(filep);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct gfs2_inode *ip = GFS2_I(inode);
        size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift;
 static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        unsigned long last_index;
 {
        struct file *file = iocb->ki_filp;
        size_t writesize = iov_length(iov, nr_segs);
-       struct dentry *dentry = file->f_dentry;
-       struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
+       struct gfs2_inode *ip = GFS2_I(file_inode(file));
        int ret;
 
        ret = gfs2_rs_alloc(ip);
 static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
                           loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct gfs2_inode *ip = GFS2_I(inode);
        unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
 {
        struct gfs2_file *fp = file->private_data;
        struct gfs2_holder *fl_gh = &fp->f_fl_gh;
-       struct gfs2_inode *ip = GFS2_I(file->f_path.dentry->d_inode);
+       struct gfs2_inode *ip = GFS2_I(file_inode(file));
        struct gfs2_glock *gl;
        unsigned int state;
        int flags;
 
 
 int gfs2_fitrim(struct file *filp, void __user *argp)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct request_queue *q = bdev_get_queue(sdp->sd_vfs->s_bdev);
        struct buffer_head *bh;
 
  */
 static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        int len, err;
        char strbuf[HFS_MAX_NAMELEN];
 
 {
        struct file *file = iocb->ki_filp;
        struct address_space *mapping = file->f_mapping;
-       struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
+       struct inode *inode = file_inode(file)->i_mapping->host;
        ssize_t ret;
 
        ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
 
 
 static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        int len, err;
        char strbuf[HFSPLUS_MAX_STRLEN + 1];
 
 {
        struct file *file = iocb->ki_filp;
        struct address_space *mapping = file->f_mapping;
-       struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
+       struct inode *inode = file_inode(file)->i_mapping->host;
        ssize_t ret;
 
        ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
 
 
 static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
        unsigned int flags = 0;
 
 
 static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
        unsigned int flags;
        int err = 0;
 
        return list_entry(inode, struct hostfs_inode_info, vfs_inode);
 }
 
-#define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode)
+#define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file))
 
 static int hostfs_d_delete(const struct dentry *dentry)
 {
 
        loff_t new_off = off + (whence == 1 ? filp->f_pos : 0);
        loff_t pos;
        struct quad_buffer_head qbh;
-       struct inode *i = filp->f_path.dentry->d_inode;
+       struct inode *i = file_inode(filp);
        struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
        struct super_block *s = i->i_sb;
 
 
 static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
        struct quad_buffer_head qbh;
        struct hpfs_dirent *de;
 
        retval = do_sync_write(file, buf, count, ppos);
        if (retval > 0) {
                hpfs_lock(file->f_path.dentry->d_sb);
-               hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1;
+               hpfs_i(file_inode(file))->i_dirty = 1;
                hpfs_unlock(file->f_path.dentry->d_sb);
        }
        return retval;
 
        ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
        ssize_t n;
 
-       read = file->f_path.dentry->d_inode->i_fop->read;
+       read = file_inode(file)->i_fop->read;
 
        if (!is_user)
                set_fs(KERNEL_DS);
        struct file *proc_file = data->proc_file;
        ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
 
-       write = proc_file->f_path.dentry->d_inode->i_fop->write;
+       write = file_inode(proc_file)->i_fop->write;
        return (*write)(proc_file, buf, len, ppos);
 }
 
        loff_t (*llseek)(struct file *, loff_t, int);
        loff_t ret;
 
-       llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek;
+       llseek = file_inode(proc_file)->i_fop->llseek;
        if (llseek != NULL) {
                ret = (*llseek)(proc_file, off, where);
                if (ret < 0)
                                      });
        int err;
 
-       readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir;
+       readdir = file_inode(proc_file)->i_fop->readdir;
 
        proc_file->f_pos = file->f_pos;
        err = (*readdir)(proc_file, &dirent, hppfs_filldir);
 
 
 static int hugetlbfs_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);
        loff_t len, vma_len;
        int ret;
        struct hstate *h = hstate_file(file);
 
 
 int file_update_time(struct file *file)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct timespec now;
        int sync_it = 0;
        int ret;
 
        struct fiemap fiemap;
        struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
        struct fiemap_extent_info fieinfo = { 0, };
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        u64 len;
        int error;
  */
 int ioctl_preallocate(struct file *filp, void __user *argp)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct space_resv sr;
 
        if (copy_from_user(&sr, argp, sizeof(sr)))
 static int file_ioctl(struct file *filp, unsigned int cmd,
                unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int __user *p = (int __user *)arg;
 
        switch (cmd) {
 
 static int ioctl_fsfreeze(struct file *filp)
 {
-       struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
+       struct super_block *sb = file_inode(filp)->i_sb;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
 static int ioctl_fsthaw(struct file *filp)
 {
-       struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
+       struct super_block *sb = file_inode(filp)->i_sb;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 {
        int error = 0;
        int __user *argp = (int __user *)arg;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        switch (cmd) {
        case FIOCLEX:
 
  */
 static int zisofs_readpage(struct file *file, struct page *page)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct address_space *mapping = inode->i_mapping;
        int err;
        int i, pcount, full_page;
 
        int result;
        char *tmpname;
        struct iso_directory_record *tmpde;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        tmpname = (char *)__get_free_page(GFP_KERNEL);
        if (tmpname == NULL)
 
 static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
        struct jffs2_inode_info *f;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct jffs2_full_dirent *fd;
        unsigned long offset, curofs;
 
        jffs2_dbg(1, "jffs2_readdir() for dir_i #%lu\n",
-                 filp->f_path.dentry->d_inode->i_ino);
+                 file_inode(filp)->i_ino);
 
        f = JFFS2_INODE_INFO(inode);
 
 
 
 long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct jfs_inode_info *jfs_inode = JFS_IP(inode);
        unsigned int flags;
 
 
  */
 int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *ip = filp->f_path.dentry->d_inode;
+       struct inode *ip = file_inode(filp);
        struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab;
        int rc = 0;
        loff_t dtpos;   /* legacy OS/2 style position */
 
                        continue;
                if (!rpc_cmp_addr(nlm_addr(block->b_host), addr))
                        continue;
-               if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
+               if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->fl_file)) ,fh) != 0)
                        continue;
                /* Alright, we found a lock. Set the return status
                 * and wake up the caller
 
        struct nlm_lock *lock = &argp->lock;
 
        nlmclnt_next_cookie(&argp->cookie);
-       memcpy(&lock->fh, NFS_FH(fl->fl_file->f_path.dentry->d_inode), sizeof(struct nfs_fh));
+       memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh));
        lock->caller  = utsname()->nodename;
        lock->oh.data = req->a_owner;
        lock->oh.len  = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s",
 
        __be32                  ret;
 
        dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
-                               file->f_file->f_path.dentry->d_inode->i_sb->s_id,
-                               file->f_file->f_path.dentry->d_inode->i_ino,
+                               file_inode(file->f_file)->i_sb->s_id,
+                               file_inode(file->f_file)->i_ino,
                                lock->fl.fl_type, lock->fl.fl_pid,
                                (long long)lock->fl.fl_start,
                                (long long)lock->fl.fl_end,
        __be32                  ret;
 
        dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
-                               file->f_file->f_path.dentry->d_inode->i_sb->s_id,
-                               file->f_file->f_path.dentry->d_inode->i_ino,
+                               file_inode(file->f_file)->i_sb->s_id,
+                               file_inode(file->f_file)->i_ino,
                                lock->fl.fl_type,
                                (long long)lock->fl.fl_start,
                                (long long)lock->fl.fl_end);
        int     error;
 
        dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
-                               file->f_file->f_path.dentry->d_inode->i_sb->s_id,
-                               file->f_file->f_path.dentry->d_inode->i_ino,
+                               file_inode(file->f_file)->i_sb->s_id,
+                               file_inode(file->f_file)->i_ino,
                                lock->fl.fl_pid,
                                (long long)lock->fl.fl_start,
                                (long long)lock->fl.fl_end);
        int status = 0;
 
        dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
-                               file->f_file->f_path.dentry->d_inode->i_sb->s_id,
-                               file->f_file->f_path.dentry->d_inode->i_ino,
+                               file_inode(file->f_file)->i_sb->s_id,
+                               file_inode(file->f_file)->i_ino,
                                lock->fl.fl_pid,
                                (long long)lock->fl.fl_start,
                                (long long)lock->fl.fl_end);
 
 
 static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
 {
-       struct inode *inode = file->f_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file->f_file);
 
        dprintk("lockd: %s %s/%ld\n",
                msg, inode->i_sb->s_id, inode->i_ino);
 
                start = filp->f_pos;
                break;
        case SEEK_END:
-               start = i_size_read(filp->f_path.dentry->d_inode);
+               start = i_size_read(file_inode(filp));
                break;
        default:
                return -EINVAL;
                start = filp->f_pos;
                break;
        case SEEK_END:
-               start = i_size_read(filp->f_path.dentry->d_inode);
+               start = i_size_read(file_inode(filp));
                break;
        default:
                return -EINVAL;
        struct file_lock *cfl;
 
        lock_flocks();
-       for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
+       for (cfl = file_inode(filp)->i_flock; cfl; cfl = cfl->fl_next) {
                if (!IS_POSIX(cfl))
                        continue;
                if (posix_locks_conflict(fl, cfl))
 {
        struct file_lock *new_fl = NULL;
        struct file_lock **before;
-       struct inode * inode = filp->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(filp);
        int error = 0;
        int found = 0;
 
 int posix_lock_file(struct file *filp, struct file_lock *fl,
                        struct file_lock *conflock)
 {
-       return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock);
+       return __posix_lock_file(file_inode(filp), fl, conflock);
 }
 EXPORT_SYMBOL(posix_lock_file);
 
        int type = F_UNLCK;
 
        lock_flocks();
-       time_out_leases(filp->f_path.dentry->d_inode);
-       for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
+       time_out_leases(file_inode(filp));
+       for (fl = file_inode(filp)->i_flock; fl && IS_LEASE(fl);
                        fl = fl->fl_next) {
                if (fl->fl_file == filp) {
                        type = target_leasetype(fl);
        if (copy_from_user(&flock, l, sizeof(flock)))
                goto out;
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
 
        /* Don't allow mandatory locks on files that may be memory mapped
         * and shared.
        if (copy_from_user(&flock, l, sizeof(flock)))
                goto out;
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
 
        /* Don't allow mandatory locks on files that may be memory mapped
         * and shared.
         * posix_lock_file().  Another process could be setting a lock on this
         * file at the same time, but we wouldn't remove that lock anyway.
         */
-       if (!filp->f_path.dentry->d_inode->i_flock)
+       if (!file_inode(filp)->i_flock)
                return;
 
        lock.fl_type = F_UNLCK;
  */
 void locks_remove_flock(struct file *filp)
 {
-       struct inode * inode = filp->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(filp);
        struct file_lock *fl;
        struct file_lock **before;
 
                fl_pid = fl->fl_pid;
 
        if (fl->fl_file != NULL)
-               inode = fl->fl_file->f_path.dentry->d_inode;
+               inode = file_inode(fl->fl_file);
 
        seq_printf(f, "%lld:%s ", id, pfx);
        if (IS_POSIX(fl)) {
 
 #define IMPLICIT_NODES 2
 static int __logfs_readdir(struct file *file, void *buf, filldir_t filldir)
 {
-       struct inode *dir = file->f_dentry->d_inode;
+       struct inode *dir = file_inode(file);
        loff_t pos = file->f_pos - IMPLICIT_NODES;
        struct page *page;
        struct logfs_disk_dentry *dd;
 
 static int logfs_readdir(struct file *file, void *buf, filldir_t filldir)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        ino_t pino = parent_ino(file->f_dentry);
        int err;
 
 
 
 long logfs_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 logfs_inode *li = logfs_inode(inode);
        unsigned int oldflags, flags;
        int err;
 
 static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
        unsigned long pos = filp->f_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        unsigned offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
 
                        goto out;
 
                if ((*opened & FILE_CREATED) ||
-                   !S_ISREG(file->f_path.dentry->d_inode->i_mode))
+                   !S_ISREG(file_inode(file)->i_mode))
                        will_truncate = false;
 
                audit_inode(name, file->f_path.dentry, 0);
 
  */
 int __mnt_want_write_file(struct file *file)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        if (!(file->f_mode & FMODE_WRITE) || special_file(inode->i_mode))
                return __mnt_want_write(file->f_path.mnt);
 
        if (!ncp_filp)
                goto out;
        error = -ENOTSOCK;
-       sock_inode = ncp_filp->f_path.dentry->d_inode;
+       sock_inode = file_inode(ncp_filp);
        if (!S_ISSOCK(sock_inode->i_mode))
                goto out_fput;
        sock = SOCKET_I(sock_inode);
                if (!server->info_filp)
                        goto out_bdi;
                error = -ENOTSOCK;
-               sock_inode = server->info_filp->f_path.dentry->d_inode;
+               sock_inode = file_inode(server->info_filp);
                if (!S_ISSOCK(sock_inode->i_mode))
                        goto out_fput2;
                info_sock = SOCKET_I(sock_inode);
 
 
 long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ncp_server *server = NCP_SERVER(inode);
        uid_t uid = current_uid();
        int need_drop_write = 0;
 
 /* This is used for a general mmap of a ncp file */
 int ncp_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        
        DPRINTK("ncp_mmap: called\n");
 
 
 
        for (i = 0; i < array->size; i++) {
                if (array->array[i].cookie == *desc->dir_cookie) {
-                       struct nfs_inode *nfsi = NFS_I(desc->file->f_path.dentry->d_inode);
+                       struct nfs_inode *nfsi = NFS_I(file_inode(desc->file));
                        struct nfs_open_dir_context *ctx = desc->file->private_data;
 
                        new_pos = desc->current_index + i;
 static
 int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page)
 {
-       struct inode    *inode = desc->file->f_path.dentry->d_inode;
+       struct inode    *inode = file_inode(desc->file);
        int ret;
 
        ret = nfs_readdir_xdr_to_array(desc, page, inode);
 static
 struct page *get_cache_page(nfs_readdir_descriptor_t *desc)
 {
-       return read_cache_page(desc->file->f_path.dentry->d_inode->i_mapping,
+       return read_cache_page(file_inode(desc->file)->i_mapping,
                        desc->page_index, (filler_t *)nfs_readdir_filler, desc);
 }
 
 {
        struct page     *page = NULL;
        int             status;
-       struct inode *inode = desc->file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(desc->file);
        struct nfs_open_dir_context *ctx = desc->file->private_data;
 
        dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n",
 
 nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
        int ret;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        do {
                ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
 
 static ssize_t
 idmap_pipe_downcall(struct file *filp, const char __user *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 idmap *idmap = (struct idmap *)rpci->private;
        struct key_construction *cons;
        struct idmap_msg im;
 
  */
 void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct nfs_inode *nfsi = NFS_I(inode);
 
        filp->private_data = get_nfs_open_context(ctx);
 
 static void nfs_file_clear_open_context(struct file *filp)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct nfs_open_context *ctx = nfs_file_open_context(filp);
 
        if (ctx) {
 
 static int
 nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
 }
 
 nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
        int ret;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        do {
                ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
 
 static int
 nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
 }
 
        loff_t pos = *ppos;
 
        if (!pos)
-               nfsd_inject_get(file->f_dentry->d_inode->i_private, &val);
+               nfsd_inject_get(file_inode(file)->i_private, &val);
        size = scnprintf(read_buf, sizeof(read_buf), "%llu\n", val);
 
        if (pos < 0)
 
        size = rpc_pton(net, write_buf, size, (struct sockaddr *)&sa, sizeof(sa));
        if (size > 0)
-               nfsd_inject_set_client(file->f_dentry->d_inode->i_private, &sa, size);
+               nfsd_inject_set_client(file_inode(file)->i_private, &sa, size);
        else {
                val = simple_strtoll(write_buf, NULL, 0);
-               nfsd_inject_set(file->f_dentry->d_inode->i_private, val);
+               nfsd_inject_set(file_inode(file)->i_private, val);
        }
        return len; /* on success, claim we got the whole input */
 }
 
 
 static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
 {
-       ino_t ino =  file->f_path.dentry->d_inode->i_ino;
+       ino_t ino =  file_inode(file)->i_ino;
        char *data;
        ssize_t rv;
 
 
  */
 static int wait_for_concurrent_writes(struct file *file)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        static ino_t last_ino;
        static dev_t last_dev;
        int err = 0;
        if (err)
                return err;
 
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
 
        /* Get readahead parameters */
        ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
        offset = *offsetp;
 
        while (1) {
-               struct inode *dir_inode = file->f_path.dentry->d_inode;
+               struct inode *dir_inode = file_inode(file);
                unsigned int reclen;
 
                cdp->err = nfserr_eof; /* will be cleared on successful read */
 
 static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
        loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        unsigned int offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
 
 static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct nilfs_transaction_info ti;
        int ret = 0;
 
 
 
 long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        void __user *argp = (void __user *)arg;
 
        switch (cmd) {
 
        struct dnotify_struct **prev;
        struct inode *inode;
 
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
        if (!S_ISDIR(inode->i_mode))
                return;
 
        }
 
        /* dnotify only works on directories */
-       inode = filp->f_path.dentry->d_inode;
+       inode = file_inode(filp);
        if (!S_ISDIR(inode->i_mode)) {
                error = -ENOTDIR;
                goto out_err;
 
 
                ret = -ENOTDIR;
                if ((flags & FAN_MARK_ONLYDIR) &&
-                   !(S_ISDIR(f.file->f_path.dentry->d_inode->i_mode))) {
+                   !(S_ISDIR(file_inode(f.file)->i_mode))) {
                        fdput(f);
                        goto out;
                }
 
 {
        s64 ia_pos, ia_start, prev_ia_pos, bmp_pos;
        loff_t fpos, i_size;
-       struct inode *bmp_vi, *vdir = filp->f_path.dentry->d_inode;
+       struct inode *bmp_vi, *vdir = file_inode(filp);
        struct super_block *sb = vdir->i_sb;
        ntfs_inode *ndir = NTFS_I(vdir);
        ntfs_volume *vol = NTFS_SB(sb);
 
                             int ret,
                             bool is_async)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        int level;
        wait_queue_head_t *wq = ocfs2_ioend_wq(inode);
 
                               unsigned long nr_segs)
 {
        struct file *file = iocb->ki_filp;
-       struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
+       struct inode *inode = file_inode(file)->i_mapping->host;
 
        /*
         * Fallback to buffered I/O if we see an inode without
 
 int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
        int error = 0;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int lock_level = 0;
 
        trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno);
 
 static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait)
 {
        int event = 0;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct dlmfs_inode_private *ip = DLMFS_I(inode);
 
        poll_wait(file, &ip->ip_lockres.l_event, wait);
        int bytes_left;
        ssize_t readlen, got;
        char *lvb_buf;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
                inode->i_ino, count, *ppos);
        int bytes_left;
        ssize_t writelen;
        char *lvb_buf;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
                inode->i_ino, count, *ppos);
 
 int ocfs2_change_file_space(struct file *file, unsigned int cmd,
                            struct ocfs2_space_resv *sr)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        int ret;
 
 static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
                            loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct ocfs2_space_resv sr;
        int change_size = 1;
        loff_t old_size, *ppos = &iocb->ki_pos;
        u32 old_clusters;
        struct file *file = iocb->ki_filp;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        int full_coherency = !(osb->s_mount_opt &
                               OCFS2_MOUNT_COHERENCY_BUFFERED);
                                      unsigned int flags)
 {
        int ret = 0, lock_level = 0;
-       struct inode *inode = in->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(in);
 
        trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry,
                        (unsigned long long)OCFS2_I(inode)->ip_blkno,
 {
        int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
        struct file *filp = iocb->ki_filp;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry,
                        (unsigned long long)OCFS2_I(inode)->ip_blkno,
 
 
 long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        unsigned int flags;
        int new_clusters;
        int status;
 {
        bool preserve;
        struct reflink_arguments args;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ocfs2_info info;
        void __user *argp = (void __user *)arg;
 
 
                                struct page *page)
 {
        int ret = VM_FAULT_NOPAGE;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct address_space *mapping = inode->i_mapping;
        loff_t pos = page_offset(page);
        unsigned int len = PAGE_CACHE_SIZE;
 static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct buffer_head *di_bh = NULL;
        sigset_t oldset;
        int ret;
 {
        int ret = 0, lock_level = 0;
 
-       ret = ocfs2_inode_lock_atime(file->f_dentry->d_inode,
+       ret = ocfs2_inode_lock_atime(file_inode(file),
                                    file->f_vfsmnt, &lock_level);
        if (ret < 0) {
                mlog_errno(ret);
                goto out;
        }
-       ocfs2_inode_unlock(file->f_dentry->d_inode, lock_level);
+       ocfs2_inode_unlock(file_inode(file), lock_level);
 out:
        vma->vm_ops = &ocfs2_file_vm_ops;
        return 0;
 
 {
        int status;
 
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ocfs2_move_extents range;
        struct ocfs2_move_extents_context *context = NULL;
 
 
                                     u32 new_cluster, u32 new_len)
 {
        int ret = 0, partial;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ocfs2_caching_info *ci = INODE_CACHE(inode);
        struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
        u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster);
                                    u32 new_cluster, u32 new_len)
 {
        int ret = 0;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct super_block *sb = inode->i_sb;
        struct ocfs2_caching_info *ci = INODE_CACHE(inode);
        int i, blocks = ocfs2_clusters_to_blocks(sb, new_len);
 
 static int omfs_fill_chain(struct file *filp, void *dirent, filldir_t filldir,
                u64 fsblock, int hindex)
 {
-       struct inode *dir = filp->f_dentry->d_inode;
+       struct inode *dir = file_inode(filp);
        struct buffer_head *bh;
        struct omfs_inode *oi;
        u64 self;
 
 static int omfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *dir = filp->f_dentry->d_inode;
+       struct inode *dir = file_inode(filp);
        struct buffer_head *bh;
        loff_t offset, res;
        unsigned int hchain, hindex;
 
 
 int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        long ret;
 
        if (offset < 0 || len <= 0)
        if (!f.file)
                goto out;
 
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
 
        error = -ENOTDIR;
        if (!S_ISDIR(inode->i_mode))
                f->f_mode = FMODE_PATH;
 
        path_get(&f->f_path);
-       inode = f->f_path.dentry->d_inode;
+       inode = file_inode(f);
        if (f->f_mode & FMODE_WRITE) {
                error = __get_file_write_access(inode, f->f_path.mnt);
                if (error)
 
 
 static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct op_inode_info *oi = OP_I(inode);
        struct device_node *dp = oi->u.node;
        struct device_node *child;
 
           unsigned long nr_segs, loff_t pos)
 {
        struct file *filp = iocb->ki_filp;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pipe_inode_info *pipe;
        int do_wakeup;
        ssize_t ret;
            unsigned long nr_segs, loff_t ppos)
 {
        struct file *filp = iocb->ki_filp;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pipe_inode_info *pipe;
        ssize_t ret;
        int do_wakeup;
 
 static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pipe_inode_info *pipe;
        int count, buf, nrbufs;
 
 pipe_poll(struct file *filp, poll_table *wait)
 {
        unsigned int mask;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pipe_inode_info *pipe = inode->i_pipe;
        int nrbufs;
 
 static int
 pipe_read_fasync(int fd, struct file *filp, int on)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int retval;
 
        mutex_lock(&inode->i_mutex);
 static int
 pipe_write_fasync(int fd, struct file *filp, int on)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int retval;
 
        mutex_lock(&inode->i_mutex);
 static int
 pipe_rdwr_fasync(int fd, struct file *filp, int on)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct pipe_inode_info *pipe = inode->i_pipe;
        int retval;
 
  */
 struct pipe_inode_info *get_pipe_info(struct file *file)
 {
-       struct inode *i = file->f_path.dentry->d_inode;
+       struct inode *i = file_inode(file);
 
        return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL;
 }
 
 static ssize_t lstats_write(struct file *file, const char __user *buf,
                            size_t count, loff_t *offs)
 {
-       struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
 
        if (!task)
                return -ESRCH;
 static ssize_t proc_info_read(struct file * file, char __user * buf,
                          size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        unsigned long page;
        ssize_t length;
        struct task_struct *task = get_proc_task(inode);
 
 static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
 {
-       struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        struct mm_struct *mm;
 
        if (!task)
 static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
                            loff_t *ppos)
 {
-       struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        char buffer[PROC_NUMBUF];
        int oom_adj = OOM_ADJUST_MIN;
        size_t len;
                goto out;
        }
 
-       task = get_proc_task(file->f_path.dentry->d_inode);
+       task = get_proc_task(file_inode(file));
        if (!task) {
                err = -ESRCH;
                goto out;
 static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
                                        size_t count, loff_t *ppos)
 {
-       struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        char buffer[PROC_NUMBUF];
        short oom_score_adj = OOM_SCORE_ADJ_MIN;
        unsigned long flags;
                goto out;
        }
 
-       task = get_proc_task(file->f_path.dentry->d_inode);
+       task = get_proc_task(file_inode(file));
        if (!task) {
                err = -ESRCH;
                goto out;
 static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
                                  size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        struct task_struct *task = get_proc_task(inode);
        ssize_t length;
        char tmpbuf[TMPBUFLEN];
 static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
                                   size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        char *page, *tmp;
        ssize_t length;
        uid_t loginuid;
 static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
                                  size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        struct task_struct *task = get_proc_task(inode);
        ssize_t length;
        char tmpbuf[TMPBUFLEN];
 static ssize_t proc_fault_inject_read(struct file * file, char __user * buf,
                                      size_t count, loff_t *ppos)
 {
-       struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        char buffer[PROC_NUMBUF];
        size_t len;
        int make_it_fail;
        make_it_fail = simple_strtol(strstrip(buffer), &end, 0);
        if (*end)
                return -EINVAL;
-       task = get_proc_task(file->f_dentry->d_inode);
+       task = get_proc_task(file_inode(file));
        if (!task)
                return -ESRCH;
        task->make_it_fail = make_it_fail;
 sched_write(struct file *file, const char __user *buf,
            size_t count, loff_t *offset)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct task_struct *p;
 
        p = get_proc_task(inode);
 sched_autogroup_write(struct file *file, const char __user *buf,
            size_t count, loff_t *offset)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct task_struct *p;
        char buffer[PROC_NUMBUF];
        int nice;
 static ssize_t comm_write(struct file *file, const char __user *buf,
                                size_t count, loff_t *offset)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct task_struct *p;
        char buffer[TASK_COMM_LEN];
 
 static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
                                  size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        char *p = NULL;
        ssize_t length;
        struct task_struct *task = get_proc_task(inode);
 static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
                                   size_t count, loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        char *page;
        ssize_t length;
        struct task_struct *task = get_proc_task(inode);
 static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf,
                                         size_t count, loff_t *ppos)
 {
-       struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        struct mm_struct *mm;
        char buffer[PROC_NUMBUF];
        size_t len;
                goto out_no_task;
 
        ret = -ESRCH;
-       task = get_proc_task(file->f_dentry->d_inode);
+       task = get_proc_task(file_inode(file));
        if (!task)
                goto out_no_task;
 
 
 __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
               loff_t *ppos)
 {
-       struct inode * inode = file->f_path.dentry->d_inode;
+       struct inode * inode = file_inode(file);
        char    *page;
        ssize_t retval=0;
        int     eof=0;
 proc_file_read(struct file *file, char __user *buf, size_t nbytes,
               loff_t *ppos)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        ssize_t rv = -EIO;
 
        spin_lock(&pde->pde_unload_lock);
 proc_file_write(struct file *file, const char __user *buffer,
                size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        ssize_t rv = -EIO;
 
        if (pde->write_proc) {
 {
        unsigned int ino;
        int i;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int ret = 0;
 
        ino = inode->i_ino;
 
 int proc_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        return proc_readdir_de(PDE(inode), filp, dirent, filldir);
 }
 
 
 static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        loff_t rv = -EINVAL;
        loff_t (*llseek)(struct file *, loff_t, int);
 
 
 static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        ssize_t rv = -EIO;
        ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
 
 
 static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        ssize_t rv = -EIO;
        ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
 
 
 static unsigned int proc_reg_poll(struct file *file, struct poll_table_struct *pts)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        unsigned int rv = DEFAULT_POLLMASK;
        unsigned int (*poll)(struct file *, struct poll_table_struct *);
 
 
 static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        long rv = -ENOTTY;
        long (*ioctl)(struct file *, unsigned int, unsigned long);
 
 #ifdef CONFIG_COMPAT
 static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        long rv = -ENOTTY;
        long (*compat_ioctl)(struct file *, unsigned int, unsigned long);
 
 
 static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file_inode(file));
        int rv = -EIO;
        int (*mmap)(struct file *, struct vm_area_struct *);
 
 
        file = region->vm_file;
 
        if (file) {
-               struct inode *inode = region->vm_file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(region->vm_file);
                dev = inode->i_sb->s_dev;
                ino = inode->i_ino;
        }
 
        struct net *net;
 
        ret = -EINVAL;
-       net = get_proc_task_net(filp->f_path.dentry->d_inode);
+       net = get_proc_task_net(file_inode(filp));
        if (net != NULL) {
                ret = proc_readdir_de(net->proc_net, filp, dirent, filldir);
                put_net(net);
 
 static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf,
                size_t count, loff_t *ppos, int write)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ctl_table_header *head = grab_header(inode);
        struct ctl_table *table = PROC_I(inode)->sysctl_entry;
        ssize_t error;
 
 static unsigned int proc_sys_poll(struct file *filp, poll_table *wait)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct ctl_table_header *head = grab_header(inode);
        struct ctl_table *table = PROC_I(inode)->sysctl_entry;
        unsigned int ret = DEFAULT_POLLMASK;
 
        const char *name = NULL;
 
        if (file) {
-               struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(vma->vm_file);
                dev = inode->i_sb->s_dev;
                ino = inode->i_ino;
                pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
                return rv;
        if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED)
                return -EINVAL;
-       task = get_proc_task(file->f_path.dentry->d_inode);
+       task = get_proc_task(file_inode(file));
        if (!task)
                return -ESRCH;
        mm = get_task_mm(task);
 static ssize_t pagemap_read(struct file *file, char __user *buf,
                            size_t count, loff_t *ppos)
 {
-       struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
+       struct task_struct *task = get_proc_task(file_inode(file));
        struct mm_struct *mm;
        struct pagemapread pm;
        int ret = -ESRCH;
 
        file = vma->vm_file;
 
        if (file) {
-               struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(vma->vm_file);
                dev = inode->i_sb->s_dev;
                ino = inode->i_ino;
                pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
 
 
 static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        unsigned int offset;
        struct buffer_head *bh;
        struct qnx4_inode_entry *de;
 
 
 static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *s = inode->i_sb;
        struct qnx6_sb_info *sbi = QNX6_SB(s);
        loff_t pos = filp->f_pos & (QNX6_DIR_ENTRY_SIZE - 1);
 
                                            unsigned long pgoff, unsigned long flags)
 {
        unsigned long maxpages, lpages, nr, loop, ret;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct page **pages = NULL, **ptr, *page;
        loff_t isize;
 
 
 
 loff_t default_llseek(struct file *file, loff_t offset, int whence)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        loff_t retval;
 
        mutex_lock(&inode->i_mutex);
        loff_t pos;
        int retval = -EINVAL;
 
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
        if (unlikely((ssize_t) count < 0))
                return retval;
        pos = *ppos;
        if (!(out.file->f_mode & FMODE_WRITE))
                goto fput_out;
        retval = -EINVAL;
-       in_inode = in.file->f_path.dentry->d_inode;
-       out_inode = out.file->f_path.dentry->d_inode;
+       in_inode = file_inode(in.file);
+       out_inode = file_inode(out.file);
        retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count);
        if (retval < 0)
                goto fput_out;
 
 
 int vfs_readdir(struct file *file, filldir_t filler, void *buf)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int res = -ENOTDIR;
        if (!file->f_op || !file->f_op->readdir)
                goto out;
 
                                                         * new current position before returning. */
                                   )
 {
-       struct inode *inode = file->f_path.dentry->d_inode;     // Inode of the file that we are writing to.
+       struct inode *inode = file_inode(file); // Inode of the file that we are writing to.
        /* To simplify coding at this time, we store
           locked pages in array for now */
        struct reiserfs_transaction_handle th;
 
  */
 long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        unsigned int flags;
        int err = 0;
 
 
        }
 #if defined( REISERFS_USE_OIDMAPF )
        if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) {
-               loff_t size = sb_info->oidmap.mapf->f_path.dentry->d_inode->i_size;
+               loff_t size = file_inode(sb_info->oidmap.mapf)->i_size;
                total_used += size / sizeof(reiserfs_oidinterval_d_t);
        }
 #endif
 
  */
 static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *i = filp->f_dentry->d_inode;
+       struct inode *i = file_inode(filp);
        struct romfs_inode ri;
        unsigned long offset, maxoff;
        int j, ino, nextfh;
 
         * randomly drop data for eg socket -> socket splicing. Use the
         * piped splicing for that!
         */
-       i_mode = in->f_path.dentry->d_inode->i_mode;
+       i_mode = file_inode(in)->i_mode;
        if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
                return -EINVAL;
 
 
 
 static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
        u64 block = squashfs_i(inode)->start + msblk->directory_table;
        int offset = squashfs_i(inode)->offset, length, dir_count, size,
 
        if (!f.file)
                goto out;
 
-       i_mode = f.file->f_path.dentry->d_inode->i_mode;
+       i_mode = file_inode(f.file)->i_mode;
        ret = -ESPIPE;
        if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) &&
                        !S_ISLNK(i_mode))
 
 read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
 {
        struct bin_buffer *bb = file->private_data;
-       int size = file->f_path.dentry->d_inode->i_size;
+       int size = file_inode(file)->i_size;
        loff_t offs = *off;
        int count = min_t(size_t, bytes, PAGE_SIZE);
        char *temp;
                     size_t bytes, loff_t *off)
 {
        struct bin_buffer *bb = file->private_data;
-       int size = file->f_path.dentry->d_inode->i_size;
+       int size = file_inode(file)->i_size;
        loff_t offs = *off;
        int count = min_t(size_t, bytes, PAGE_SIZE);
        char *temp;
        mutex_lock(&sysfs_bin_lock);
 
        hlist_for_each_entry(bb, tmp, &attr_sd->s_bin_attr.buffers, list) {
-               struct inode *inode = bb->file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(bb->file);
 
                unmap_mapping_range(inode->i_mapping, 0, 0, 1);
        }
 
 static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
        unsigned long pos = filp->f_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        unsigned offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
 
        struct qstr nm;
        union ubifs_key key;
        struct ubifs_dent_node *dent;
-       struct inode *dir = file->f_path.dentry->d_inode;
+       struct inode *dir = file_inode(file);
        struct ubifs_info *c = dir->i_sb->s_fs_info;
 
        dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, file->f_pos);
 
                                 struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        struct ubifs_info *c = inode->i_sb->s_fs_info;
        struct timespec now = ubifs_current_time(inode);
        struct ubifs_budget_req req = { .new_page = 1 };
 
 long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int flags, err;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        switch (cmd) {
        case FS_IOC_GETFLAGS:
 
 
 static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *dir = filp->f_path.dentry->d_inode;
+       struct inode *dir = file_inode(filp);
        int result;
 
        if (filp->f_pos == 0) {
 
 {
        ssize_t retval;
        struct file *file = iocb->ki_filp;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int err, pos;
        size_t count = iocb->ki_left;
        struct udf_inode_info *iinfo = UDF_I(inode);
 
 long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        long old_block, new_block;
        int result = -EINVAL;
 
 
 ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
        loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct super_block *sb = inode->i_sb;
        unsigned int offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
 
                goto out_put_tmp_file;
        }
 
-       if (IS_SWAPFILE(f.file->f_path.dentry->d_inode) ||
-           IS_SWAPFILE(tmp.file->f_path.dentry->d_inode)) {
+       if (IS_SWAPFILE(file_inode(f.file)) ||
+           IS_SWAPFILE(file_inode(tmp.file))) {
                error = XFS_ERROR(EINVAL);
                goto out_put_tmp_file;
        }
 
-       ip = XFS_I(f.file->f_path.dentry->d_inode);
-       tip = XFS_I(tmp.file->f_path.dentry->d_inode);
+       ip = XFS_I(file_inode(f.file));
+       tip = XFS_I(file_inode(tmp.file));
 
        if (ip->i_mount != tip->i_mount) {
                error = XFS_ERROR(EINVAL);
 
        loff_t          offset,
        loff_t          len)
 {
-       struct inode    *inode = file->f_path.dentry->d_inode;
+       struct inode    *inode = file_inode(file);
        long            error;
        loff_t          new_size = 0;
        xfs_flock64_t   bf;
        void            *dirent,
        filldir_t       filldir)
 {
-       struct inode    *inode = filp->f_path.dentry->d_inode;
+       struct inode    *inode = file_inode(filp);
        xfs_inode_t     *ip = XFS_I(inode);
        int             error;
        size_t          bufsize;
 
                f = fdget(hreq->fd);
                if (!f.file)
                        return -EBADF;
-               inode = f.file->f_path.dentry->d_inode;
+               inode = file_inode(f.file);
        } else {
                error = user_lpath((const char __user *)hreq->path, &path);
                if (error)
        /*
         * Only allow handle opens under a directory.
         */
-       if (!S_ISDIR(parfilp->f_path.dentry->d_inode->i_mode))
+       if (!S_ISDIR(file_inode(parfilp)->i_mode))
                return ERR_PTR(-ENOTDIR);
 
        if (hlen != sizeof(xfs_handle_t))
        unsigned int            cmd,
        unsigned long           p)
 {
-       struct inode            *inode = filp->f_path.dentry->d_inode;
+       struct inode            *inode = file_inode(filp);
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
        void                    __user *arg = (void __user *)p;
 
        unsigned                cmd,
        unsigned long           p)
 {
-       struct inode            *inode = filp->f_path.dentry->d_inode;
+       struct inode            *inode = file_inode(filp);
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
        void                    __user *arg = (void __user *)p;
 
        return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
 }
 
+static inline struct inode *file_inode(struct file *f)
+{
+       return f->f_path.dentry->d_inode;
+}
+
 /*
  * get_write_access() gets write permission for a file.
  * put_write_access() releases this write permission.
 }
 static inline int deny_write_access(struct file *file)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY;
 }
 static inline void put_write_access(struct inode * inode)
 static inline void allow_write_access(struct file *file)
 {
        if (file)
-               atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
+               atomic_inc(&file_inode(file)->i_writecount);
 }
 #ifdef CONFIG_IMA
 static inline void i_readcount_dec(struct inode *inode)
 
 static inline void fsnotify_close(struct file *file)
 {
        struct path *path = &file->f_path;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        fmode_t mode = file->f_mode;
        __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
 
 
 
 static inline struct hstate *hstate_file(struct file *f)
 {
-       return hstate_inode(f->f_dentry->d_inode);
+       return hstate_inode(file_inode(f));
 }
 
 static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
 
 
 static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
 {
-       return file->f_file->f_path.dentry->d_inode;
+       return file_inode(file->f_file);
 }
 
 static inline int __nlm_privileged_request4(const struct sockaddr *sap)
 
 static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
                                size_t count, loff_t *off)
 {
-       struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode);
+       struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
        char buffer[FILENT_SIZE];
        ssize_t ret;
 
        if (ret <= 0)
                return ret;
 
-       filp->f_path.dentry->d_inode->i_atime = filp->f_path.dentry->d_inode->i_ctime = CURRENT_TIME;
+       file_inode(filp)->i_atime = file_inode(filp)->i_ctime = CURRENT_TIME;
        return ret;
 }
 
 static int mqueue_flush_file(struct file *filp, fl_owner_t id)
 {
-       struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode);
+       struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
 
        spin_lock(&info->lock);
        if (task_tgid(current) == info->notify_owner)
 
 static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab)
 {
-       struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode);
+       struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
        int retval = 0;
 
        poll_wait(filp, &info->wait_q, poll_tab);
                goto out;
        }
 
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
        if (unlikely(f.file->f_op != &mqueue_file_operations)) {
                ret = -EBADF;
                goto out_fput;
                goto out;
        }
 
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
        if (unlikely(f.file->f_op != &mqueue_file_operations)) {
                ret = -EBADF;
                goto out_fput;
                goto out;
        }
 
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
        if (unlikely(f.file->f_op != &mqueue_file_operations)) {
                ret = -EBADF;
                goto out_fput;
                goto out;
        }
 
-       inode = f.file->f_path.dentry->d_inode;
+       inode = file_inode(f.file);
        if (unlikely(f.file->f_op != &mqueue_file_operations)) {
                ret = -EBADF;
                goto out_fput;
 
        if (!is_file_hugepages(shp->shm_file))
                shmem_lock(shp->shm_file, 0, shp->mlock_user);
        else if (shp->mlock_user)
-               user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size,
+               user_shm_unlock(file_inode(shp->shm_file)->i_size,
                                                shp->mlock_user);
        fput (shp->shm_file);
        security_shm_free(shp);
         * shmid gets reported as "inode#" in /proc/pid/maps.
         * proc-ps tools use this. Changing this will break them.
         */
-       file->f_dentry->d_inode->i_ino = shp->shm_perm.id;
+       file_inode(file)->i_ino = shp->shm_perm.id;
 
        ns->shm_tot += numpages;
        error = shp->shm_perm.id;
 {
        struct inode *inode;
 
-       inode = shp->shm_file->f_path.dentry->d_inode;
+       inode = file_inode(shp->shm_file);
 
        if (is_file_hugepages(shp->shm_file)) {
                struct address_space *mapping = inode->i_mapping;
                        (vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) {
 
 
-                       size = vma->vm_file->f_path.dentry->d_inode->i_size;
+                       size = file_inode(vma->vm_file)->i_size;
                        do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start);
                        /*
                         * We discovered the size of the shm segment, so
 
        if (IS_ERR(file))
                return PTR_ERR(file);
 
-       if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) {
+       if (!S_ISREG(file_inode(file)->i_mode)) {
                filp_close(file, NULL);
                return -EACCES;
        }
 
  */
 static inline struct cftype *__file_cft(struct file *file)
 {
-       if (file->f_dentry->d_inode->i_fop != &cgroup_file_operations)
+       if (file_inode(file)->i_fop != &cgroup_file_operations)
                return ERR_PTR(-EINVAL);
        return __d_cft(file->f_dentry);
 }
 
        /* the process need read permission on control file */
        /* AV: shouldn't we check that it's been opened for read instead? */
-       ret = inode_permission(cfile->f_path.dentry->d_inode, MAY_READ);
+       ret = inode_permission(file_inode(cfile), MAY_READ);
        if (ret < 0)
                goto fail;
 
        struct inode *inode;
        struct cgroup_subsys_state *css;
 
-       inode = f->f_dentry->d_inode;
+       inode = file_inode(f);
        /* check in cgroup filesystem dir */
        if (inode->i_op != &cgroup_dir_inode_operations)
                return ERR_PTR(-EBADF);
 
 
 static int perf_fasync(int fd, struct file *filp, int on)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct perf_event *event = filp->private_data;
        int retval;
 
 
                tmp->vm_next = tmp->vm_prev = NULL;
                file = tmp->vm_file;
                if (file) {
-                       struct inode *inode = file->f_path.dentry->d_inode;
+                       struct inode *inode = file_inode(file);
                        struct address_space *mapping = file->f_mapping;
 
                        get_file(file);
 
 static ssize_t write_irq_affinity(int type, struct file *file,
                const char __user *buffer, size_t count, loff_t *pos)
 {
-       unsigned int irq = (int)(long)PDE(file->f_path.dentry->d_inode)->data;
+       unsigned int irq = (int)(long)PDE(file_inode(file))->data;
        cpumask_var_t new_value;
        int err;
 
 
                return PTR_ERR(file);
 
        err = -EINVAL;
-       ei = PROC_I(file->f_dentry->d_inode);
+       ei = PROC_I(file_inode(file));
        ops = ei->ns_ops;
        if (nstype && (ops->type != nstype))
                goto out;
 
        if (!desc->count)
                return 0;
 
-       mutex_lock(&filp->f_path.dentry->d_inode->i_mutex);
+       mutex_lock(&file_inode(filp)->i_mutex);
        do {
                if (!relay_file_read_avail(buf, *ppos))
                        break;
                        *ppos = relay_file_read_end_pos(buf, read_start, ret);
                }
        } while (desc->count && ret);
-       mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
+       mutex_unlock(&file_inode(filp)->i_mutex);
 
        return desc->written;
 }
 
 static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
 {
        struct fd exe;
-       struct dentry *dentry;
+       struct inode *inode;
        int err;
 
        exe = fdget(fd);
        if (!exe.file)
                return -EBADF;
 
-       dentry = exe.file->f_path.dentry;
+       inode = file_inode(exe.file);
 
        /*
         * Because the original mm->exe_file points to executable file, make
         * overall picture.
         */
        err = -EACCES;
-       if (!S_ISREG(dentry->d_inode->i_mode)   ||
+       if (!S_ISREG(inode->i_mode)     ||
            exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC)
                goto exit;
 
-       err = inode_permission(dentry->d_inode, MAY_EXEC);
+       err = inode_permission(inode, MAY_EXEC);
        if (err)
                goto exit;
 
 
        if (!f.file)
                return -EBADF;
 
-       if (S_ISFIFO(f.file->f_path.dentry->d_inode->i_mode)) {
+       if (S_ISFIFO(file_inode(f.file)->i_mode)) {
                ret = -ESPIPE;
                goto out;
        }
 
 int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        int ret = VM_FAULT_LOCKED;
 
        sb_start_pagefault(inode->i_sb);
 
 
 static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma)
 {
-       return subpool_inode(vma->vm_file->f_dentry->d_inode);
+       return subpool_inode(file_inode(vma->vm_file));
 }
 
 /*
        address = address & huge_page_mask(h);
        pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
                        vma->vm_pgoff;
-       mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
+       mapping = file_inode(vma->vm_file)->i_mapping;
 
        /*
         * Take the mapping lock for the duration of the table walk. As
 
                struct file *file, struct address_space *mapping)
 {
        if (vma->vm_flags & VM_DENYWRITE)
-               atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
+               atomic_inc(&file_inode(file)->i_writecount);
        if (vma->vm_flags & VM_SHARED)
                mapping->i_mmap_writable--;
 
                struct address_space *mapping = file->f_mapping;
 
                if (vma->vm_flags & VM_DENYWRITE)
-                       atomic_dec(&file->f_path.dentry->d_inode->i_writecount);
+                       atomic_dec(&file_inode(file)->i_writecount);
                if (vma->vm_flags & VM_SHARED)
                        mapping->i_mmap_writable++;
 
                        return -EAGAIN;
        }
 
-       inode = file ? file->f_path.dentry->d_inode : NULL;
+       inode = file ? file_inode(file) : NULL;
 
        if (file) {
                switch (flags & MAP_TYPE) {
        int error;
        struct rb_node **rb_link, *rb_parent;
        unsigned long charged = 0;
-       struct inode *inode =  file ? file->f_path.dentry->d_inode : NULL;
+       struct inode *inode =  file ? file_inode(file) : NULL;
 
        /* Clear old maps */
        error = -ENOMEM;
 
                 */
                mapping = file->f_mapping;
                if (!mapping)
-                       mapping = file->f_path.dentry->d_inode->i_mapping;
+                       mapping = file_inode(file)->i_mapping;
 
                capabilities = 0;
                if (mapping && mapping->backing_dev_info)
                if (!capabilities) {
                        /* no explicit capabilities set, so assume some
                         * defaults */
-                       switch (file->f_path.dentry->d_inode->i_mode & S_IFMT) {
+                       switch (file_inode(file)->i_mode & S_IFMT) {
                        case S_IFREG:
                        case S_IFBLK:
                                capabilities = BDI_CAP_MAP_COPY;
                            !(file->f_mode & FMODE_WRITE))
                                return -EACCES;
 
-                       if (IS_APPEND(file->f_path.dentry->d_inode) &&
+                       if (IS_APPEND(file_inode(file)) &&
                            (file->f_mode & FMODE_WRITE))
                                return -EACCES;
 
-                       if (locks_verify_locked(file->f_path.dentry->d_inode))
+                       if (locks_verify_locked(file_inode(file)))
                                return -EAGAIN;
 
                        if (!(capabilities & BDI_CAP_MAP_DIRECT))
                                continue;
 
                        /* search for overlapping mappings on the same file */
-                       if (pregion->vm_file->f_path.dentry->d_inode !=
-                           file->f_path.dentry->d_inode)
+                       if (file_inode(pregion->vm_file) !=
+                           file_inode(file))
                                continue;
 
                        if (pregion->vm_pgoff >= pgend)
 
 
 static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        int error;
        int ret = VM_FAULT_LOCKED;
 
 #ifdef CONFIG_NUMA
 static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol)
 {
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol);
 }
 
 static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
                                          unsigned long addr)
 {
-       struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(vma->vm_file);
        pgoff_t index;
 
        index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
 int shmem_lock(struct file *file, int lock, struct user_struct *user)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct shmem_inode_info *info = SHMEM_I(inode);
        int retval = -ENOMEM;
 
 
 static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct address_space *mapping = inode->i_mapping;
        pgoff_t index;
        unsigned long offset;
 static long shmem_fallocate(struct file *file, int mode, loff_t offset,
                                                         loff_t len)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
        struct shmem_falloc shmem_falloc;
        pgoff_t start, index, end;
 
        len = seq_path(swap, &file->f_path, " \t\n\\");
        seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
                        len < 40 ? 40 - len : 1, " ",
-                       S_ISBLK(file->f_path.dentry->d_inode->i_mode) ?
+                       S_ISBLK(file_inode(file)->i_mode) ?
                                "partition" : "file\t",
                        si->pages << (PAGE_SHIFT - 10),
                        si->inuse_pages << (PAGE_SHIFT - 10),
 
        page = get_zeroed_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
-       dev = PDE(file->f_path.dentry->d_inode)->data;
+       dev = PDE(file_inode(file))->data;
        if (!dev->ops->proc_read)
                length = -EINVAL;
        else {
 
        if (IS_ERR(file))
                return ERR_CAST(file);
 
-       ei = PROC_I(file->f_dentry->d_inode);
+       ei = PROC_I(file_inode(file));
        if (ei->ns_ops == &netns_operations)
                net = get_net(ei->ns);
        else
 
 static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
                                size_t size, loff_t *ofs)
 {
-       struct clusterip_config *c = PDE(file->f_path.dentry->d_inode)->data;
+       struct clusterip_config *c = PDE(file_inode(file))->data;
 #define PROC_WRITELEN  10
        char buffer[PROC_WRITELEN+1];
        unsigned long nodenum;
 
 recent_mt_proc_write(struct file *file, const char __user *input,
                     size_t size, loff_t *loff)
 {
-       const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       const struct proc_dir_entry *pde = PDE(file_inode(file));
        struct recent_table *t = pde->data;
        struct recent_entry *e;
        char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
 
 
 struct sock *netlink_getsockbyfilp(struct file *filp)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct sock *sock;
 
        if (!S_ISSOCK(inode->i_mode))
 
        const void *p, *end;
        void *buf;
        struct gss_upcall_msg *gss_msg;
-       struct rpc_pipe *pipe = RPC_I(filp->f_dentry->d_inode)->pipe;
+       struct rpc_pipe *pipe = RPC_I(file_inode(filp))->pipe;
        struct gss_cl_ctx *ctx;
        uid_t uid;
        ssize_t err = -EFBIG;
 
 {
        struct cache_reader *rp = filp->private_data;
        struct cache_request *rq;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int err;
 
        if (count == 0)
                           struct cache_detail *cd)
 {
        struct address_space *mapping = filp->f_mapping;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        ssize_t ret = -EINVAL;
 
        if (!cd->cache_parse)
 static ssize_t cache_read_procfs(struct file *filp, char __user *buf,
                                 size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data;
+       struct cache_detail *cd = PDE(file_inode(filp))->data;
 
        return cache_read(filp, buf, count, ppos, cd);
 }
 static ssize_t cache_write_procfs(struct file *filp, const char __user *buf,
                                  size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data;
+       struct cache_detail *cd = PDE(file_inode(filp))->data;
 
        return cache_write(filp, buf, count, ppos, cd);
 }
 
 static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait)
 {
-       struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data;
+       struct cache_detail *cd = PDE(file_inode(filp))->data;
 
        return cache_poll(filp, wait, cd);
 }
 static long cache_ioctl_procfs(struct file *filp,
                               unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct cache_detail *cd = PDE(inode)->data;
 
        return cache_ioctl(inode, filp, cmd, arg, cd);
 static ssize_t read_flush_procfs(struct file *filp, char __user *buf,
                            size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data;
+       struct cache_detail *cd = PDE(file_inode(filp))->data;
 
        return read_flush(filp, buf, count, ppos, cd);
 }
                                  const char __user *buf,
                                  size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data;
+       struct cache_detail *cd = PDE(file_inode(filp))->data;
 
        return write_flush(filp, buf, count, ppos, cd);
 }
 static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
                                 size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private;
+       struct cache_detail *cd = RPC_I(file_inode(filp))->private;
 
        return cache_read(filp, buf, count, ppos, cd);
 }
 static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf,
                                  size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private;
+       struct cache_detail *cd = RPC_I(file_inode(filp))->private;
 
        return cache_write(filp, buf, count, ppos, cd);
 }
 
 static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait)
 {
-       struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private;
+       struct cache_detail *cd = RPC_I(file_inode(filp))->private;
 
        return cache_poll(filp, wait, cd);
 }
 static long cache_ioctl_pipefs(struct file *filp,
                              unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct cache_detail *cd = RPC_I(inode)->private;
 
        return cache_ioctl(inode, filp, cmd, arg, cd);
 static ssize_t read_flush_pipefs(struct file *filp, char __user *buf,
                            size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private;
+       struct cache_detail *cd = RPC_I(file_inode(filp))->private;
 
        return read_flush(filp, buf, count, ppos, cd);
 }
                                  const char __user *buf,
                                  size_t count, loff_t *ppos)
 {
-       struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private;
+       struct cache_detail *cd = RPC_I(file_inode(filp))->private;
 
        return write_flush(filp, buf, count, ppos, cd);
 }
 
 static ssize_t
 rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct rpc_pipe *pipe;
        struct rpc_pipe_msg *msg;
        int res = 0;
 static ssize_t
 rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *offset)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        int res;
 
        mutex_lock(&inode->i_mutex);
 static unsigned int
 rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct rpc_inode *rpci = RPC_I(inode);
        unsigned int mask = POLLOUT | POLLWRNORM;
 
 static long
 rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
        struct rpc_pipe *pipe;
        int len;
 
  * responses to upcalls.  They will result in calls to @msg->downcall.
  *
  * The @private argument passed here will be available to all these methods
- * from the file pointer, via RPC_I(file->f_dentry->d_inode)->private.
+ * from the file pointer, via RPC_I(file_inode(file))->private.
  */
 struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
                                 void *private, struct rpc_pipe *pipe)
 
 struct sock *unix_get_socket(struct file *filp)
 {
        struct sock *u_sock = NULL;
-       struct inode *inode = filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(filp);
 
        /*
         *      Socket ?
 
        unsigned int state;
        struct file_perms perms = {};
        struct path_cond cond = {
-               bprm->file->f_path.dentry->d_inode->i_uid,
-               bprm->file->f_path.dentry->d_inode->i_mode
+               file_inode(bprm->file)->i_uid,
+               file_inode(bprm->file)->i_mode
        };
        const char *name = NULL, *target = NULL, *info = NULL;
        int error = cap_bprm_set_creds(bprm);
 
                 u32 request)
 {
        struct path_cond cond = {
-               .uid = file->f_path.dentry->d_inode->i_uid,
-               .mode = file->f_path.dentry->d_inode->i_mode
+               .uid = file_inode(file)->i_uid,
+               .mode = file_inode(file)->i_mode
        };
 
        return aa_path_perm(op, profile, &file->f_path, PATH_DELEGATE_DELETED,
 
        struct aa_profile *profile;
        int error = 0;
 
-       if (!mediated_filesystem(file->f_path.dentry->d_inode))
+       if (!mediated_filesystem(file_inode(file)))
                return 0;
 
        /* If in exec, permission is handled by bprm hooks.
 
        profile = aa_cred_profile(cred);
        if (!unconfined(profile)) {
-               struct inode *inode = file->f_path.dentry->d_inode;
+               struct inode *inode = file_inode(file);
                struct path_cond cond = { inode->i_uid, inode->i_mode };
 
                error = aa_path_perm(OP_OPEN, profile, &file->f_path, 0,
        BUG_ON(!fprofile);
 
        if (!file->f_path.mnt ||
-           !mediated_filesystem(file->f_path.dentry->d_inode))
+           !mediated_filesystem(file_inode(file)))
                return 0;
 
        profile = __aa_current_profile();
 
 int ima_collect_measurement(struct integrity_iint_cache *iint,
                            struct file *file)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        const char *filename = file->f_dentry->d_name.name;
        int result = 0;
 
        if (!(iint->flags & IMA_COLLECTED)) {
-               u64 i_version = file->f_dentry->d_inode->i_version;
+               u64 i_version = file_inode(file)->i_version;
 
                iint->ima_xattr.type = IMA_XATTR_DIGEST;
                result = ima_calc_hash(file, iint->ima_xattr.digest);
        const char *op = "add_template_measure";
        const char *audit_cause = "ENOMEM";
        int result = -ENOMEM;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct ima_template_entry *entry;
        int violation = 0;
 
 
                file->f_mode |= FMODE_READ;
                read = 1;
        }
-       i_size = i_size_read(file->f_dentry->d_inode);
+       i_size = i_size_read(file_inode(file));
        while (offset < i_size) {
                int rbuf_len;
 
 
  */
 void ima_file_free(struct file *file)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct integrity_iint_cache *iint;
 
        if (!iint_initialized || !S_ISREG(inode->i_mode))
 static int process_measurement(struct file *file, const unsigned char *filename,
                               int mask, int function)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct integrity_iint_cache *iint;
        unsigned char *pathname = NULL, *pathbuf = NULL;
        int rc = -ENOMEM, action, must_appraise;
 
                         u32 av)
 {
        struct file_security_struct *fsec = file->f_security;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct common_audit_data ad;
        u32 sid = cred_sid(cred);
        int rc;
        struct task_security_struct *new_tsec;
        struct inode_security_struct *isec;
        struct common_audit_data ad;
-       struct inode *inode = bprm->file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(bprm->file);
        int rc;
 
        rc = cap_bprm_set_creds(bprm);
 static int selinux_revalidate_file_permission(struct file *file, int mask)
 {
        const struct cred *cred = current_cred();
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        /* file_mask_to_av won't add FILE__WRITE if MAY_APPEND is set */
        if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE))
 
 static int selinux_file_permission(struct file *file, int mask)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct file_security_struct *fsec = file->f_security;
        struct inode_security_struct *isec = inode->i_security;
        u32 sid = current_sid();
        struct inode_security_struct *isec;
 
        fsec = file->f_security;
-       isec = file->f_path.dentry->d_inode->i_security;
+       isec = file_inode(file)->i_security;
        /*
         * Save inode label and policy sequence number
         * at open-time so that selinux_file_permission
 
 {
        char tmpbuf[TMPBUFLEN];
        ssize_t length;
-       ino_t ino = filp->f_path.dentry->d_inode->i_ino;
+       ino_t ino = file_inode(filp)->i_ino;
        int handle_unknown = (ino == SEL_REJECT_UNKNOWN) ?
                security_get_reject_unknown() : !security_get_allow_unknown();
 
 
 static ssize_t selinux_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
 {
-       ino_t ino = file->f_path.dentry->d_inode->i_ino;
+       ino_t ino = file_inode(file)->i_ino;
        char *data;
        ssize_t rv;
 
        ssize_t length;
        ssize_t ret;
        int cur_enforcing;
-       struct inode *inode = filep->f_path.dentry->d_inode;
-       unsigned index = inode->i_ino & SEL_INO_MASK;
+       unsigned index = file_inode(filep)->i_ino & SEL_INO_MASK;
        const char *name = filep->f_path.dentry->d_name.name;
 
        mutex_lock(&sel_mutex);
        char *page = NULL;
        ssize_t length;
        int new_value;
-       struct inode *inode = filep->f_path.dentry->d_inode;
-       unsigned index = inode->i_ino & SEL_INO_MASK;
+       unsigned index = file_inode(filep)->i_ino & SEL_INO_MASK;
        const char *name = filep->f_path.dentry->d_name.name;
 
        mutex_lock(&sel_mutex);
 static ssize_t sel_read_initcon(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
 {
-       struct inode *inode;
        char *con;
        u32 sid, len;
        ssize_t ret;
 
-       inode = file->f_path.dentry->d_inode;
-       sid = inode->i_ino&SEL_INO_MASK;
+       sid = file_inode(file)->i_ino&SEL_INO_MASK;
        ret = security_sid_to_context(sid, &con, &len);
        if (ret)
                return ret;
 static ssize_t sel_read_class(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
 {
-       unsigned long ino = file->f_path.dentry->d_inode->i_ino;
+       unsigned long ino = file_inode(file)->i_ino;
        char res[TMPBUFLEN];
        ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_class(ino));
        return simple_read_from_buffer(buf, count, ppos, res, len);
 static ssize_t sel_read_perm(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
 {
-       unsigned long ino = file->f_path.dentry->d_inode->i_ino;
+       unsigned long ino = file_inode(file)->i_ino;
        char res[TMPBUFLEN];
        ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_perm(ino));
        return simple_read_from_buffer(buf, count, ppos, res, len);
        int value;
        char tmpbuf[TMPBUFLEN];
        ssize_t length;
-       unsigned long i_ino = file->f_path.dentry->d_inode->i_ino;
+       unsigned long i_ino = file_inode(file)->i_ino;
 
        value = security_policycap_supported(i_ino & SEL_INO_MASK);
        length = scnprintf(tmpbuf, TMPBUFLEN, "%d", value);
 
  */
 static int smack_bprm_set_creds(struct linux_binprm *bprm)
 {
-       struct inode *inode = bprm->file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(bprm->file);
        struct task_smack *bsp = bprm->cred->security;
        struct inode_smack *isp;
        int rc;
        char *msmack;
        char *osmack;
        struct inode_smack *isp;
-       struct dentry *dp;
        int may;
        int mmay;
        int tmay;
        int rc;
 
-       if (file == NULL || file->f_dentry == NULL)
-               return 0;
-
-       dp = file->f_dentry;
-
-       if (dp->d_inode == NULL)
+       if (file == NULL)
                return 0;
 
-       isp = dp->d_inode->i_security;
+       isp = file_inode(file)->i_security;
        if (isp->smk_mmap == NULL)
                return 0;
        msmack = isp->smk_mmap;
  */
 static int smack_file_open(struct file *file, const struct cred *cred)
 {
-       struct inode_smack *isp = file->f_path.dentry->d_inode->i_security;
+       struct inode_smack *isp = file_inode(file)->i_security;
 
        file->f_security = isp->smk_inode;
 
 
  */
 static int tomoyo_open(struct inode *inode, struct file *file)
 {
-       const int key = ((u8 *) file->f_path.dentry->d_inode->i_private)
+       const int key = ((u8 *) file_inode(file)->i_private)
                - ((u8 *) NULL);
        return tomoyo_open_control(key, file);
 }
 
 
 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct snd_info_private_data *data;
        struct snd_info_entry *entry;
 
 
        file = fget_light(fd, fput_needed);
        if (!file)
                return NULL;
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
        if (!S_ISCHR(inode->i_mode) ||
            imajor(inode) != snd_major) {
                fput_light(file, *fput_needed);
 
 
 static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       int minor = iminor(file->f_path.dentry->d_inode);
+       int minor = iminor(file_inode(file));
        int ret;
 
        if (cmd == OSS_GETVERSION) {
 
 static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off)
 {
-       int minor = iminor(file->f_path.dentry->d_inode);
+       int minor = iminor(file_inode(file));
        if (minor == dev.dsp_minor)
                return dsp_read(buf, count);
        else
 
 static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
 {
-       int minor = iminor(file->f_path.dentry->d_inode);
+       int minor = iminor(file_inode(file));
        if (minor == dev.dsp_minor)
                return dsp_write(buf, count);
        else
 
 
 static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        int ret = -EINVAL;
 
        /*
 
 static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
        int ret = -EINVAL;
        
        mutex_lock(&soundcard_mutex);
 static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int len = 0, dtype;
-       int dev = iminor(file->f_dentry->d_inode);
+       int dev = iminor(file_inode(file));
        long ret = -EINVAL;
        void __user *p = (void __user *)arg;
 
 
 static unsigned int sound_poll(struct file *file, poll_table * wait)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int dev = iminor(inode);
 
        DEB(printk("sound_poll(dev=%d)\n", dev));
        int dev_class;
        unsigned long size;
        struct dma_buffparms *dmap = NULL;
-       int dev = iminor(file->f_path.dentry->d_inode);
+       int dev = iminor(file_inode(file));
 
        dev_class = dev & 0x0f;
        dev >>= 4;
 
                printk(KERN_INFO "Unable to load '%s'.\n", fn);
                return 0;
        }
-       l = i_size_read(filp->f_path.dentry->d_inode);
+       l = i_size_read(file_inode(filp));
        if (l <= 0 || l > 131072)
        {
                printk(KERN_INFO "Invalid firmware '%s'\n", fn);