Unionfs: rename file->f_dentry references to file->f_path.dentry
authorErez_Zadok <ezk@cs.sunysb.edu>
Fri, 16 Nov 2007 20:48:31 +0000 (15:48 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:02:56 +0000 (19:02 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/commonfops.c
fs/unionfs/copyup.c
fs/unionfs/debug.c
fs/unionfs/dirfops.c
fs/unionfs/export.c
fs/unionfs/fanout.h
fs/unionfs/file.c
fs/unionfs/mmap.c
fs/unionfs/odf.c

index 9507001d5cf091bc26aca7b09bcc5cca52bcec12..9f6b2dac7af8be5857dc7b0205aa2c0af2566d51 100644 (file)
@@ -73,7 +73,7 @@ retry:
        dput(tmp_dentry);
 
        err = copyup_named_file(dentry->d_parent->d_inode, file, name, bstart,
-                               bindex, file->f_dentry->d_inode->i_size);
+                               bindex, file->f_path.dentry->d_inode->i_size);
        if (err) {
                if (err == -EEXIST)
                        goto retry;
@@ -172,7 +172,7 @@ static void cleanup_file(struct file *file)
 {
        int bindex, bstart, bend;
        struct file **lf;
-       struct super_block *sb = file->f_dentry->d_sb;
+       struct super_block *sb = file->f_path.dentry->d_sb;
 
        lf = UNIONFS_F(file)->lower_files;
        bstart = fbstart(file);
@@ -224,7 +224,7 @@ static int open_all_files(struct file *file)
        int bindex, bstart, bend, err = 0;
        struct file *lower_file;
        struct dentry *lower_dentry;
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
        struct super_block *sb = dentry->d_sb;
 
        bstart = dbstart(dentry);
@@ -259,7 +259,7 @@ static int open_highest_file(struct file *file, int willwrite)
        int bindex, bstart, bend, err = 0;
        struct file *lower_file;
        struct dentry *lower_dentry;
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
        struct inode *parent_inode = dentry->d_parent->d_inode;
        struct super_block *sb = dentry->d_sb;
        size_t inode_size = dentry->d_inode->i_size;
@@ -304,7 +304,7 @@ out:
 static int do_delayed_copyup(struct file *file)
 {
        int bindex, bstart, bend, err = 0;
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
        struct inode *parent_inode = dentry->d_parent->d_inode;
        loff_t inode_size = dentry->d_inode->i_size;
 
@@ -373,7 +373,7 @@ int unionfs_file_revalidate(struct file *file, int willwrite)
        int size;
        int err = 0;
 
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
        unionfs_lock_dentry(dentry);
        sb = dentry->d_sb;
 
@@ -467,21 +467,21 @@ static int __open_dir(struct inode *inode, struct file *file)
        struct dentry *odf_cache;
        struct timespec *newest;
        int err;
-       bstart = fbstart(file) = dbstart(file->f_dentry);
-       bend = fbend(file) = dbend(file->f_dentry);
+       bstart = fbstart(file) = dbstart(file->f_path.dentry);
+       bend = fbend(file) = dbend(file->f_path.dentry);
 
-       newest = &file->f_dentry->d_inode->i_mtime;
+       newest = &file->f_path.dentry->d_inode->i_mtime;
 
        for (bindex = bstart; bindex <= bend; bindex++) {
                lower_dentry =
-                       unionfs_lower_dentry_idx(file->f_dentry, bindex);
+                       unionfs_lower_dentry_idx(file->f_path.dentry, bindex);
                if (!lower_dentry)
                        continue;
 
                dget(lower_dentry);
-               unionfs_mntget(file->f_dentry, bindex);
+               unionfs_mntget(file->f_path.dentry, bindex);
                lower_file = dentry_open(lower_dentry,
-                                        unionfs_lower_mnt_idx(file->f_dentry,
+                                        unionfs_lower_mnt_idx(file->f_path.dentry,
                                                               bindex),
                                         file->f_flags);
                if (IS_ERR(lower_file))
@@ -500,10 +500,10 @@ static int __open_dir(struct inode *inode, struct file *file)
                branchget(inode->i_sb, bindex);
        }
 
-       odf_cache = odf_ic_cache_dentry(file->f_dentry);
+       odf_cache = odf_ic_cache_dentry(file->f_path.dentry);
        if (IS_ERR(odf_cache))
                return PTR_ERR(odf_cache);
-       err = odf_cache_dir(file->f_dentry, odf_cache, newest);
+       err = odf_cache_dir(file->f_path.dentry, odf_cache, newest);
        /* FIXME: store the dentry somewhere */
        dput(odf_cache);
        return err;
@@ -517,17 +517,17 @@ static int __open_file(struct inode *inode, struct file *file)
        int lower_flags;
        int bindex, bstart, bend;
 
-       lower_dentry = unionfs_lower_dentry(file->f_dentry);
+       lower_dentry = unionfs_lower_dentry(file->f_path.dentry);
        lower_flags = file->f_flags;
 
-       bstart = fbstart(file) = dbstart(file->f_dentry);
-       bend = fbend(file) = dbend(file->f_dentry);
+       bstart = fbstart(file) = dbstart(file->f_path.dentry);
+       bend = fbend(file) = dbend(file->f_path.dentry);
 
        /*
         * check for the permission for lower file.  If the error is
         * COPYUP_ERR, copyup the file.
         */
-       if (lower_dentry->d_inode && is_robranch(file->f_dentry)) {
+       if (lower_dentry->d_inode && is_robranch(file->f_path.dentry)) {
                /*
                 * if the open will change the file, copy it up otherwise
                 * defer it.
@@ -539,7 +539,7 @@ static int __open_file(struct inode *inode, struct file *file)
                        /* copyup the file */
                        for (bindex = bstart - 1; bindex >= 0; bindex--) {
                                err = copyup_file(
-                                       file->f_dentry->d_parent->d_inode,
+                                       file->f_path.dentry->d_parent->d_inode,
                                        file, bstart, bindex, size);
                                if (!err)
                                        break;
@@ -555,10 +555,10 @@ static int __open_file(struct inode *inode, struct file *file)
         * dentry_open will decrement mnt refcnt if err.
         * otherwise fput() will do an mntput() for us upon file close.
         */
-       unionfs_mntget(file->f_dentry, bstart);
+       unionfs_mntget(file->f_path.dentry, bstart);
        lower_file =
                dentry_open(lower_dentry,
-                           unionfs_lower_mnt_idx(file->f_dentry, bstart),
+                           unionfs_lower_mnt_idx(file->f_path.dentry, bstart),
                            lower_flags);
        if (IS_ERR(lower_file))
                return PTR_ERR(lower_file);
@@ -603,7 +603,7 @@ int unionfs_open(struct inode *inode, struct file *file)
                goto out;
        }
 
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
 
        /*
         * FIXME: With nfs exporting we can get a disconnected dentry here.
@@ -641,7 +641,7 @@ int unionfs_open(struct inode *inode, struct file *file)
                        if (!lower_file)
                                continue;
 
-                       branchput(file->f_dentry->d_sb, bindex);
+                       branchput(file->f_path.dentry->d_sb, bindex);
                        /* fput calls dput for lower_dentry */
                        fput(lower_file);
                }
@@ -660,7 +660,7 @@ out_nofree:
        unionfs_check_inode(inode);
        if (!err) {
                unionfs_check_file(file);
-               unionfs_check_dentry(file->f_dentry->d_parent);
+               unionfs_check_dentry(file->f_path.dentry->d_parent);
        }
        return err;
 }
@@ -688,7 +688,7 @@ int unionfs_file_release(struct inode *inode, struct file *file)
                goto out;
        unionfs_check_file(file);
        fileinfo = UNIONFS_F(file);
-       BUG_ON(file->f_dentry->d_inode != inode);
+       BUG_ON(file->f_path.dentry->d_inode != inode);
 
        /* fput all the lower files */
        fgen = atomic_read(&fileinfo->generation);
@@ -732,7 +732,7 @@ static long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                err = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
        } else if (lower_file->f_op->ioctl) {
                lock_kernel();
-               err = lower_file->f_op->ioctl(lower_file->f_dentry->d_inode,
+               err = lower_file->f_op->ioctl(lower_file->f_path.dentry->d_inode,
                                              lower_file, cmd, arg);
                unlock_kernel();
        }
@@ -757,7 +757,7 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
        struct dentry *dentry, *lower_dentry;
        struct vfsmount *mnt;
 
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
        unionfs_lock_dentry(dentry);
        orig_bstart = dbstart(dentry);
        orig_bend = dbend(dentry);
index 470561fb72d34eae374a9ee81d5c4e294c5e4532..3a1836d0ff9d516d00cd7b26f25f34a49bf984be 100644 (file)
@@ -512,7 +512,7 @@ int copyup_named_file(struct inode *dir, struct file *file, char *name,
        int err = 0;
        struct file *output_file = NULL;
 
-       err = copyup_dentry(dir, file->f_dentry, bstart, new_bindex,
+       err = copyup_dentry(dir, file->f_path.dentry, bstart, new_bindex,
                            name, strlen(name), &output_file, len);
        if (!err) {
                fbstart(file) = new_bindex;
@@ -531,7 +531,7 @@ int copyup_file(struct inode *dir, struct file *file, int bstart,
 {
        int err = 0;
        struct file *output_file = NULL;
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
 
        err = copyup_dentry(dir, dentry, bstart, new_bindex,
                            dentry->d_name.name, dentry->d_name.len,
index b4d35d62e7ad15355bc5667621b4f2a7b97377a6..cc9d42ad676c6e95edae7e9efb1fbf62b20a6357 100644 (file)
@@ -333,7 +333,7 @@ void __unionfs_check_file(const struct file *file,
        int printed_caller = 0;
 
        BUG_ON(!file);
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
        sb = dentry->d_sb;
        dstart = dbstart(dentry);
        dend = dbend(dentry);
index 49bf6faa49ee7cc64a212d8dbe33b061b6d7158e..2354dfa45886f17d3061b61628775fe5ae2f66f0 100644 (file)
@@ -41,7 +41,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
        /* Get the odf/ic file */
        /* FIXME: this should be saved somewhere, also check mtime */
-       odf_cache = odf_ic_cache_dentry(file->f_dentry);
+       odf_cache = odf_ic_cache_dentry(file->f_path.dentry);
        if (IS_ERR(odf_cache)){
                err = PTR_ERR(odf_cache);
                odf_cache = NULL;
@@ -55,10 +55,10 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
                 * odf cache dir calls partial lookup which expects a locked
                 * dentry
                 */
-               unionfs_lock_dentry(file->f_dentry);
-               err = odf_cache_dir(file->f_dentry, odf_cache,
-                                   &file->f_dentry->d_inode->i_mtime);
-               unionfs_unlock_dentry(file->f_dentry);
+               unionfs_lock_dentry(file->f_path.dentry);
+               err = odf_cache_dir(file->f_path.dentry, odf_cache,
+                                   &file->f_path.dentry->d_inode->i_mtime);
+               unionfs_unlock_dentry(file->f_path.dentry);
                if (err)
                        goto out;
 
@@ -72,13 +72,13 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
        }
 
        dget(odf_cache);
-       mntget(UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt);
+       mntget(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt);
        odf_file = dentry_open(odf_cache,
-                              UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt,
+                              UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt,
                               O_RDONLY);
        if (IS_ERR(odf_file)){
                err = PTR_ERR(odf_file);
-               mntput(UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt);
+               mntput(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt);
                dput(odf_cache);
                odf_file = NULL;
                goto out;
@@ -127,7 +127,7 @@ out:
        if (odf_file)
                filp_close(odf_file, NULL);
        dput(odf_cache);
-       unionfs_read_unlock(file->f_dentry->d_sb);
+       unionfs_read_unlock(file->f_path.dentry->d_sb);
        return err;
 }
 
index cb0f15000e5a272de64fcfabec5e63b80b399ca2..4e6173e1fb85fd0ae31f84b62fcf117c8297ef2f 100644 (file)
@@ -238,7 +238,7 @@ static int unionfs_get_name(struct dentry *dentry, char *name,
 
        /* search for the inode in the dir */
        file->f_pos = 0;
-       while (file->f_pos < file->f_dentry->d_inode->i_size) {
+       while (file->f_pos < file->f_path.dentry->d_inode->i_size) {
                err = odf_read_dirent(file, &tmp_name, &namelen, &ino,
                                      &d_type);
                if (err)
index f6393ea423a9539e530a737ee89d2d52249c55e4..e5fa9e2073108141c856d5b173a62972552a2f3a 100644 (file)
@@ -105,7 +105,7 @@ static inline void unionfs_set_lower_file_idx(struct file *f, int index,
        UNIONFS_F(f)->lower_files[index] = val;
        /* save branch ID (may be redundant?) */
        UNIONFS_F(f)->saved_branch_ids[index] =
-               branch_id((f)->f_dentry->d_sb, index);
+               branch_id((f)->f_path.dentry->d_sb, index);
 }
 
 static inline void unionfs_set_lower_file(struct file *f, struct file *val)
index 8f42da3d2d4a8ffd663d711594bcc6561b5860a4..e978766e715dc6cbc041e1f56cfeecf1d71a8d1a 100644 (file)
@@ -79,7 +79,7 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,
        err = do_sync_write(file, buf, count, ppos);
        /* update our inode times upon a successful lower write */
        if (err >= 0) {
-               unionfs_copy_attr_times(file->f_dentry->d_inode);
+               unionfs_copy_attr_times(file->f_path.dentry->d_inode);
                unionfs_check_file(file);
        }
 
@@ -133,9 +133,9 @@ out:
        unionfs_read_unlock(file->f_path.dentry->d_sb);
        if (!err) {
                /* copyup could cause parent dir times to change */
-               unionfs_copy_attr_times(file->f_dentry->d_parent->d_inode);
+               unionfs_copy_attr_times(file->f_path.dentry->d_parent->d_inode);
                unionfs_check_file(file);
-               unionfs_check_dentry(file->f_dentry->d_parent);
+               unionfs_check_dentry(file->f_path.dentry->d_parent);
        }
        return err;
 }
index 7b4a6f56994a984435790e1ee6a846550b8347cb..56937b7684915fd076b1f49e0bb28b2fa0c8f36f 100644 (file)
@@ -121,7 +121,7 @@ static int unionfs_do_readpage(struct file *file, struct page *page)
        struct page *lower_page;
        char *lower_page_data;
 
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
        if (UNIONFS_F(file) == NULL) {
                err = -ENOENT;
                goto out_err;
@@ -200,7 +200,7 @@ int unionfs_readpage(struct file *file, struct page *page)
 {
        int err;
 
-       unionfs_read_lock(file->f_dentry->d_sb);
+       unionfs_read_lock(file->f_path.dentry->d_sb);
        if ((err = unionfs_file_revalidate(file, 0)))
                goto out;
        unionfs_check_file(file);
@@ -210,7 +210,7 @@ int unionfs_readpage(struct file *file, struct page *page)
        if (!err) {
                touch_atime(unionfs_lower_mnt(file->f_path.dentry),
                            unionfs_lower_dentry(file->f_path.dentry));
-               unionfs_copy_attr_times(file->f_dentry->d_inode);
+               unionfs_copy_attr_times(file->f_path.dentry->d_inode);
        }
 
        /*
@@ -221,7 +221,7 @@ int unionfs_readpage(struct file *file, struct page *page)
 out:
        unlock_page(page);
        unionfs_check_file(file);
-       unionfs_read_unlock(file->f_dentry->d_sb);
+       unionfs_read_unlock(file->f_path.dentry->d_sb);
 
        return err;
 }
@@ -231,7 +231,7 @@ int unionfs_prepare_write(struct file *file, struct page *page, unsigned from,
 {
        int err;
 
-       unionfs_read_lock(file->f_dentry->d_sb);
+       unionfs_read_lock(file->f_path.dentry->d_sb);
        /*
         * This is the only place where we unconditionally copy the lower
         * attribute times before calling unionfs_file_revalidate.  The
@@ -243,10 +243,10 @@ int unionfs_prepare_write(struct file *file, struct page *page, unsigned from,
         * changed lower mtimes, and avoid an invariant violation warning,
         * is here, in ->prepare_write.
         */
-       unionfs_copy_attr_times(file->f_dentry->d_inode);
+       unionfs_copy_attr_times(file->f_path.dentry->d_inode);
        err = unionfs_file_revalidate(file, 1);
        unionfs_check_file(file);
-       unionfs_read_unlock(file->f_dentry->d_sb);
+       unionfs_read_unlock(file->f_path.dentry->d_sb);
 
        return err;
 }
@@ -264,7 +264,7 @@ int unionfs_commit_write(struct file *file, struct page *page, unsigned from,
 
        BUG_ON(file == NULL);
 
-       unionfs_read_lock(file->f_dentry->d_sb);
+       unionfs_read_lock(file->f_path.dentry->d_sb);
        if ((err = unionfs_file_revalidate(file, 1)))
                goto out;
        unionfs_check_file(file);
@@ -312,7 +312,7 @@ out:
        if (err < 0)
                ClearPageUptodate(page);
 
-       unionfs_read_unlock(file->f_dentry->d_sb);
+       unionfs_read_unlock(file->f_path.dentry->d_sb);
        unionfs_check_file(file);
        return err;             /* assume all is ok */
 }
index 7a1723cc51a3382428258c009e511ec870ea6317..826b80cf05ab44d07b446282556fca8ceff9a9f1 100644 (file)
@@ -589,7 +589,7 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
        oldfs = get_fs();
        set_fs(KERNEL_DS);
 
-       size = i_size_read(link_file->f_dentry->d_inode);
+       size = i_size_read(link_file->f_path.dentry->d_inode);
 
 
        if (size == 0) {