2006-10-21 07:13:16

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 00 of 23] struct file: Use struct path

The struct file changes in the following patches were suggested by Al Viro
during the discussion of struct path almost a week ago.

The first patch changes struct file to use struct path instead of just
having struct dentry and struct vfsmount pointers.

The remaining patches change several filesystem, the kernel/ and mm/
directories, as well as the i386 and x86_64 arch code.

These patches depend on the struct path patches from October 18th already in
-mm.

102 files changed, 463 insertions(+), 461 deletions(-)

Signed-off-by: Josef "Jeff" Sipek <[email protected]>



2006-10-21 07:13:22

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 13 of 23] x86_64: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the x86_64 arch code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86_64/ia32/ia32_aout.c | 8 ++++----

diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -272,7 +272,7 @@ static int load_aout_binary(struct linux
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_dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
+ i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
return -ENOEXEC;
}

@@ -357,7 +357,7 @@ static int load_aout_binary(struct linux
{
printk(KERN_WARNING
"fd_offset is not page aligned. Please convert program: %s\n",
- bprm->file->f_dentry->d_name.name);
+ bprm->file->f_path.dentry->d_name.name);
error_time = jiffies;
}
#endif
@@ -440,7 +440,7 @@ static int load_aout_library(struct file
int retval;
struct exec ex;

- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;

retval = -ENOEXEC;
error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
@@ -471,7 +471,7 @@ static int load_aout_library(struct file
{
printk(KERN_WARNING
"N_TXTOFF is not page aligned. Please convert library: %s\n",
- file->f_dentry->d_name.name);
+ file->f_path.dentry->d_name.name);
error_time = jiffies;
}
#endif


2006-10-21 07:13:54

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 12 of 23] i386: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the i386 arch code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 5 insertions(+), 5 deletions(-)
arch/i386/kernel/cpuid.c | 4 ++--
arch/i386/kernel/msr.c | 6 +++---

diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -117,7 +117,7 @@ static ssize_t cpuid_read(struct file *f
char __user *tmp = buf;
u32 data[4];
u32 reg = *ppos;
- int cpu = iminor(file->f_dentry->d_inode);
+ int cpu = iminor(file->f_path.dentry->d_inode);

if (count % 16)
return -EINVAL; /* Invalid chunk size */
@@ -135,7 +135,7 @@ static ssize_t cpuid_read(struct file *f

static int cpuid_open(struct inode *inode, struct file *file)
{
- unsigned int cpu = iminor(file->f_dentry->d_inode);
+ unsigned int cpu = iminor(file->f_path.dentry->d_inode);
struct cpuinfo_x86 *c = &(cpu_data)[cpu];

if (cpu >= NR_CPUS || !cpu_online(cpu))
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -172,7 +172,7 @@ static ssize_t msr_read(struct file *fil
u32 __user *tmp = (u32 __user *) buf;
u32 data[2];
u32 reg = *ppos;
- int cpu = iminor(file->f_dentry->d_inode);
+ int cpu = iminor(file->f_path.dentry->d_inode);
int err;

if (count % 8)
@@ -197,7 +197,7 @@ static ssize_t msr_write(struct file *fi
u32 data[2];
size_t rv;
u32 reg = *ppos;
- int cpu = iminor(file->f_dentry->d_inode);
+ int cpu = iminor(file->f_path.dentry->d_inode);
int err;

if (count % 8)
@@ -217,7 +217,7 @@ static ssize_t msr_write(struct file *fi

static int msr_open(struct inode *inode, struct file *file)
{
- unsigned int cpu = iminor(file->f_dentry->d_inode);
+ unsigned int cpu = iminor(file->f_path.dentry->d_inode);
struct cpuinfo_x86 *c = &(cpu_data)[cpu];

if (cpu >= NR_CPUS || !cpu_online(cpu))


2006-10-21 07:14:24

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 19 of 23] autofs4: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the autofs4 filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 10 insertions(+), 9 deletions(-)
fs/autofs4/autofs_i.h | 3 ++-
fs/autofs4/root.c | 16 ++++++++--------

diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -150,7 +150,8 @@ static inline int autofs4_ispending(stru

static inline void autofs4_copy_atime(struct file *src, struct file *dst)
{
- dst->f_dentry->d_inode->i_atime = src->f_dentry->d_inode->i_atime;
+ dst->f_path.dentry->d_inode->i_atime =
+ src->f_path.dentry->d_inode->i_atime;
return;
}

diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -74,7 +74,7 @@ static int autofs4_root_readdir(struct f
static int autofs4_root_readdir(struct file *file, void *dirent,
filldir_t filldir)
{
- struct autofs_sb_info *sbi = autofs4_sbi(file->f_dentry->d_sb);
+ struct autofs_sb_info *sbi = autofs4_sbi(file->f_path.dentry->d_sb);
int oz_mode = autofs4_oz_mode(sbi);

DPRINTK("called, filp->f_pos = %lld", file->f_pos);
@@ -95,8 +95,8 @@ static int autofs4_root_readdir(struct f

static int autofs4_dir_open(struct inode *inode, struct file *file)
{
- struct dentry *dentry = file->f_dentry;
- struct vfsmount *mnt = file->f_vfsmnt;
+ struct dentry *dentry = file->f_path.dentry;
+ struct vfsmount *mnt = file->f_path.mnt;
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct dentry *cursor;
int status;
@@ -172,7 +172,7 @@ out:

static int autofs4_dir_close(struct inode *inode, struct file *file)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct dentry *cursor = file->private_data;
int status = 0;
@@ -204,7 +204,7 @@ out:

static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldir)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct dentry *cursor = file->private_data;
int status;
@@ -858,14 +858,14 @@ static int autofs4_root_ioctl(struct ino
return autofs4_ask_reghost(sbi, p);

case AUTOFS_IOC_ASKUMOUNT:
- return autofs4_ask_umount(filp->f_vfsmnt, p);
+ return autofs4_ask_umount(filp->f_path.mnt, p);

/* return a single thing to expire */
case AUTOFS_IOC_EXPIRE:
- return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi, p);
+ return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p);
/* same as above, but can send multiple expires through pipe */
case AUTOFS_IOC_EXPIRE_MULTI:
- return autofs4_expire_multi(inode->i_sb,filp->f_vfsmnt,sbi, p);
+ return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p);

default:
return -ENOSYS;


2006-10-21 07:13:47

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 18 of 23] autofs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the autofs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

1 file changed, 2 insertions(+), 2 deletions(-)
fs/autofs/root.c | 4 ++--

diff --git a/fs/autofs/root.c b/fs/autofs/root.c
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -45,7 +45,7 @@ static int autofs_root_readdir(struct fi
struct autofs_dir_ent *ent = NULL;
struct autofs_dirhash *dirhash;
struct autofs_sb_info *sbi;
- struct inode * inode = filp->f_dentry->d_inode;
+ struct inode * inode = filp->f_path.dentry->d_inode;
off_t onr, nr;

lock_kernel();
@@ -557,7 +557,7 @@ static int autofs_root_ioctl(struct inod
case AUTOFS_IOC_SETTIMEOUT:
return autofs_get_set_timeout(sbi, argp);
case AUTOFS_IOC_EXPIRE:
- return autofs_expire_run(inode->i_sb, sbi, filp->f_vfsmnt,
+ return autofs_expire_run(inode->i_sb, sbi, filp->f_path.mnt,
argp);
default:
return -ENOSYS;


2006-10-21 07:15:12

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 08 of 23] isofs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the isofs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 3 insertions(+), 4 deletions(-)
fs/isofs/compress.c | 2 +-
fs/isofs/dir.c | 5 ++---

diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -42,7 +42,7 @@ static struct semaphore zisofs_zlib_sema
*/
static int zisofs_readpage(struct file *file, struct page *page)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
unsigned int maxpage, xpage, fpage, blockindex;
unsigned long offset;
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -183,7 +183,7 @@ static int do_isofs_readdir(struct inode

/* Handle the case of the '..' directory */
if (de->name_len[0] == 1 && de->name[0] == 1) {
- inode_number = parent_ino(filp->f_dentry);
+ inode_number = parent_ino(filp->f_path.dentry);
if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
break;
filp->f_pos += de_len;
@@ -255,8 +255,7 @@ static int isofs_readdir(struct file *fi
int result;
char * tmpname;
struct iso_directory_record * tmpde;
- struct inode *inode = filp->f_dentry->d_inode;
-
+ struct inode *inode = filp->f_path.dentry->d_inode;

tmpname = (char *)__get_free_page(GFP_KERNEL);
if (tmpname == NULL)


2006-10-21 07:15:56

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 11 of 23] ntfs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the ntfs filesystem code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 4 insertions(+), 4 deletions(-)
fs/ntfs/dir.c | 6 +++---
fs/ntfs/file.c | 2 +-

diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1101,7 +1101,7 @@ static int ntfs_readdir(struct file *fil
{
s64 ia_pos, ia_start, prev_ia_pos, bmp_pos;
loff_t fpos, i_size;
- struct inode *bmp_vi, *vdir = filp->f_dentry->d_inode;
+ struct inode *bmp_vi, *vdir = filp->f_path.dentry->d_inode;
struct super_block *sb = vdir->i_sb;
ntfs_inode *ndir = NTFS_I(vdir);
ntfs_volume *vol = NTFS_SB(sb);
@@ -1136,9 +1136,9 @@ static int ntfs_readdir(struct file *fil
if (fpos == 1) {
ntfs_debug("Calling filldir for .. with len 2, fpos 0x1, "
"inode 0x%lx, DT_DIR.",
- (unsigned long)parent_ino(filp->f_dentry));
+ (unsigned long)parent_ino(filp->f_path.dentry));
rc = filldir(dirent, "..", 2, fpos,
- parent_ino(filp->f_dentry), DT_DIR);
+ parent_ino(filp->f_path.dentry), DT_DIR);
if (rc)
goto done;
fpos++;
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2162,7 +2162,7 @@ static ssize_t ntfs_file_aio_write_noloc
goto out;
if (!count)
goto out;
- err = remove_suid(file->f_dentry);
+ err = remove_suid(file->f_path.dentry);
if (err)
goto out;
file_update_time(file);


2006-10-21 07:14:49

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 05 of 23] ext3: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the ext3 filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

4 files changed, 8 insertions(+), 8 deletions(-)
fs/ext3/dir.c | 8 ++++----
fs/ext3/file.c | 2 +-
fs/ext3/ioctl.c | 2 +-
fs/ext3/namei.c | 4 ++--

diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -103,7 +103,7 @@ static int ext3_readdir(struct file * fi
struct ext3_dir_entry_2 *de;
struct super_block *sb;
int err;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int ret = 0;

sb = inode->i_sb;
@@ -122,7 +122,7 @@ static int ext3_readdir(struct file * fi
* 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_dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
+ EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
}
#endif
stored = 0;
@@ -399,7 +399,7 @@ static int call_filldir(struct file * fi
{
struct dir_private_info *info = filp->private_data;
loff_t curr_pos;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct super_block * sb;
int error;

@@ -429,7 +429,7 @@ static int ext3_dx_readdir(struct file *
void * dirent, filldir_t filldir)
{
struct dir_private_info *info = filp->private_data;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct fname *fname;
int ret;

diff --git a/fs/ext3/file.c b/fs/ext3/file.c
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -52,7 +52,7 @@ ext3_file_write(struct kiocb *iocb, cons
unsigned long nr_segs, loff_t pos)
{
struct file *file = iocb->ki_filp;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
ssize_t ret;
int err;

diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -257,7 +257,7 @@ flags_err:
#ifdef CONFIG_COMPAT
long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
int ret;

/* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -593,7 +593,7 @@ int ext3_htree_fill_tree(struct file *di

dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
start_minor_hash));
- dir = dir_file->f_dentry->d_inode;
+ dir = dir_file->f_path.dentry->d_inode;
if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
@@ -604,7 +604,7 @@ int ext3_htree_fill_tree(struct file *di
}
hinfo.hash = start_hash;
hinfo.minor_hash = 0;
- frame = dx_probe(NULL, dir_file->f_dentry->d_inode, &hinfo, frames, &err);
+ frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
if (!frame)
return err;



2006-10-21 07:15:13

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 04 of 23] ext2: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the ext2 filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 2 insertions(+), 2 deletions(-)
fs/ext2/dir.c | 2 +-
fs/ext2/ioctl.c | 2 +-

diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -248,7 +248,7 @@ ext2_readdir (struct file * filp, void *
ext2_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 = filp->f_path.dentry->d_inode;
struct super_block *sb = inode->i_sb;
unsigned int offset = pos & ~PAGE_CACHE_MASK;
unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -86,7 +86,7 @@ int ext2_ioctl (struct inode * inode, st
#ifdef CONFIG_COMPAT
long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
int ret;

/* These are just misnamed, they actually get/put from/to user an int */


2006-10-21 07:16:23

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 14 of 23] kernel: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in linux/kernel/.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

5 files changed, 16 insertions(+), 16 deletions(-)
kernel/acct.c | 14 +++++++-------
kernel/fork.c | 2 +-
kernel/futex.c | 10 +++++-----
kernel/relay.c | 4 ++--
kernel/sysctl.c | 2 +-

diff --git a/kernel/acct.c b/kernel/acct.c
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -117,7 +117,7 @@ static int check_free_space(struct file
spin_unlock(&acct_globals.lock);

/* May block */
- if (vfs_statfs(file->f_dentry, &sbuf))
+ if (vfs_statfs(file->f_path.dentry, &sbuf))
return res;
suspend = sbuf.f_blocks * SUSPEND;
resume = sbuf.f_blocks * RESUME;
@@ -193,7 +193,7 @@ static void acct_file_reopen(struct file
add_timer(&acct_globals.timer);
}
if (old_acct) {
- mnt_unpin(old_acct->f_vfsmnt);
+ mnt_unpin(old_acct->f_path.mnt);
spin_unlock(&acct_globals.lock);
do_acct_process(old_acct);
filp_close(old_acct, NULL);
@@ -211,7 +211,7 @@ static int acct_on(char *name)
if (IS_ERR(file))
return PTR_ERR(file);

- if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
+ if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) {
filp_close(file, NULL);
return -EACCES;
}
@@ -228,11 +228,11 @@ static int acct_on(char *name)
}

spin_lock(&acct_globals.lock);
- mnt_pin(file->f_vfsmnt);
+ mnt_pin(file->f_path.mnt);
acct_file_reopen(file);
spin_unlock(&acct_globals.lock);

- mntput(file->f_vfsmnt); /* it's pinned, now give up active reference */
+ mntput(file->f_path.mnt); /* it's pinned, now give up active reference */

return 0;
}
@@ -282,7 +282,7 @@ void acct_auto_close_mnt(struct vfsmount
void acct_auto_close_mnt(struct vfsmount *m)
{
spin_lock(&acct_globals.lock);
- if (acct_globals.file && acct_globals.file->f_vfsmnt == m)
+ if (acct_globals.file && acct_globals.file->f_path.mnt == m)
acct_file_reopen(NULL);
spin_unlock(&acct_globals.lock);
}
@@ -298,7 +298,7 @@ void acct_auto_close(struct super_block
{
spin_lock(&acct_globals.lock);
if (acct_globals.file &&
- acct_globals.file->f_vfsmnt->mnt_sb == sb) {
+ acct_globals.file->f_path.mnt->mnt_sb == sb) {
acct_file_reopen(NULL);
}
spin_unlock(&acct_globals.lock);
diff --git a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -252,7 +252,7 @@ static inline int dup_mmap(struct mm_str
anon_vma_link(tmp);
file = tmp->vm_file;
if (file) {
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
get_file(file);
if (tmp->vm_flags & VM_DENYWRITE)
atomic_dec(&inode->i_writecount);
diff --git a/kernel/futex.c b/kernel/futex.c
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -166,7 +166,7 @@ static inline int match_futex(union fute
/*
* Get parameters which are the keys for a futex.
*
- * For shared mappings, it's (page->index, vma->vm_file->f_dentry->d_inode,
+ * For shared mappings, it's (page->index, vma->vm_file->f_path.dentry->d_inode,
* offset_within_page). For private mappings, it's (uaddr, current->mm).
* We can usually work out the index without swapping in the page.
*
@@ -223,7 +223,7 @@ static int get_futex_key(u32 __user *uad
/*
* Linear file mappings are also simple.
*/
- key->shared.inode = vma->vm_file->f_dentry->d_inode;
+ key->shared.inode = vma->vm_file->f_path.dentry->d_inode;
key->both.offset++; /* Bit 0 of offset indicates inode-based key. */
if (likely(!(vma->vm_flags & VM_NONLINEAR))) {
key->shared.pgoff = (((address - vma->vm_start) >> PAGE_SHIFT)
@@ -1522,9 +1522,9 @@ static int futex_fd(u32 __user *uaddr, i
goto out;
}
filp->f_op = &futex_fops;
- filp->f_vfsmnt = mntget(futex_mnt);
- filp->f_dentry = dget(futex_mnt->mnt_root);
- filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
+ filp->f_path.mnt = mntget(futex_mnt);
+ filp->f_path.dentry = dget(futex_mnt->mnt_root);
+ filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;

if (signal) {
err = __f_setown(filp, task_pid(current), PIDTYPE_PID, 1);
diff --git a/kernel/relay.c b/kernel/relay.c
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -957,7 +957,7 @@ static inline ssize_t relay_file_read_su
if (!desc->count)
return 0;

- mutex_lock(&filp->f_dentry->d_inode->i_mutex);
+ mutex_lock(&filp->f_path.dentry->d_inode->i_mutex);
do {
if (!relay_file_read_avail(buf, *ppos))
break;
@@ -977,7 +977,7 @@ static inline ssize_t relay_file_read_su
*ppos = relay_file_read_end_pos(buf, read_start, ret);
}
} while (desc->count && ret);
- mutex_unlock(&filp->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);

return desc->written;
}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1614,7 +1614,7 @@ static ssize_t do_rw_proc(int write, str
size_t count, loff_t *ppos)
{
int op;
- struct proc_dir_entry *de = PDE(file->f_dentry->d_inode);
+ struct proc_dir_entry *de = PDE(file->f_path.dentry->d_inode);
struct ctl_table *table;
size_t res;
ssize_t error = -ENOTDIR;


2006-10-21 07:16:47

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 02 of 23] sysfs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the sysfs filesystem code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

3 files changed, 20 insertions(+), 20 deletions(-)
fs/sysfs/bin.c | 14 +++++++-------
fs/sysfs/dir.c | 10 +++++-----
fs/sysfs/file.c | 16 ++++++++--------

diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -35,7 +35,7 @@ read(struct file * file, char __user * u
read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
{
char *buffer = file->private_data;
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
loff_t offs = *off;
int ret;
@@ -81,7 +81,7 @@ static ssize_t write(struct file * file,
size_t count, loff_t * off)
{
char *buffer = file->private_data;
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
loff_t offs = *off;

@@ -105,7 +105,7 @@ static ssize_t write(struct file * file,

static int mmap(struct file *file, struct vm_area_struct *vma)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct bin_attribute *attr = to_bin_attr(dentry);
struct kobject *kobj = to_kobj(dentry->d_parent);

@@ -117,8 +117,8 @@ static int mmap(struct file *file, struc

static int open(struct inode * inode, struct file * file)
{
- struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent);
- struct bin_attribute * attr = to_bin_attr(file->f_dentry);
+ struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent);
+ struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
int error = -EINVAL;

if (!kobj || !attr)
@@ -153,8 +153,8 @@ static int open(struct inode * inode, st

static int release(struct inode * inode, struct file * file)
{
- struct kobject * kobj = to_kobj(file->f_dentry->d_parent);
- struct bin_attribute * attr = to_bin_attr(file->f_dentry);
+ struct kobject * kobj = to_kobj(file->f_path.dentry->d_parent);
+ struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
u8 * buffer = file->private_data;

if (kobj)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -374,7 +374,7 @@ int sysfs_rename_dir(struct kobject * ko

static int sysfs_dir_open(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;
struct sysfs_dirent * parent_sd = dentry->d_fsdata;

mutex_lock(&dentry->d_inode->i_mutex);
@@ -387,7 +387,7 @@ static int sysfs_dir_open(struct inode *

static int sysfs_dir_close(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;
struct sysfs_dirent * cursor = file->private_data;

mutex_lock(&dentry->d_inode->i_mutex);
@@ -407,7 +407,7 @@ static inline unsigned char dt_type(stru

static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct sysfs_dirent * parent_sd = dentry->d_fsdata;
struct sysfs_dirent *cursor = filp->private_data;
struct list_head *p, *q = &cursor->s_sibling;
@@ -464,7 +464,7 @@ static int sysfs_readdir(struct file * f

static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;

mutex_lock(&dentry->d_inode->i_mutex);
switch (origin) {
@@ -474,7 +474,7 @@ static loff_t sysfs_dir_lseek(struct fil
if (offset >= 0)
break;
default:
- mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return -EINVAL;
}
if (offset != file->f_pos) {
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -154,7 +154,7 @@ sysfs_read_file(struct file *file, char

down(&buffer->sem);
if (buffer->needs_read_fill) {
- if ((retval = fill_read_buffer(file->f_dentry,buffer)))
+ if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
goto out;
}
pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -242,7 +242,7 @@ sysfs_write_file(struct file *file, cons
down(&buffer->sem);
len = fill_write_buffer(buffer, buf, count);
if (len > 0)
- len = flush_write_buffer(file->f_dentry, buffer, len);
+ len = flush_write_buffer(file->f_path.dentry, buffer, len);
if (len > 0)
*ppos += len;
up(&buffer->sem);
@@ -251,8 +251,8 @@ sysfs_write_file(struct file *file, cons

static int check_perm(struct inode * inode, struct file * file)
{
- struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent);
- struct attribute * attr = to_attr(file->f_dentry);
+ struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent);
+ struct attribute * attr = to_attr(file->f_path.dentry);
struct sysfs_buffer * buffer;
struct sysfs_ops * ops = NULL;
int error = 0;
@@ -334,8 +334,8 @@ static int sysfs_open_file(struct inode

static int sysfs_release(struct inode * inode, struct file * filp)
{
- struct kobject * kobj = to_kobj(filp->f_dentry->d_parent);
- struct attribute * attr = to_attr(filp->f_dentry);
+ struct kobject * kobj = to_kobj(filp->f_path.dentry->d_parent);
+ struct attribute * attr = to_attr(filp->f_path.dentry);
struct module * owner = attr->owner;
struct sysfs_buffer * buffer = filp->private_data;

@@ -369,8 +369,8 @@ static unsigned int sysfs_poll(struct fi
static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
{
struct sysfs_buffer * buffer = filp->private_data;
- struct kobject * kobj = to_kobj(filp->f_dentry->d_parent);
- struct sysfs_dirent * sd = filp->f_dentry->d_fsdata;
+ struct kobject * kobj = to_kobj(filp->f_path.dentry->d_parent);
+ struct sysfs_dirent * sd = filp->f_path.dentry->d_fsdata;
int res = 0;

poll_wait(filp, &kobj->poll, wait);


2006-10-21 07:16:46

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 15 of 23] mm: change uses of f_{dentry,vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in linux/mm/.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

6 files changed, 21 insertions(+), 21 deletions(-)
mm/fadvise.c | 2 +-
mm/filemap.c | 2 +-
mm/filemap_xip.c | 2 +-
mm/mmap.c | 10 +++++-----
mm/shmem.c | 20 ++++++++++----------
mm/swapfile.c | 6 +++---

diff --git a/mm/fadvise.c b/mm/fadvise.c
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -38,7 +38,7 @@ asmlinkage long sys_fadvise64_64(int fd,
if (!file)
return -EBADF;

- if (S_ISFIFO(file->f_dentry->d_inode->i_mode)) {
+ if (S_ISFIFO(file->f_path.dentry->d_inode->i_mode)) {
ret = -ESPIPE;
goto out;
}
diff --git a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2267,7 +2267,7 @@ __generic_file_aio_write_nolock(struct k
if (count == 0)
goto out;

- err = remove_suid(file->f_dentry);
+ err = remove_suid(file->f_path.dentry);
if (err)
goto out;

diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -379,7 +379,7 @@ xip_file_write(struct file *filp, const
if (count == 0)
goto out_backing;

- ret = remove_suid(filp->f_dentry);
+ ret = remove_suid(filp->f_path.dentry);
if (ret)
goto out_backing;

diff --git a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -188,7 +188,7 @@ static void __remove_shared_vm_struct(st
struct file *file, struct address_space *mapping)
{
if (vma->vm_flags & VM_DENYWRITE)
- atomic_inc(&file->f_dentry->d_inode->i_writecount);
+ atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
if (vma->vm_flags & VM_SHARED)
mapping->i_mmap_writable--;

@@ -399,7 +399,7 @@ static inline void __vma_link_file(struc
struct address_space *mapping = file->f_mapping;

if (vma->vm_flags & VM_DENYWRITE)
- atomic_dec(&file->f_dentry->d_inode->i_writecount);
+ atomic_dec(&file->f_path.dentry->d_inode->i_writecount);
if (vma->vm_flags & VM_SHARED)
mapping->i_mmap_writable++;

@@ -907,7 +907,7 @@ unsigned long do_mmap_pgoff(struct file
* mounted, in which case we dont add PROT_EXEC.)
*/
if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
- if (!(file && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC)))
+ if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC)))
prot |= PROT_EXEC;

if (!len)
@@ -960,7 +960,7 @@ unsigned long do_mmap_pgoff(struct file
return -EAGAIN;
}

- inode = file ? file->f_dentry->d_inode : NULL;
+ inode = file ? file->f_path.dentry->d_inode : NULL;

if (file) {
switch (flags & MAP_TYPE) {
@@ -989,7 +989,7 @@ unsigned long do_mmap_pgoff(struct file
case MAP_PRIVATE:
if (!(file->f_mode & FMODE_READ))
return -EACCES;
- if (file->f_vfsmnt->mnt_flags & MNT_NOEXEC) {
+ if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) {
if (vm_flags & VM_EXEC)
return -EPERM;
vm_flags &= ~VM_MAYEXEC;
diff --git a/mm/shmem.c b/mm/shmem.c
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1225,7 +1225,7 @@ failed:

struct page *shmem_nopage(struct vm_area_struct *vma, unsigned long address, int *type)
{
- struct inode *inode = vma->vm_file->f_dentry->d_inode;
+ struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
struct page *page = NULL;
unsigned long idx;
int error;
@@ -1248,7 +1248,7 @@ static int shmem_populate(struct vm_area
unsigned long addr, unsigned long len,
pgprot_t prot, unsigned long pgoff, int nonblock)
{
- struct inode *inode = vma->vm_file->f_dentry->d_inode;
+ struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
struct mm_struct *mm = vma->vm_mm;
enum sgp_type sgp = nonblock? SGP_QUICK: SGP_CACHE;
unsigned long size;
@@ -1293,14 +1293,14 @@ static int shmem_populate(struct vm_area
#ifdef CONFIG_NUMA
int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
{
- struct inode *i = vma->vm_file->f_dentry->d_inode;
+ struct inode *i = vma->vm_file->f_path.dentry->d_inode;
return mpol_set_shared_policy(&SHMEM_I(i)->policy, vma, new);
}

struct mempolicy *
shmem_get_policy(struct vm_area_struct *vma, unsigned long addr)
{
- struct inode *i = vma->vm_file->f_dentry->d_inode;
+ struct inode *i = vma->vm_file->f_path.dentry->d_inode;
unsigned long idx;

idx = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
@@ -1310,7 +1310,7 @@ shmem_get_policy(struct vm_area_struct *

int shmem_lock(struct file *file, int lock, struct user_struct *user)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct shmem_inode_info *info = SHMEM_I(inode);
int retval = -ENOMEM;

@@ -1422,7 +1422,7 @@ static ssize_t
static ssize_t
shmem_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
loff_t pos;
unsigned long written;
ssize_t err;
@@ -1442,7 +1442,7 @@ shmem_file_write(struct file *file, cons
if (err || !count)
goto out;

- err = remove_suid(file->f_dentry);
+ err = remove_suid(file->f_path.dentry);
if (err)
goto out;

@@ -1524,7 +1524,7 @@ out:

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_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
unsigned long index, offset;

@@ -2493,8 +2493,8 @@ struct file *shmem_file_setup(char *name
d_instantiate(dentry, inode);
inode->i_size = size;
inode->i_nlink = 0; /* It is unlinked */
- file->f_vfsmnt = mntget(shm_mnt);
- file->f_dentry = dentry;
+ file->f_path.mnt = mntget(shm_mnt);
+ file->f_path.dentry = dentry;
file->f_mapping = inode->i_mapping;
file->f_op = &shmem_file_operations;
file->f_mode = FMODE_WRITE | FMODE_READ;
diff --git a/mm/swapfile.c b/mm/swapfile.c
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -447,7 +447,7 @@ int swap_type_of(dev_t device)
spin_unlock(&swap_lock);
return i;
}
- inode = swap_info[i].swap_file->f_dentry->d_inode;
+ inode = swap_info[i].swap_file->f_path.dentry->d_inode;
if (S_ISBLK(inode->i_mode) &&
device == MKDEV(imajor(inode), iminor(inode))) {
spin_unlock(&swap_lock);
@@ -1314,10 +1314,10 @@ static int swap_show(struct seq_file *sw
seq_puts(swap, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");

file = ptr->swap_file;
- len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\");
+ len = seq_path(swap, file->f_path.mnt, file->f_path.dentry, " \t\n\\");
seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
len < 40 ? 40 - len : 1, " ",
- S_ISBLK(file->f_dentry->d_inode->i_mode) ?
+ S_ISBLK(file->f_path.dentry->d_inode->i_mode) ?
"partition" : "file\t",
ptr->pages << (PAGE_SHIFT - 10),
ptr->inuse_pages << (PAGE_SHIFT - 10),


2006-10-21 07:17:26

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 10 of 23] nfsd: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the nfs server code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

3 files changed, 14 insertions(+), 14 deletions(-)
fs/nfsd/nfs4state.c | 10 +++++-----
fs/nfsd/nfsctl.c | 2 +-
fs/nfsd/vfs.c | 16 ++++++++--------

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1310,7 +1310,7 @@ nfs4_file_downgrade(struct file *filp, u
nfs4_file_downgrade(struct file *filp, unsigned int share_access)
{
if (share_access & NFS4_SHARE_ACCESS_WRITE) {
- put_write_access(filp->f_dentry->d_inode);
+ put_write_access(filp->f_path.dentry->d_inode);
filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE;
}
}
@@ -1623,7 +1623,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp
nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open)
{
struct file *filp = stp->st_vfs_file;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
unsigned int share_access, new_writer;
__be32 status;

@@ -1966,7 +1966,7 @@ static inline int
static inline int
nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
{
- return fhp->fh_dentry->d_inode != stp->st_vfs_file->f_dentry->d_inode;
+ return fhp->fh_dentry->d_inode != stp->st_vfs_file->f_path.dentry->d_inode;
}

static int
@@ -2863,7 +2863,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
* only the dentry:inode set.
*/
memset(&file, 0, sizeof (struct file));
- file.f_dentry = current_fh->fh_dentry;
+ file.f_path.dentry = current_fh->fh_dentry;

status = nfs_ok;
if (posix_test_lock(&file, &file_lock, &conflock)) {
@@ -2953,7 +2953,7 @@ check_for_locks(struct file *filp, struc
check_for_locks(struct file *filp, struct nfs4_stateowner *lowner)
{
struct file_lock **flpp;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int status = 0;

lock_kernel();
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -111,7 +111,7 @@ static ssize_t (*write_op[])(struct file

static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
{
- ino_t ino = file->f_dentry->d_inode->i_ino;
+ ino_t ino = file->f_path.dentry->d_inode->i_ino;
char *data;
ssize_t rv;

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -736,10 +736,10 @@ nfsd_sync(struct file *filp)
nfsd_sync(struct file *filp)
{
int err;
- struct inode *inode = filp->f_dentry->d_inode;
- dprintk("nfsd: sync file %s\n", filp->f_dentry->d_name.name);
+ struct inode *inode = filp->f_path.dentry->d_inode;
+ dprintk("nfsd: sync file %s\n", filp->f_path.dentry->d_name.name);
mutex_lock(&inode->i_mutex);
- err=nfsd_dosync(filp, filp->f_dentry, filp->f_op);
+ err=nfsd_dosync(filp, filp->f_path.dentry, filp->f_op);
mutex_unlock(&inode->i_mutex);

return err;
@@ -845,7 +845,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, st
int host_err;

err = nfserr_perm;
- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;
#ifdef MSNFS
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
(!lock_may_read(inode, offset, *count)))
@@ -883,7 +883,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, st
nfsdstats.io_read += host_err;
*count = host_err;
err = 0;
- fsnotify_access(file->f_dentry);
+ fsnotify_access(file->f_path.dentry);
} else
err = nfserrno(host_err);
out:
@@ -917,11 +917,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
err = nfserr_perm;

if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
- (!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
+ (!lock_may_write(file->f_path.dentry->d_inode, offset, cnt)))
goto out;
#endif

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
inode = dentry->d_inode;
exp = fhp->fh_export;

@@ -950,7 +950,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
set_fs(oldfs);
if (host_err >= 0) {
nfsdstats.io_write += cnt;
- fsnotify_modify(file->f_dentry);
+ fsnotify_modify(file->f_path.dentry);
}

/* clear setuid/setgid flag after write */


2006-10-21 07:17:30

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 01 of 23] VFS: change struct file to use struct path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes struct file to use struct path instead of having
independent pointers to struct dentry and struct vfsmount, and converts all
users of f_{dentry,vfsmnt} in fs/ to use f_path.{dentry,mnt}.

Additionally, it adds two #define's to make the transition easier for users
of the f_dentry and f_vfsmnt.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

32 files changed, 140 insertions(+), 138 deletions(-)
fs/binfmt_aout.c | 8 ++++----
fs/binfmt_elf.c | 2 +-
fs/binfmt_elf_fdpic.c | 4 ++--
fs/binfmt_flat.c | 2 +-
fs/binfmt_misc.c | 10 +++++-----
fs/block_dev.c | 8 ++++----
fs/compat.c | 12 ++++++------
fs/compat_ioctl.c | 2 +-
fs/dnotify.c | 4 ++--
fs/dquot.c | 4 ++--
fs/eventpoll.c | 4 ++--
fs/exec.c | 10 +++++-----
fs/fcntl.c | 2 +-
fs/file_table.c | 10 +++++-----
fs/inode.c | 2 +-
fs/inotify_user.c | 6 +++---
fs/ioctl.c | 14 +++++++-------
fs/libfs.c | 14 +++++++-------
fs/locks.c | 32 ++++++++++++++++----------------
fs/namei.c | 10 +++++-----
fs/open.c | 26 +++++++++++++-------------
fs/pipe.c | 28 ++++++++++++++--------------
fs/read_write.c | 20 ++++++++++----------
fs/readdir.c | 2 +-
fs/seq_file.c | 2 +-
fs/splice.c | 12 ++++++------
fs/stat.c | 2 +-
fs/super.c | 2 +-
fs/sync.c | 4 ++--
fs/xattr.c | 8 ++++----
include/linux/fs.h | 10 ++++++----
include/linux/fsnotify.h | 2 +-

diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -274,7 +274,7 @@ static int load_aout_binary(struct linux
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_dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
+ i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
return -ENOEXEC;
}

@@ -389,7 +389,7 @@ static int load_aout_binary(struct linux
{
printk(KERN_WARNING
"fd_offset is not page aligned. Please convert program: %s\n",
- bprm->file->f_dentry->d_name.name);
+ bprm->file->f_path.dentry->d_name.name);
error_time = jiffies;
}

@@ -469,7 +469,7 @@ static int load_aout_library(struct file
int retval;
struct exec ex;

- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;

retval = -ENOEXEC;
error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
@@ -506,7 +506,7 @@ static int load_aout_library(struct file
{
printk(KERN_WARNING
"N_TXTOFF is not page aligned. Please convert library: %s\n",
- file->f_dentry->d_name.name);
+ file->f_path.dentry->d_name.name);
error_time = jiffies;
}
down_write(&current->mm->mmap_sem);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1186,7 +1186,7 @@ static int maydump(struct vm_area_struct

/* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED)
- return vma->vm_file->f_dentry->d_inode->i_nlink == 0;
+ return vma->vm_file->f_path.dentry->d_inode->i_nlink == 0;

/* If it hasn't been written to, don't write it out */
if (!vma->anon_vma)
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -858,7 +858,7 @@ static int elf_fdpic_map_file(struct elf

dynamic_error:
printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
- what, file->f_dentry->d_inode->i_ino);
+ what, file->f_path.dentry->d_inode->i_ino);
return -ELIBBAD;
}

@@ -1189,7 +1189,7 @@ static int maydump(struct vm_area_struct

/* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) {
- if (vma->vm_file->f_dentry->d_inode->i_nlink == 0) {
+ if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags);
return 1;
}
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -429,7 +429,7 @@ static int load_flat_file(struct linux_b
int ret;

hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
- inode = bprm->file->f_dentry->d_inode;
+ inode = bprm->file->f_path.dentry->d_inode;

text_len = ntohl(hdr->data_start);
data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -542,7 +542,7 @@ static ssize_t
static ssize_t
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
- Node *e = file->f_dentry->d_inode->i_private;
+ Node *e = file->f_path.dentry->d_inode->i_private;
loff_t pos = *ppos;
ssize_t res;
char *page;
@@ -576,7 +576,7 @@ static ssize_t bm_entry_write(struct fil
size_t count, loff_t *ppos)
{
struct dentry *root;
- Node *e = file->f_dentry->d_inode->i_private;
+ Node *e = file->f_path.dentry->d_inode->i_private;
int res = parse_command(buffer, count);

switch (res) {
@@ -584,7 +584,7 @@ static ssize_t bm_entry_write(struct fil
break;
case 2: set_bit(Enabled, &e->flags);
break;
- case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root);
+ case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
mutex_lock(&root->d_inode->i_mutex);

kill_node(e);
@@ -610,7 +610,7 @@ static ssize_t bm_register_write(struct
Node *e;
struct inode *inode;
struct dentry *root, *dentry;
- struct super_block *sb = file->f_vfsmnt->mnt_sb;
+ struct super_block *sb = file->f_path.mnt->mnt_sb;
int err = 0;

e = create_entry(buffer, count);
@@ -699,7 +699,7 @@ static ssize_t bm_status_write(struct fi
switch (res) {
case 1: enabled = 0; break;
case 2: enabled = 1; break;
- case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root);
+ case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
mutex_lock(&root->d_inode->i_mutex);

while (!list_empty(&entries))
diff --git a/fs/block_dev.c b/fs/block_dev.c
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -190,7 +190,7 @@ static int blkdev_commit_write(struct fi

/*
* private llseek:
- * for a block special file file->f_dentry->d_inode->i_size is zero
+ * for a block special file file->f_path.dentry->d_inode->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 origin)
@@ -1071,7 +1071,7 @@ int blkdev_get(struct block_device *bdev
struct dentry fake_dentry = {};
fake_file.f_mode = mode;
fake_file.f_flags = flags;
- fake_file.f_dentry = &fake_dentry;
+ fake_file.f_path.dentry = &fake_dentry;
fake_dentry.d_inode = bdev->bd_inode;

return do_open(bdev, &fake_file, BD_MUTEX_NORMAL);
@@ -1092,7 +1092,7 @@ blkdev_get_whole(struct block_device *bd
struct dentry fake_dentry = {};
fake_file.f_mode = mode;
fake_file.f_flags = flags;
- fake_file.f_dentry = &fake_dentry;
+ fake_file.f_path.dentry = &fake_dentry;
fake_dentry.d_inode = bdev->bd_inode;

return do_open(bdev, &fake_file, BD_MUTEX_WHOLE);
@@ -1111,7 +1111,7 @@ blkdev_get_partition(struct block_device
struct dentry fake_dentry = {};
fake_file.f_mode = mode;
fake_file.f_flags = flags;
- fake_file.f_dentry = &fake_dentry;
+ fake_file.f_path.dentry = &fake_dentry;
fake_dentry.d_inode = bdev->bd_inode;

return do_open(bdev, &fake_file, BD_MUTEX_PARTITION);
diff --git a/fs/compat.c b/fs/compat.c
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -230,7 +230,7 @@ asmlinkage long compat_sys_fstatfs(unsig
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs(file->f_dentry, &tmp);
+ error = vfs_statfs(file->f_path.dentry, &tmp);
if (!error)
error = put_compat_statfs(buf, &tmp);
fput(file);
@@ -301,7 +301,7 @@ asmlinkage long compat_sys_fstatfs64(uns
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs(file->f_dentry, &tmp);
+ error = vfs_statfs(file->f_path.dentry, &tmp);
if (!error)
error = put_compat_statfs64(buf, &tmp);
fput(file);
@@ -363,7 +363,7 @@ static void compat_ioctl_error(struct fi
/* find the name of the device. */
path = (char *)__get_free_page(GFP_KERNEL);
if (path) {
- fn = d_path(filp->f_dentry, filp->f_vfsmnt, path, PAGE_SIZE);
+ fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE);
if (IS_ERR(fn))
fn = "?";
}
@@ -414,7 +414,7 @@ asmlinkage long compat_sys_ioctl(unsigne
case FIBMAP:
case FIGETBSZ:
case FIONREAD:
- if (S_ISREG(filp->f_dentry->d_inode->i_mode))
+ if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
break;
/*FALL THROUGH*/

@@ -436,7 +436,7 @@ asmlinkage long compat_sys_ioctl(unsigne
goto found_handler;
}

- if (S_ISSOCK(filp->f_dentry->d_inode->i_mode) &&
+ if (S_ISSOCK(filp->f_path.dentry->d_inode->i_mode) &&
cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
error = siocdevprivate_ioctl(fd, cmd, arg);
} else {
@@ -1255,7 +1255,7 @@ out:
if (iov != iovstack)
kfree(iov);
if ((ret + (type == READ)) > 0) {
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
if (type == READ)
fsnotify_access(dentry);
else
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1173,7 +1173,7 @@ static int vt_check(struct file *file)
static int vt_check(struct file *file)
{
struct tty_struct *tty;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;

if (file->f_op->ioctl != tty_ioctl)
return -EINVAL;
diff --git a/fs/dnotify.c b/fs/dnotify.c
--- a/fs/dnotify.c
+++ b/fs/dnotify.c
@@ -42,7 +42,7 @@ void dnotify_flush(struct file *filp, fl
struct dnotify_struct **prev;
struct inode *inode;

- inode = filp->f_dentry->d_inode;
+ inode = filp->f_path.dentry->d_inode;
if (!S_ISDIR(inode->i_mode))
return;
spin_lock(&inode->i_lock);
@@ -74,7 +74,7 @@ int fcntl_dirnotify(int fd, struct file
}
if (!dir_notify_enable)
return -EINVAL;
- inode = filp->f_dentry->d_inode;
+ inode = filp->f_path.dentry->d_inode;
if (!S_ISDIR(inode->i_mode))
return -ENOTDIR;
dn = kmem_cache_alloc(dn_cache, SLAB_KERNEL);
diff --git a/fs/dquot.c b/fs/dquot.c
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -694,9 +694,9 @@ restart:
file_list_lock();
list_for_each(p, &sb->s_files) {
struct file *filp = list_entry(p, struct file, f_u.fu_list);
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
- struct dentry *dentry = dget(filp->f_dentry);
+ struct dentry *dentry = dget(filp->f_path.dentry);
file_list_unlock();
sb->dq_op->initialize(inode, type);
dput(dentry);
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -795,8 +795,8 @@ static int ep_getfd(int *efd, struct ino
goto eexit_4;
dentry->d_op = &eventpollfs_dentry_operations;
d_add(dentry, inode);
- file->f_vfsmnt = mntget(eventpoll_mnt);
- file->f_dentry = dentry;
+ file->f_path.mnt = mntget(eventpoll_mnt);
+ file->f_path.dentry = dentry;
file->f_mapping = inode->i_mapping;

file->f_pos = 0;
diff --git a/fs/exec.c b/fs/exec.c
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -912,7 +912,7 @@ int prepare_binprm(struct linux_binprm *
int prepare_binprm(struct linux_binprm *bprm)
{
int mode;
- struct inode * inode = bprm->file->f_dentry->d_inode;
+ struct inode * inode = bprm->file->f_path.dentry->d_inode;
int retval;

mode = inode->i_mode;
@@ -922,7 +922,7 @@ int prepare_binprm(struct linux_binprm *
bprm->e_uid = current->euid;
bprm->e_gid = current->egid;

- if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) {
+ if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) {
/* Set-uid? */
if (mode & S_ISUID) {
current->personality &= ~PER_CLEAR_ON_SETID;
@@ -1518,10 +1518,10 @@ int do_coredump(long signr, int exit_cod
O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
if (IS_ERR(file))
goto fail_unlock;
- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;
if (inode->i_nlink > 1)
goto close_fail; /* multiple links - don't dump */
- if (!ispipe && d_unhashed(file->f_dentry))
+ if (!ispipe && d_unhashed(file->f_path.dentry))
goto close_fail;

/* AK: actually i see no reason to not allow this for named pipes etc.,
@@ -1532,7 +1532,7 @@ int do_coredump(long signr, int exit_cod
goto close_fail;
if (!file->f_op->write)
goto close_fail;
- if (!ispipe && do_truncate(file->f_dentry, 0, 0, file) != 0)
+ if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
goto close_fail;

retval = binfmt->core_dump(signr, regs, file);
diff --git a/fs/fcntl.c b/fs/fcntl.c
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -204,7 +204,7 @@ asmlinkage long sys_dup(unsigned int fil

static int setfl(int fd, struct file * filp, unsigned long arg)
{
- struct inode * inode = filp->f_dentry->d_inode;
+ struct inode * inode = filp->f_path.dentry->d_inode;
int error = 0;

/*
diff --git a/fs/file_table.c b/fs/file_table.c
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -152,8 +152,8 @@ EXPORT_SYMBOL(fput);
*/
void fastcall __fput(struct file *file)
{
- struct dentry *dentry = file->f_dentry;
- struct vfsmount *mnt = file->f_vfsmnt;
+ struct dentry *dentry = file->f_path.dentry;
+ struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = dentry->d_inode;

might_sleep();
@@ -176,8 +176,8 @@ void fastcall __fput(struct file *file)
put_write_access(inode);
put_pid(file->f_owner.pid);
file_kill(file);
- file->f_dentry = NULL;
- file->f_vfsmnt = NULL;
+ file->f_path.dentry = NULL;
+ file->f_path.mnt = NULL;
file_free(file);
dput(dentry);
mntput(mnt);
@@ -271,7 +271,7 @@ int fs_may_remount_ro(struct super_block
file_list_lock();
list_for_each(p, &sb->s_files) {
struct file *file = list_entry(p, struct file, f_u.fu_list);
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;

/* File with pending delete? */
if (inode->i_nlink == 0)
diff --git a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1200,7 +1200,7 @@ EXPORT_SYMBOL(touch_atime);

void file_update_time(struct file *file)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct timespec now;
int sync_it = 0;

diff --git a/fs/inotify_user.c b/fs/inotify_user.c
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -570,9 +570,9 @@ asmlinkage long sys_inotify_init(void)
dev->ih = ih;

filp->f_op = &inotify_fops;
- filp->f_vfsmnt = mntget(inotify_mnt);
- filp->f_dentry = dget(inotify_mnt->mnt_root);
- filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
+ filp->f_path.mnt = mntget(inotify_mnt);
+ filp->f_path.dentry = dget(inotify_mnt->mnt_root);
+ filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
filp->f_mode = FMODE_READ;
filp->f_flags = O_RDONLY;
filp->private_data = dev;
diff --git a/fs/ioctl.c b/fs/ioctl.c
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -31,7 +31,7 @@ static long do_ioctl(struct file *filp,
goto out;
} else if (filp->f_op->ioctl) {
lock_kernel();
- error = filp->f_op->ioctl(filp->f_dentry->d_inode,
+ error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
filp, cmd, arg);
unlock_kernel();
}
@@ -45,7 +45,7 @@ static int file_ioctl(struct file *filp,
{
int error;
int block;
- struct inode * inode = filp->f_dentry->d_inode;
+ struct inode * inode = filp->f_path.dentry->d_inode;
int __user *p = (int __user *)arg;

switch (cmd) {
@@ -137,17 +137,17 @@ int vfs_ioctl(struct file *filp, unsigne
break;

case FIOQSIZE:
- if (S_ISDIR(filp->f_dentry->d_inode->i_mode) ||
- S_ISREG(filp->f_dentry->d_inode->i_mode) ||
- S_ISLNK(filp->f_dentry->d_inode->i_mode)) {
- loff_t res = inode_get_bytes(filp->f_dentry->d_inode);
+ if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
+ S_ISREG(filp->f_path.dentry->d_inode->i_mode) ||
+ S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) {
+ loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode);
error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0;
}
else
error = -ENOTTY;
break;
default:
- if (S_ISREG(filp->f_dentry->d_inode->i_mode))
+ if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
error = file_ioctl(filp, cmd, arg);
else
error = do_ioctl(filp, cmd, arg);
diff --git a/fs/libfs.c b/fs/libfs.c
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -63,7 +63,7 @@ int dcache_dir_open(struct inode *inode,
{
static struct qstr cursor_name = {.len = 1, .name = "."};

- file->private_data = d_alloc(file->f_dentry, &cursor_name);
+ file->private_data = d_alloc(file->f_path.dentry, &cursor_name);

return file->private_data ? 0 : -ENOMEM;
}
@@ -76,7 +76,7 @@ int dcache_dir_close(struct inode *inode

loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
{
- mutex_lock(&file->f_dentry->d_inode->i_mutex);
+ mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
switch (origin) {
case 1:
offset += file->f_pos;
@@ -84,7 +84,7 @@ loff_t dcache_dir_lseek(struct file *fil
if (offset >= 0)
break;
default:
- mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return -EINVAL;
}
if (offset != file->f_pos) {
@@ -96,8 +96,8 @@ loff_t dcache_dir_lseek(struct file *fil

spin_lock(&dcache_lock);
list_del(&cursor->d_u.d_child);
- p = file->f_dentry->d_subdirs.next;
- while (n && p != &file->f_dentry->d_subdirs) {
+ p = file->f_path.dentry->d_subdirs.next;
+ while (n && p != &file->f_path.dentry->d_subdirs) {
struct dentry *next;
next = list_entry(p, struct dentry, d_u.d_child);
if (!d_unhashed(next) && next->d_inode)
@@ -108,7 +108,7 @@ loff_t dcache_dir_lseek(struct file *fil
spin_unlock(&dcache_lock);
}
}
- mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return offset;
}

@@ -126,7 +126,7 @@ static inline unsigned char dt_type(stru

int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct dentry *cursor = filp->private_data;
struct list_head *p, *q = &cursor->d_u.d_child;
ino_t ino;
diff --git a/fs/locks.c b/fs/locks.c
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -321,7 +321,7 @@ static int flock_to_posix_lock(struct fi
start = filp->f_pos;
break;
case SEEK_END:
- start = i_size_read(filp->f_dentry->d_inode);
+ start = i_size_read(filp->f_path.dentry->d_inode);
break;
default:
return -EINVAL;
@@ -371,7 +371,7 @@ static int flock64_to_posix_lock(struct
start = filp->f_pos;
break;
case SEEK_END:
- start = i_size_read(filp->f_dentry->d_inode);
+ start = i_size_read(filp->f_path.dentry->d_inode);
break;
default:
return -EINVAL;
@@ -672,7 +672,7 @@ posix_test_lock(struct file *filp, struc
struct file_lock *cfl;

lock_kernel();
- for (cfl = filp->f_dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
+ for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
if (!IS_POSIX(cfl))
continue;
if (posix_locks_conflict(cfl, fl))
@@ -734,7 +734,7 @@ static int flock_lock_file(struct file *
{
struct file_lock *new_fl = NULL;
struct file_lock **before;
- struct inode * inode = filp->f_dentry->d_inode;
+ struct inode * inode = filp->f_path.dentry->d_inode;
int error = 0;
int found = 0;

@@ -1018,7 +1018,7 @@ static int __posix_lock_file_conf(struct
*/
int posix_lock_file(struct file *filp, struct file_lock *fl)
{
- return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, NULL);
+ return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, NULL);
}
EXPORT_SYMBOL(posix_lock_file);

@@ -1033,7 +1033,7 @@ int posix_lock_file_conf(struct file *fi
int posix_lock_file_conf(struct file *filp, struct file_lock *fl,
struct file_lock *conflock)
{
- return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, conflock);
+ return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, conflock);
}
EXPORT_SYMBOL(posix_lock_file_conf);

@@ -1333,8 +1333,8 @@ int fcntl_getlease(struct file *filp)
int type = F_UNLCK;

lock_kernel();
- time_out_leases(filp->f_dentry->d_inode);
- for (fl = filp->f_dentry->d_inode->i_flock; fl && IS_LEASE(fl);
+ time_out_leases(filp->f_path.dentry->d_inode);
+ for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
fl = fl->fl_next) {
if (fl->fl_file == filp) {
type = fl->fl_type & ~F_INPROGRESS;
@@ -1359,7 +1359,7 @@ static int __setlease(struct file *filp,
static int __setlease(struct file *filp, long arg, struct file_lock **flp)
{
struct file_lock *fl, **before, **my_before = NULL, *lease;
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
int error, rdlease_count = 0, wrlease_count = 0;

@@ -1448,7 +1448,7 @@ out:

int setlease(struct file *filp, long arg, struct file_lock **lease)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
int error;

@@ -1482,7 +1482,7 @@ int fcntl_setlease(unsigned int fd, stru
int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
{
struct file_lock fl, *flp = &fl;
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
int error;

@@ -1692,7 +1692,7 @@ int fcntl_setlk(unsigned int fd, struct
if (copy_from_user(&flock, l, sizeof(flock)))
goto out;

- inode = filp->f_dentry->d_inode;
+ inode = filp->f_path.dentry->d_inode;

/* Don't allow mandatory locks on files that may be memory mapped
* and shared.
@@ -1835,7 +1835,7 @@ int fcntl_setlk64(unsigned int fd, struc
if (copy_from_user(&flock, l, sizeof(flock)))
goto out;

- inode = filp->f_dentry->d_inode;
+ inode = filp->f_path.dentry->d_inode;

/* Don't allow mandatory locks on files that may be memory mapped
* and shared.
@@ -1922,7 +1922,7 @@ void locks_remove_posix(struct file *fil
* 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_dentry->d_inode->i_flock)
+ if (!filp->f_path.dentry->d_inode->i_flock)
return;

lock.fl_type = F_UNLCK;
@@ -1951,7 +1951,7 @@ EXPORT_SYMBOL(locks_remove_posix);
*/
void locks_remove_flock(struct file *filp)
{
- struct inode * inode = filp->f_dentry->d_inode;
+ struct inode * inode = filp->f_path.dentry->d_inode;
struct file_lock *fl;
struct file_lock **before;

@@ -2020,7 +2020,7 @@ static void lock_get_status(char* out, s
struct inode *inode = NULL;

if (fl->fl_file != NULL)
- inode = fl->fl_file->f_dentry->d_inode;
+ inode = fl->fl_file->f_path.dentry->d_inode;

out += sprintf(out, "%d:%s ", id, pfx);
if (IS_POSIX(fl)) {
diff --git a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -295,7 +295,7 @@ int vfs_permission(struct nameidata *nd,
*/
int file_permission(struct file *file, int mask)
{
- return permission(file->f_dentry->d_inode, mask, NULL);
+ return permission(file->f_path.dentry->d_inode, mask, NULL);
}

/*
@@ -331,7 +331,7 @@ int get_write_access(struct inode * inod

int deny_write_access(struct file * file)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;

spin_lock(&inode->i_lock);
if (atomic_read(&inode->i_writecount) > 0) {
@@ -366,7 +366,7 @@ void path_release_on_umount(struct namei
*/
void release_open_intent(struct nameidata *nd)
{
- if (nd->intent.open.file->f_dentry == NULL)
+ if (nd->intent.open.file->f_path.dentry == NULL)
put_filp(nd->intent.open.file);
else
fput(nd->intent.open.file);
@@ -1136,7 +1136,7 @@ static int fastcall do_path_lookup(int d
if (!file)
goto out_fail;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;

retval = -ENOTDIR;
if (!S_ISDIR(dentry->d_inode->i_mode))
@@ -1146,7 +1146,7 @@ static int fastcall do_path_lookup(int d
if (retval)
goto fput_fail;

- nd->mnt = mntget(file->f_vfsmnt);
+ nd->mnt = mntget(file->f_path.mnt);
nd->dentry = dget(dentry);

fput_light(file, fput_needed);
diff --git a/fs/open.c b/fs/open.c
--- a/fs/open.c
+++ b/fs/open.c
@@ -165,7 +165,7 @@ asmlinkage long sys_fstatfs(unsigned int
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs_native(file->f_dentry, &tmp);
+ error = vfs_statfs_native(file->f_path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
fput(file);
@@ -186,7 +186,7 @@ asmlinkage long sys_fstatfs64(unsigned i
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs64(file->f_dentry, &tmp);
+ error = vfs_statfs64(file->f_path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
fput(file);
@@ -302,7 +302,7 @@ static long do_sys_ftruncate(unsigned in
if (file->f_flags & O_LARGEFILE)
small = 0;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
inode = dentry->d_inode;
error = -EINVAL;
if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
@@ -448,8 +448,8 @@ asmlinkage long sys_fchdir(unsigned int
if (!file)
goto out;

- dentry = file->f_dentry;
- mnt = file->f_vfsmnt;
+ dentry = file->f_path.dentry;
+ mnt = file->f_path.mnt;
inode = dentry->d_inode;

error = -ENOTDIR;
@@ -503,7 +503,7 @@ asmlinkage long sys_fchmod(unsigned int
if (!file)
goto out;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
inode = dentry->d_inode;

audit_inode(NULL, inode);
@@ -662,7 +662,7 @@ asmlinkage long sys_fchown(unsigned int
if (!file)
goto out;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
audit_inode(NULL, dentry->d_inode);
error = chown_common(dentry, user, group);
fput(file);
@@ -688,8 +688,8 @@ static struct file *__dentry_open(struct
}

f->f_mapping = inode->i_mapping;
- f->f_dentry = dentry;
- f->f_vfsmnt = mnt;
+ f->f_path.dentry = dentry;
+ f->f_path.mnt = mnt;
f->f_pos = 0;
f->f_op = fops_get(inode->i_fop);
file_move(f, &inode->i_sb->s_files);
@@ -723,8 +723,8 @@ cleanup_all:
if (f->f_mode & FMODE_WRITE)
put_write_access(inode);
file_kill(f);
- f->f_dentry = NULL;
- f->f_vfsmnt = NULL;
+ f->f_path.dentry = NULL;
+ f->f_path.mnt = NULL;
cleanup_file:
put_filp(f);
dput(dentry);
@@ -822,7 +822,7 @@ struct file *nameidata_to_filp(struct na
/* Pick up the filp from the open intent */
filp = nd->intent.open.file;
/* Has the filesystem initialised the file for us? */
- if (filp->f_dentry == NULL)
+ if (filp->f_path.dentry == NULL)
filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
else
path_release(nd);
@@ -965,7 +965,7 @@ long do_sys_open(int dfd, const char __u
put_unused_fd(fd);
fd = PTR_ERR(f);
} else {
- fsnotify_open(f->f_dentry);
+ fsnotify_open(f->f_path.dentry);
fd_install(fd, f);
}
}
diff --git a/fs/pipe.c b/fs/pipe.c
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -222,7 +222,7 @@ pipe_read(struct kiocb *iocb, const stru
unsigned long nr_segs, loff_t pos)
{
struct file *filp = iocb->ki_filp;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe;
int do_wakeup;
ssize_t ret;
@@ -335,7 +335,7 @@ pipe_write(struct kiocb *iocb, const str
unsigned long nr_segs, loff_t ppos)
{
struct file *filp = iocb->ki_filp;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe;
ssize_t ret;
int do_wakeup;
@@ -520,7 +520,7 @@ pipe_ioctl(struct inode *pino, struct fi
pipe_ioctl(struct inode *pino, struct file *filp,
unsigned int cmd, unsigned long arg)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe;
int count, buf, nrbufs;

@@ -548,7 +548,7 @@ pipe_poll(struct file *filp, poll_table
pipe_poll(struct file *filp, poll_table *wait)
{
unsigned int mask;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe = inode->i_pipe;
int nrbufs;

@@ -601,7 +601,7 @@ static int
static int
pipe_read_fasync(int fd, struct file *filp, int on)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int retval;

mutex_lock(&inode->i_mutex);
@@ -618,7 +618,7 @@ static int
static int
pipe_write_fasync(int fd, struct file *filp, int on)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int retval;

mutex_lock(&inode->i_mutex);
@@ -635,7 +635,7 @@ static int
static int
pipe_rdwr_fasync(int fd, struct file *filp, int on)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe = inode->i_pipe;
int retval;

@@ -902,8 +902,8 @@ struct file *create_write_pipe(void)

dentry->d_op = &pipefs_dentry_operations;
d_add(dentry, inode);
- f->f_vfsmnt = mntget(pipe_mnt);
- f->f_dentry = dentry;
+ f->f_path.mnt = mntget(pipe_mnt);
+ f->f_path.dentry = dentry;
f->f_mapping = inode->i_mapping;

f->f_flags = O_WRONLY;
@@ -923,8 +923,8 @@ struct file *create_write_pipe(void)

void free_write_pipe(struct file *f)
{
- mntput(f->f_vfsmnt);
- dput(f->f_dentry);
+ mntput(f->f_path.mnt);
+ dput(f->f_path.dentry);
put_filp(f);
}

@@ -935,9 +935,9 @@ struct file *create_read_pipe(struct fil
return ERR_PTR(-ENFILE);

/* Grab pipe from the writer */
- f->f_vfsmnt = mntget(wrf->f_vfsmnt);
- f->f_dentry = dget(wrf->f_dentry);
- f->f_mapping = wrf->f_dentry->d_inode->i_mapping;
+ f->f_path.mnt = mntget(wrf->f_path.mnt);
+ f->f_path.dentry = dget(wrf->f_path.dentry);
+ f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping;

f->f_pos = 0;
f->f_flags = O_RDONLY;
diff --git a/fs/read_write.c b/fs/read_write.c
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -64,13 +64,13 @@ loff_t remote_llseek(struct file *file,
lock_kernel();
switch (origin) {
case 2:
- offset += i_size_read(file->f_dentry->d_inode);
+ offset += i_size_read(file->f_path.dentry->d_inode);
break;
case 1:
offset += file->f_pos;
}
retval = -EINVAL;
- if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) {
+ if (offset>=0 && offset<=file->f_path.dentry->d_inode->i_sb->s_maxbytes) {
if (offset != file->f_pos) {
file->f_pos = offset;
file->f_version = 0;
@@ -95,7 +95,7 @@ loff_t default_llseek(struct file *file,
lock_kernel();
switch (origin) {
case 2:
- offset += i_size_read(file->f_dentry->d_inode);
+ offset += i_size_read(file->f_path.dentry->d_inode);
break;
case 1:
offset += file->f_pos;
@@ -203,7 +203,7 @@ int rw_verify_area(int read_write, struc
if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
goto Einval;

- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;
if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
int retval = locks_mandatory_area(
read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
@@ -273,7 +273,7 @@ ssize_t vfs_read(struct file *file, char
else
ret = do_sync_read(file, buf, count, pos);
if (ret > 0) {
- fsnotify_access(file->f_dentry);
+ fsnotify_access(file->f_path.dentry);
current->rchar += ret;
}
current->syscr++;
@@ -331,7 +331,7 @@ ssize_t vfs_write(struct file *file, con
else
ret = do_sync_write(file, buf, count, pos);
if (ret > 0) {
- fsnotify_modify(file->f_dentry);
+ fsnotify_modify(file->f_path.dentry);
current->wchar += ret;
}
current->syscw++;
@@ -628,9 +628,9 @@ out:
kfree(iov);
if ((ret + (type == READ)) > 0) {
if (type == READ)
- fsnotify_access(file->f_dentry);
+ fsnotify_access(file->f_path.dentry);
else
- fsnotify_modify(file->f_dentry);
+ fsnotify_modify(file->f_path.dentry);
}
return ret;
}
@@ -722,7 +722,7 @@ static ssize_t do_sendfile(int out_fd, i
if (!(in_file->f_mode & FMODE_READ))
goto fput_in;
retval = -EINVAL;
- in_inode = in_file->f_dentry->d_inode;
+ in_inode = in_file->f_path.dentry->d_inode;
if (!in_inode)
goto fput_in;
if (!in_file->f_op || !in_file->f_op->sendfile)
@@ -754,7 +754,7 @@ static ssize_t do_sendfile(int out_fd, i
retval = -EINVAL;
if (!out_file->f_op || !out_file->f_op->sendpage)
goto fput_out;
- out_inode = out_file->f_dentry->d_inode;
+ out_inode = out_file->f_path.dentry->d_inode;
retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
if (retval < 0)
goto fput_out;
diff --git a/fs/readdir.c b/fs/readdir.c
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -21,7 +21,7 @@

int vfs_readdir(struct file *file, filldir_t filler, void *buf)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
int res = -ENOTDIR;
if (!file->f_op || !file->f_op->readdir)
goto out;
diff --git a/fs/seq_file.c b/fs/seq_file.c
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(seq_lseek);
/**
* seq_release - free the structures associated with sequential file.
* @file: file in question
- * @inode: file->f_dentry->d_inode
+ * @inode: file->f_path.dentry->d_inode
*
* Frees the structures associated with sequential file; can be used
* as ->f_op->release() if you don't have private data to destroy.
diff --git a/fs/splice.c b/fs/splice.c
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -941,7 +941,7 @@ long do_splice_direct(struct file *in, l
* randomly drop data for eg socket -> socket splicing. Use the
* piped splicing for that!
*/
- i_mode = in->f_dentry->d_inode->i_mode;
+ i_mode = in->f_path.dentry->d_inode->i_mode;
if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
return -EINVAL;

@@ -1052,7 +1052,7 @@ static long do_splice(struct file *in, l
loff_t offset, *off;
long ret;

- pipe = in->f_dentry->d_inode->i_pipe;
+ pipe = in->f_path.dentry->d_inode->i_pipe;
if (pipe) {
if (off_in)
return -ESPIPE;
@@ -1073,7 +1073,7 @@ static long do_splice(struct file *in, l
return ret;
}

- pipe = out->f_dentry->d_inode->i_pipe;
+ pipe = out->f_path.dentry->d_inode->i_pipe;
if (pipe) {
if (off_out)
return -ESPIPE;
@@ -1231,7 +1231,7 @@ static long do_vmsplice(struct file *fil
static long do_vmsplice(struct file *file, const struct iovec __user *iov,
unsigned long nr_segs, unsigned int flags)
{
- struct pipe_inode_info *pipe = file->f_dentry->d_inode->i_pipe;
+ struct pipe_inode_info *pipe = file->f_path.dentry->d_inode->i_pipe;
struct page *pages[PIPE_BUFFERS];
struct partial_page partial[PIPE_BUFFERS];
struct splice_pipe_desc spd = {
@@ -1475,8 +1475,8 @@ static long do_tee(struct file *in, stru
static long do_tee(struct file *in, struct file *out, size_t len,
unsigned int flags)
{
- struct pipe_inode_info *ipipe = in->f_dentry->d_inode->i_pipe;
- struct pipe_inode_info *opipe = out->f_dentry->d_inode->i_pipe;
+ struct pipe_inode_info *ipipe = in->f_path.dentry->d_inode->i_pipe;
+ struct pipe_inode_info *opipe = out->f_path.dentry->d_inode->i_pipe;
int ret = -EINVAL;

/*
diff --git a/fs/stat.c b/fs/stat.c
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -109,7 +109,7 @@ int vfs_fstat(unsigned int fd, struct ks
int error = -EBADF;

if (f) {
- error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat);
+ error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
fput(f);
}
return error;
diff --git a/fs/super.c b/fs/super.c
--- a/fs/super.c
+++ b/fs/super.c
@@ -552,7 +552,7 @@ static void mark_files_ro(struct super_b

file_list_lock();
list_for_each_entry(f, &sb->s_files, f_u.fu_list) {
- if (S_ISREG(f->f_dentry->d_inode->i_mode) && file_count(f))
+ if (S_ISREG(f->f_path.dentry->d_inode->i_mode) && file_count(f))
f->f_mode &= ~FMODE_WRITE;
}
file_list_unlock();
diff --git a/fs/sync.c b/fs/sync.c
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -93,7 +93,7 @@ long do_fsync(struct file *file, int dat
* livelocks in fsync_buffers_list().
*/
mutex_lock(&mapping->host->i_mutex);
- err = file->f_op->fsync(file, file->f_dentry, datasync);
+ err = file->f_op->fsync(file, file->f_path.dentry, datasync);
if (!ret)
ret = err;
mutex_unlock(&mapping->host->i_mutex);
@@ -222,7 +222,7 @@ asmlinkage long sys_sync_file_range(int
if (!file)
goto out;

- i_mode = file->f_dentry->d_inode->i_mode;
+ i_mode = file->f_path.dentry->d_inode->i_mode;
ret = -ESPIPE;
if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) &&
!S_ISLNK(i_mode))
diff --git a/fs/xattr.c b/fs/xattr.c
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -261,7 +261,7 @@ sys_fsetxattr(int fd, char __user *name,
f = fget(fd);
if (!f)
return error;
- dentry = f->f_dentry;
+ dentry = f->f_path.dentry;
audit_inode(NULL, dentry->d_inode);
error = setxattr(dentry, name, value, size, flags);
fput(f);
@@ -344,7 +344,7 @@ sys_fgetxattr(int fd, char __user *name,
f = fget(fd);
if (!f)
return error;
- error = getxattr(f->f_dentry, name, value, size);
+ error = getxattr(f->f_path.dentry, name, value, size);
fput(f);
return error;
}
@@ -416,7 +416,7 @@ sys_flistxattr(int fd, char __user *list
f = fget(fd);
if (!f)
return error;
- error = listxattr(f->f_dentry, list, size);
+ error = listxattr(f->f_path.dentry, list, size);
fput(f);
return error;
}
@@ -477,7 +477,7 @@ sys_fremovexattr(int fd, char __user *na
f = fget(fd);
if (!f)
return error;
- dentry = f->f_dentry;
+ dentry = f->f_path.dentry;
audit_inode(NULL, dentry->d_inode);
error = removexattr(dentry, name);
fput(f);
diff --git a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -269,6 +269,7 @@ extern int dir_notify_enable;
#include <linux/types.h>
#include <linux/kdev_t.h>
#include <linux/dcache.h>
+#include <linux/namei.h>
#include <linux/stat.h>
#include <linux/cache.h>
#include <linux/kobject.h>
@@ -723,8 +724,9 @@ struct file {
struct list_head fu_list;
struct rcu_head fu_rcuhead;
} f_u;
- struct dentry *f_dentry;
- struct vfsmount *f_vfsmnt;
+ struct path f_path;
+#define f_dentry f_path.dentry
+#define f_vfsmnt f_path.mnt
const struct file_operations *f_op;
atomic_t f_count;
unsigned int f_flags;
@@ -1259,7 +1261,7 @@ static inline void file_accessed(struct
static inline void file_accessed(struct file *file)
{
if (!(file->f_flags & O_NOATIME))
- touch_atime(file->f_vfsmnt, file->f_dentry);
+ touch_atime(file->f_path.mnt, file->f_path.dentry);
}

int sync_inode(struct inode *inode, struct writeback_control *wbc);
@@ -1650,7 +1652,7 @@ static inline void allow_write_access(st
static inline void allow_write_access(struct file *file)
{
if (file)
- atomic_inc(&file->f_dentry->d_inode->i_writecount);
+ atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
}
extern int do_pipe(int *);
extern struct file *create_read_pipe(struct file *f);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -164,7 +164,7 @@ static inline void fsnotify_open(struct
*/
static inline void fsnotify_close(struct file *file)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
const char *name = dentry->d_name.name;
mode_t mode = file->f_mode;


2006-10-21 07:16:30

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 07 of 23] fat: change uses of f_{dentry,vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the fat filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 4 insertions(+), 4 deletions(-)
fs/fat/dir.c | 6 +++---
fs/fat/file.c | 2 +-

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -579,7 +579,7 @@ parse_record:
if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME))
inum = inode->i_ino;
else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) {
- inum = parent_ino(filp->f_dentry);
+ inum = parent_ino(filp->f_path.dentry);
} else {
loff_t i_pos = fat_make_i_pos(sb, bh, de);
struct inode *tmp = fat_iget(sb, i_pos);
@@ -643,7 +643,7 @@ out:

static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
return __fat_readdir(inode, filp, dirent, filldir, 0, 0);
}

@@ -782,7 +782,7 @@ static long fat_compat_dir_ioctl(struct

set_fs(KERNEL_DS);
lock_kernel();
- ret = fat_dir_ioctl(file->f_dentry->d_inode, file,
+ ret = fat_dir_ioctl(file->f_path.dentry->d_inode, file,
cmd, (unsigned long) &d);
unlock_kernel();
set_fs(oldfs);
diff --git a/fs/fat/file.c b/fs/fat/file.c
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -92,7 +92,7 @@ int fat_generic_ioctl(struct inode *inod
}

/* This MUST be done before doing anything irreversible... */
- err = notify_change(filp->f_dentry, &ia);
+ err = notify_change(filp->f_path.dentry, &ia);
if (err)
goto up;



2006-10-21 07:18:59

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 06 of 23] ext4: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the ext4 filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

4 files changed, 8 insertions(+), 8 deletions(-)
fs/ext4/dir.c | 8 ++++----
fs/ext4/file.c | 2 +-
fs/ext4/ioctl.c | 2 +-
fs/ext4/namei.c | 4 ++--

diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -103,7 +103,7 @@ static int ext4_readdir(struct file * fi
struct ext4_dir_entry_2 *de;
struct super_block *sb;
int err;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int ret = 0;

sb = inode->i_sb;
@@ -122,7 +122,7 @@ static int ext4_readdir(struct file * fi
* We don't set the inode dirty flag since it's not
* critical that it get flushed back to the disk.
*/
- EXT4_I(filp->f_dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
+ EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
}
#endif
stored = 0;
@@ -399,7 +399,7 @@ static int call_filldir(struct file * fi
{
struct dir_private_info *info = filp->private_data;
loff_t curr_pos;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct super_block * sb;
int error;

@@ -429,7 +429,7 @@ static int ext4_dx_readdir(struct file *
void * dirent, filldir_t filldir)
{
struct dir_private_info *info = filp->private_data;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct fname *fname;
int ret;

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -52,7 +52,7 @@ ext4_file_write(struct kiocb *iocb, cons
unsigned long nr_segs, loff_t pos)
{
struct file *file = iocb->ki_filp;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
ssize_t ret;
int err;

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -256,7 +256,7 @@ flags_err:
#ifdef CONFIG_COMPAT
long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
int ret;

/* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -593,7 +593,7 @@ int ext4_htree_fill_tree(struct file *di

dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
start_minor_hash));
- dir = dir_file->f_dentry->d_inode;
+ dir = dir_file->f_path.dentry->d_inode;
if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) {
hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
@@ -604,7 +604,7 @@ int ext4_htree_fill_tree(struct file *di
}
hinfo.hash = start_hash;
hinfo.minor_hash = 0;
- frame = dx_probe(NULL, dir_file->f_dentry->d_inode, &hinfo, frames, &err);
+ frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
if (!frame)
return err;



2006-10-21 07:18:15

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 22 of 23] ecryptfs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the ecryptfs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

3 files changed, 20 insertions(+), 20 deletions(-)
fs/ecryptfs/file.c | 14 +++++++-------
fs/ecryptfs/inode.c | 8 ++++----
fs/ecryptfs/mmap.c | 18 +++++++++---------

diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -76,7 +76,7 @@ static loff_t ecryptfs_llseek(struct fil
}
ecryptfs_printk(KERN_DEBUG, "new_end_pos = [0x%.16x]\n", new_end_pos);
if (expanding_file) {
- rc = ecryptfs_truncate(file->f_dentry, new_end_pos);
+ rc = ecryptfs_truncate(file->f_path.dentry, new_end_pos);
if (rc) {
rv = rc;
ecryptfs_printk(KERN_ERR, "Error on attempt to "
@@ -117,8 +117,8 @@ static ssize_t ecryptfs_read_update_atim
if (-EIOCBQUEUED == rc)
rc = wait_on_sync_kiocb(iocb);
if (rc >= 0) {
- lower_dentry = ecryptfs_dentry_to_lower(file->f_dentry);
- lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_dentry);
+ lower_dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
+ lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
touch_atime(lower_vfsmount, lower_dentry);
}
return rc;
@@ -177,10 +177,10 @@ static int ecryptfs_readdir(struct file

lower_file = ecryptfs_file_to_lower(file);
lower_file->f_pos = file->f_pos;
- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;
memset(&buf, 0, sizeof(buf));
buf.dirent = dirent;
- buf.dentry = file->f_dentry;
+ buf.dentry = file->f_path.dentry;
buf.filldir = filldir;
retry:
buf.filldir_called = 0;
@@ -193,7 +193,7 @@ retry:
goto retry;
file->f_pos = lower_file->f_pos;
if (rc >= 0)
- fsstack_copy_attr_atime(inode, lower_file->f_dentry->d_inode);
+ fsstack_copy_attr_atime(inode, lower_file->f_path.dentry->d_inode);
return rc;
}

@@ -213,7 +213,7 @@ static int ecryptfs_open(struct inode *i
int rc = 0;
struct ecryptfs_crypt_stat *crypt_stat = NULL;
struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
- struct dentry *ecryptfs_dentry = file->f_dentry;
+ struct dentry *ecryptfs_dentry = file->f_path.dentry;
/* Private value of ecryptfs_dentry allocated in
* ecryptfs_lookup() */
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -155,7 +155,7 @@ static int grow_file(struct dentry *ecry
struct ecryptfs_file_info tmp_file_info;

memset(&fake_file, 0, sizeof(fake_file));
- fake_file.f_dentry = ecryptfs_dentry;
+ fake_file.f_path.dentry = ecryptfs_dentry;
memset(&tmp_file_info, 0, sizeof(tmp_file_info));
ecryptfs_set_file_private(&fake_file, &tmp_file_info);
ecryptfs_set_file_lower(&fake_file, lower_file);
@@ -221,8 +221,8 @@ static int ecryptfs_initialize_file(stru
goto out;
}
/* fput(lower_file) should handle the puts if we do this */
- lower_file->f_dentry = tlower_dentry;
- lower_file->f_vfsmnt = lower_mnt;
+ lower_file->f_path.dentry = tlower_dentry;
+ lower_file->f_path.mnt = lower_mnt;
lower_inode = tlower_dentry->d_inode;
if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
@@ -784,7 +784,7 @@ int ecryptfs_truncate(struct dentry *den
* the file in the underlying filesystem so that the
* truncation has an effect there as well. */
memset(&fake_ecryptfs_file, 0, sizeof(fake_ecryptfs_file));
- fake_ecryptfs_file.f_dentry = dentry;
+ fake_ecryptfs_file.f_path.dentry = dentry;
/* Released at out_free: label */
ecryptfs_set_file_private(&fake_ecryptfs_file,
kmem_cache_alloc(ecryptfs_file_info_cache,
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -51,7 +51,7 @@ static struct page *ecryptfs_get1page(st
struct inode *inode;
struct address_space *mapping;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
inode = dentry->d_inode;
mapping = inode->i_mapping;
page = read_cache_page(mapping, index,
@@ -84,7 +84,7 @@ int ecryptfs_fill_zeros(struct file *fil
int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
{
int rc = 0;
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
pgoff_t old_end_page_index = 0;
pgoff_t index = old_end_page_index;
@@ -218,7 +218,7 @@ int ecryptfs_do_readpage(struct file *fi
char *lower_page_data;
const struct address_space_operations *lower_a_ops;

- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
lower_file = ecryptfs_file_to_lower(file);
lower_dentry = ecryptfs_dentry_to_lower(dentry);
inode = dentry->d_inode;
@@ -275,9 +275,9 @@ static int ecryptfs_readpage(struct file
int rc = 0;
struct ecryptfs_crypt_stat *crypt_stat;

- BUG_ON(!(file && file->f_dentry && file->f_dentry->d_inode));
- crypt_stat =
- &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat;
+ BUG_ON(!(file && file->f_path.dentry && file->f_path.dentry->d_inode));
+ crypt_stat = &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)
+ ->crypt_stat;
if (!crypt_stat
|| !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED)
|| ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) {
@@ -571,7 +571,7 @@ process_new_file(struct ecryptfs_crypt_s
if (more_header_data_to_be_written) {
rc = ecryptfs_write_headers_virt(header_virt,
crypt_stat,
- file->f_dentry);
+ file->f_path.dentry);
if (rc) {
ecryptfs_printk(KERN_WARNING, "Error "
"generating header; rc = "
@@ -638,8 +638,8 @@ static int ecryptfs_commit_write(struct
lower_inode = ecryptfs_inode_to_lower(inode);
lower_file = ecryptfs_file_to_lower(file);
mutex_lock(&lower_inode->i_mutex);
- crypt_stat =
- &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat;
+ crypt_stat = &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)
+ ->crypt_stat;
if (ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) {
ecryptfs_printk(KERN_DEBUG, "ECRYPTFS_NEW_FILE flag set in "
"crypt_stat at memory location [%p]\n", crypt_stat);


2006-10-21 07:13:55

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 23 of 23] xfs: change uses of f_{dentry,vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the xfs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

5 files changed, 23 insertions(+), 23 deletions(-)
fs/xfs/linux-2.6/xfs_file.c | 28 ++++++++++++++--------------
fs/xfs/linux-2.6/xfs_ioctl.c | 10 +++++-----
fs/xfs/linux-2.6/xfs_ioctl32.c | 2 +-
fs/xfs/linux-2.6/xfs_lrw.c | 2 +-
fs/xfs/xfs_dfrag.c | 4 ++--

diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -55,7 +55,7 @@ __xfs_file_read(
loff_t pos)
{
struct file *file = iocb->ki_filp;
- bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
+ bhv_vnode_t *vp = vn_from_inode(file->f_path.dentry->d_inode);

BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT))
@@ -131,7 +131,7 @@ xfs_file_sendfile(
read_actor_t actor,
void *target)
{
- return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
+ return bhv_vop_sendfile(vn_from_inode(filp->f_path.dentry->d_inode),
filp, pos, 0, count, actor, target, NULL);
}

@@ -143,7 +143,7 @@ xfs_file_sendfile_invis(
read_actor_t actor,
void *target)
{
- return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
+ return bhv_vop_sendfile(vn_from_inode(filp->f_path.dentry->d_inode),
filp, pos, IO_INVIS, count, actor, target, NULL);
}

@@ -155,7 +155,7 @@ xfs_file_splice_read(
size_t len,
unsigned int flags)
{
- return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
+ return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
infilp, ppos, pipe, len, flags, 0, NULL);
}

@@ -167,7 +167,7 @@ xfs_file_splice_read_invis(
size_t len,
unsigned int flags)
{
- return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
+ return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
infilp, ppos, pipe, len, flags, IO_INVIS,
NULL);
}
@@ -180,7 +180,7 @@ xfs_file_splice_write(
size_t len,
unsigned int flags)
{
- return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
+ return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
pipe, outfilp, ppos, len, flags, 0, NULL);
}

@@ -192,7 +192,7 @@ xfs_file_splice_write_invis(
size_t len,
unsigned int flags)
{
- return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
+ return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
pipe, outfilp, ppos, len, flags, IO_INVIS,
NULL);
}
@@ -212,7 +212,7 @@ xfs_file_close(
struct file *filp,
fl_owner_t id)
{
- return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0,
+ return -bhv_vop_close(vn_from_inode(filp->f_path.dentry->d_inode), 0,
file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
}

@@ -251,7 +251,7 @@ xfs_vm_nopage(
unsigned long address,
int *type)
{
- struct inode *inode = area->vm_file->f_dentry->d_inode;
+ struct inode *inode = area->vm_file->f_path.dentry->d_inode;
bhv_vnode_t *vp = vn_from_inode(inode);

ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
@@ -268,7 +268,7 @@ xfs_file_readdir(
filldir_t filldir)
{
int error = 0;
- bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
+ bhv_vnode_t *vp = vn_from_inode(filp->f_path.dentry->d_inode);
uio_t uio;
iovec_t iov;
int eof = 0;
@@ -345,7 +345,7 @@ xfs_file_mmap(
vma->vm_ops = &xfs_file_vm_ops;

#ifdef CONFIG_XFS_DMAPI
- if (vn_from_inode(filp->f_dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
+ if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
vma->vm_ops = &xfs_dmapi_file_vm_ops;
#endif /* CONFIG_XFS_DMAPI */

@@ -360,7 +360,7 @@ xfs_file_ioctl(
unsigned long p)
{
int error;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
bhv_vnode_t *vp = vn_from_inode(inode);

error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
@@ -382,7 +382,7 @@ xfs_file_ioctl_invis(
unsigned long p)
{
int error;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
bhv_vnode_t *vp = vn_from_inode(inode);

error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
@@ -404,7 +404,7 @@ xfs_vm_mprotect(
struct vm_area_struct *vma,
unsigned int newflags)
{
- bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
+ bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_path.dentry->d_inode);
int error = 0;

if (vp->v_vfsp->vfs_flag & VFS_DMI) {
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -107,9 +107,9 @@ xfs_find_handle(
if (!file)
return -EBADF;

- ASSERT(file->f_dentry);
- ASSERT(file->f_dentry->d_inode);
- inode = igrab(file->f_dentry->d_inode);
+ ASSERT(file->f_path.dentry);
+ ASSERT(file->f_path.dentry->d_inode);
+ inode = igrab(file->f_path.dentry->d_inode);
fput(file);
break;
}
@@ -333,10 +333,10 @@ xfs_open_by_handle(
}

/* Ensure umount returns EBUSY on umounts while this file is open. */
- mntget(parfilp->f_vfsmnt);
+ mntget(parfilp->f_path.mnt);

/* Create file pointer. */
- filp = dentry_open(dentry, parfilp->f_vfsmnt, hreq.oflags);
+ filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags);
if (IS_ERR(filp)) {
put_unused_fd(new_fd);
return -XFS_ERROR(-PTR_ERR(filp));
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -112,7 +112,7 @@ xfs_compat_ioctl(
unsigned cmd,
unsigned long arg)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
bhv_vnode_t *vp = vn_from_inode(inode);
int error;

diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -805,7 +805,7 @@ start:
!capable(CAP_FSETID)) {
error = xfs_write_clear_setuid(xip);
if (likely(!error))
- error = -remove_suid(file->f_dentry);
+ error = -remove_suid(file->f_path.dentry);
if (unlikely(error)) {
xfs_iunlock(xip, iolock);
goto out_unlock_mutex;
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -71,7 +71,7 @@ xfs_swapext(

/* Pull information for the target fd */
if (((fp = fget((int)sxp->sx_fdtarget)) == NULL) ||
- ((vp = vn_from_inode(fp->f_dentry->d_inode)) == NULL)) {
+ ((vp = vn_from_inode(fp->f_path.dentry->d_inode)) == NULL)) {
error = XFS_ERROR(EINVAL);
goto error0;
}
@@ -83,7 +83,7 @@ xfs_swapext(
}

if (((tfp = fget((int)sxp->sx_fdtmp)) == NULL) ||
- ((tvp = vn_from_inode(tfp->f_dentry->d_inode)) == NULL)) {
+ ((tvp = vn_from_inode(tfp->f_path.dentry->d_inode)) == NULL)) {
error = XFS_ERROR(EINVAL);
goto error0;
}


2006-10-21 07:14:25

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 09 of 23] nfs: change uses of f_{dentry,vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the nfs client code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

8 files changed, 29 insertions(+), 29 deletions(-)
fs/nfs/dir.c | 18 +++++++++---------
fs/nfs/direct.c | 10 +++++-----
fs/nfs/file.c | 14 +++++++-------
fs/nfs/idmap.c | 2 +-
fs/nfs/inode.c | 6 +++---
fs/nfs/nfs3proc.c | 2 +-
fs/nfs/proc.c | 2 +-
fs/nfs/write.c | 4 ++--

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -172,7 +172,7 @@ int nfs_readdir_filler(nfs_readdir_descr
int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
{
struct file *file = desc->file;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct rpc_cred *cred = nfs_file_cred(file);
unsigned long timestamp;
int error;
@@ -183,7 +183,7 @@ int nfs_readdir_filler(nfs_readdir_descr

again:
timestamp = jiffies;
- error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, desc->entry->cookie, page,
+ error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, desc->entry->cookie, page,
NFS_SERVER(inode)->dtsize, desc->plus);
if (error < 0) {
/* We requested READDIRPLUS, but the server doesn't grok it */
@@ -308,7 +308,7 @@ static inline
static inline
int find_dirent_page(nfs_readdir_descriptor_t *desc)
{
- struct inode *inode = desc->file->f_dentry->d_inode;
+ struct inode *inode = desc->file->f_path.dentry->d_inode;
struct page *page;
int status;

@@ -464,7 +464,7 @@ int uncached_readdir(nfs_readdir_descrip
filldir_t filldir)
{
struct file *file = desc->file;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct rpc_cred *cred = nfs_file_cred(file);
struct page *page = NULL;
int status;
@@ -477,7 +477,7 @@ int uncached_readdir(nfs_readdir_descrip
status = -ENOMEM;
goto out;
}
- desc->error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, *desc->dir_cookie,
+ desc->error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, *desc->dir_cookie,
page,
NFS_SERVER(inode)->dtsize,
desc->plus);
@@ -516,7 +516,7 @@ int uncached_readdir(nfs_readdir_descrip
*/
static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
nfs_readdir_descriptor_t my_desc,
*desc = &my_desc;
@@ -599,7 +599,7 @@ static int nfs_readdir(struct file *filp

loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
{
- mutex_lock(&filp->f_dentry->d_inode->i_mutex);
+ mutex_lock(&filp->f_path.dentry->d_inode->i_mutex);
switch (origin) {
case 1:
offset += filp->f_pos;
@@ -615,7 +615,7 @@ loff_t nfs_llseek_dir(struct file *filp,
((struct nfs_open_context *)filp->private_data)->dir_cookie = 0;
}
out:
- mutex_unlock(&filp->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
return offset;
}

@@ -1093,7 +1093,7 @@ no_open:

static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
{
- struct dentry *parent = desc->file->f_dentry;
+ struct dentry *parent = desc->file->f_path.dentry;
struct inode *dir = parent->d_inode;
struct nfs_entry *entry = desc->entry;
struct dentry *dentry, *alias;
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -116,7 +116,7 @@ ssize_t nfs_direct_IO(int rw, struct kio
ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
{
dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
- iocb->ki_filp->f_dentry->d_name.name,
+ iocb->ki_filp->f_path.dentry->d_name.name,
(long long) pos, nr_segs);

return -EINVAL;
@@ -740,8 +740,8 @@ ssize_t nfs_file_direct_read(struct kioc
size_t count = iov[0].iov_len;

dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n",
- file->f_dentry->d_parent->d_name.name,
- file->f_dentry->d_name.name,
+ file->f_path.dentry->d_parent->d_name.name,
+ file->f_path.dentry->d_name.name,
(unsigned long) count, (long long) pos);

if (nr_segs != 1)
@@ -804,8 +804,8 @@ ssize_t nfs_file_direct_write(struct kio
size_t count = iov[0].iov_len;

dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
- file->f_dentry->d_parent->d_name.name,
- file->f_dentry->d_name.name,
+ file->f_path.dentry->d_parent->d_name.name,
+ file->f_path.dentry->d_name.name,
(unsigned long) count, (long long) pos);

if (nr_segs != 1)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -176,7 +176,7 @@ nfs_file_flush(struct file *file, fl_own
nfs_file_flush(struct file *file, fl_owner_t id)
{
struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
int status;

dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);
@@ -201,7 +201,7 @@ nfs_file_read(struct kiocb *iocb, const
nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
- struct dentry * dentry = iocb->ki_filp->f_dentry;
+ struct dentry * dentry = iocb->ki_filp->f_path.dentry;
struct inode * inode = dentry->d_inode;
ssize_t result;
size_t count = iov_length(iov, nr_segs);
@@ -226,7 +226,7 @@ nfs_file_sendfile(struct file *filp, lof
nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
read_actor_t actor, void *target)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
ssize_t res;

@@ -243,7 +243,7 @@ static int
static int
nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
int status;

@@ -343,7 +343,7 @@ static ssize_t nfs_file_write(struct kio
static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
- struct dentry * dentry = iocb->ki_filp->f_dentry;
+ struct dentry * dentry = iocb->ki_filp->f_path.dentry;
struct inode * inode = dentry->d_inode;
ssize_t result;
size_t count = iov_length(iov, nr_segs);
@@ -529,8 +529,8 @@ static int nfs_flock(struct file *filp,
static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
{
dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n",
- filp->f_dentry->d_inode->i_sb->s_id,
- filp->f_dentry->d_inode->i_ino,
+ filp->f_path.dentry->d_inode->i_sb->s_id,
+ filp->f_path.dentry->d_inode->i_ino,
fl->fl_type, fl->fl_flags);

/*
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -377,7 +377,7 @@ static ssize_t
static ssize_t
idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
{
- struct rpc_inode *rpci = RPC_I(filp->f_dentry->d_inode);
+ struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
struct idmap *idmap = (struct idmap *)rpci->private;
struct idmap_msg im_in, *im = &idmap->idmap_im;
struct idmap_hashtable *h;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -496,7 +496,7 @@ void put_nfs_open_context(struct nfs_ope
*/
static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct nfs_inode *nfsi = NFS_I(inode);

filp->private_data = get_nfs_open_context(ctx);
@@ -528,7 +528,7 @@ struct nfs_open_context *nfs_find_open_c

static void nfs_file_clear_open_context(struct file *filp)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data;

if (ctx) {
@@ -551,7 +551,7 @@ int nfs_open(struct inode *inode, struct
cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
if (IS_ERR(cred))
return PTR_ERR(cred);
- ctx = alloc_nfs_open_context(filp->f_vfsmnt, filp->f_dentry, cred);
+ ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred);
put_rpccred(cred);
if (ctx == NULL)
return -ENOMEM;
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -889,7 +889,7 @@ static int
static int
nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
{
- return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl);
+ return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
}

const struct nfs_rpc_ops nfs_v3_clientops = {
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -680,7 +680,7 @@ static int
static int
nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
{
- return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl);
+ return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
}


diff --git a/fs/nfs/write.c b/fs/nfs/write.c
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -823,8 +823,8 @@ int nfs_updatepage(struct file *file, st
nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);

dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n",
- file->f_dentry->d_parent->d_name.name,
- file->f_dentry->d_name.name, count,
+ file->f_path.dentry->d_parent->d_name.name,
+ file->f_path.dentry->d_name.name, count,
(long long)(page_offset(page) +offset));

if (IS_SYNC(inode)) {


2006-10-21 07:14:44

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 03 of 23] proc: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the proc filesystem code.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

5 files changed, 33 insertions(+), 33 deletions(-)
fs/proc/base.c | 40 ++++++++++++++++++++--------------------
fs/proc/generic.c | 10 +++++-----
fs/proc/nommu.c | 4 ++--
fs/proc/task_mmu.c | 8 ++++----
fs/proc/task_nommu.c | 4 ++--

diff --git a/fs/proc/base.c b/fs/proc/base.c
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -471,7 +471,7 @@ static ssize_t proc_info_read(struct fil
static ssize_t proc_info_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
- struct inode * inode = file->f_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
unsigned long page;
ssize_t length;
struct task_struct *task = get_proc_task(inode);
@@ -511,7 +511,7 @@ static ssize_t mem_read(struct file * fi
static ssize_t mem_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->f_path.dentry->d_inode);
char *page;
unsigned long src = *ppos;
int ret = -ESRCH;
@@ -583,7 +583,7 @@ static ssize_t mem_write(struct file * f
{
int copied;
char *page;
- struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+ struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
unsigned long dst = *ppos;

copied = -ESRCH;
@@ -653,7 +653,7 @@ static ssize_t oom_adjust_read(struct fi
static ssize_t oom_adjust_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->f_path.dentry->d_inode);
char buffer[PROC_NUMBUF];
size_t len;
int oom_adjust;
@@ -695,7 +695,7 @@ static ssize_t oom_adjust_write(struct f
return -EINVAL;
if (*end == '\n')
end++;
- task = get_proc_task(file->f_dentry->d_inode);
+ task = get_proc_task(file->f_path.dentry->d_inode);
if (!task)
return -ESRCH;
task->oomkilladj = oom_adjust;
@@ -715,7 +715,7 @@ static ssize_t proc_loginuid_read(struct
static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
- struct inode * inode = file->f_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
struct task_struct *task = get_proc_task(inode);
ssize_t length;
char tmpbuf[TMPBUFLEN];
@@ -731,7 +731,7 @@ static ssize_t proc_loginuid_write(struc
static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
{
- struct inode * inode = file->f_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
char *page, *tmp;
ssize_t length;
uid_t loginuid;
@@ -782,7 +782,7 @@ static ssize_t seccomp_read(struct file
static ssize_t seccomp_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
- struct task_struct *tsk = get_proc_task(file->f_dentry->d_inode);
+ struct task_struct *tsk = get_proc_task(file->f_path.dentry->d_inode);
char __buf[20];
loff_t __ppos = *ppos;
size_t len;
@@ -805,7 +805,7 @@ static ssize_t seccomp_write(struct file
static ssize_t seccomp_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
- struct task_struct *tsk = get_proc_task(file->f_dentry->d_inode);
+ struct task_struct *tsk = get_proc_task(file->f_path.dentry->d_inode);
char __buf[20], *end;
unsigned int seccomp_mode;
ssize_t result;
@@ -1075,7 +1075,7 @@ static int proc_fill_cache(struct file *
char *name, int len,
instantiate_t instantiate, struct task_struct *task, void *ptr)
{
- struct dentry *child, *dir = filp->f_dentry;
+ struct dentry *child, *dir = filp->f_path.dentry;
struct inode *inode;
struct qstr qname;
ino_t ino = 0;
@@ -1154,8 +1154,8 @@ static int proc_fd_link(struct inode *in
spin_lock(&files->file_lock);
file = fcheck_files(files, fd);
if (file) {
- *mnt = mntget(file->f_vfsmnt);
- *dentry = dget(file->f_dentry);
+ *mnt = mntget(file->f_path.mnt);
+ *dentry = dget(file->f_path.dentry);
spin_unlock(&files->file_lock);
put_files_struct(files);
return 0;
@@ -1290,7 +1290,7 @@ static int proc_fd_fill_cache(struct fil

static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
struct task_struct *p = get_proc_task(inode);
unsigned int fd, tid, ino;
@@ -1437,7 +1437,7 @@ static int proc_pident_readdir(struct fi
{
int i;
int pid;
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
struct task_struct *task = get_proc_task(inode);
struct pid_entry *p, *last;
@@ -1493,7 +1493,7 @@ static ssize_t proc_pid_attr_read(struct
static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
- struct inode * inode = file->f_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
unsigned long page;
ssize_t length;
struct task_struct *task = get_proc_task(inode);
@@ -1509,7 +1509,7 @@ static ssize_t proc_pid_attr_read(struct
goto out;

length = security_getprocattr(task,
- (char*)file->f_dentry->d_name.name,
+ (char*)file->f_path.dentry->d_name.name,
(void*)page, count);
if (length >= 0)
length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
@@ -1523,7 +1523,7 @@ static ssize_t proc_pid_attr_write(struc
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_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
char *page;
ssize_t length;
struct task_struct *task = get_proc_task(inode);
@@ -1549,7 +1549,7 @@ static ssize_t proc_pid_attr_write(struc
goto out_free;

length = security_setprocattr(task,
- (char*)file->f_dentry->d_name.name,
+ (char*)file->f_path.dentry->d_name.name,
(void*)page, count);
out_free:
free_page((unsigned long) page);
@@ -1990,7 +1990,7 @@ int proc_pid_readdir(struct file * filp,
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
- struct task_struct *reaper = get_proc_task(filp->f_dentry->d_inode);
+ struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
struct task_struct *task;
int tgid;

@@ -2231,7 +2231,7 @@ static int proc_task_fill_cache(struct f
/* for the /proc/TGID/task/ directories */
static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
struct task_struct *leader = get_proc_task(inode);
struct task_struct *task;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -52,7 +52,7 @@ proc_file_read(struct file *file, char _
proc_file_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->f_path.dentry->d_inode;
char *page;
ssize_t retval=0;
int eof=0;
@@ -203,7 +203,7 @@ proc_file_write(struct file *file, const
proc_file_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;
struct proc_dir_entry * dp;

dp = PDE(inode);
@@ -432,7 +432,7 @@ int proc_readdir(struct file * filp,
struct proc_dir_entry * de;
unsigned int ino;
int i;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
int ret = 0;

lock_kernel();
@@ -453,7 +453,7 @@ int proc_readdir(struct file * filp,
/* fall through */
case 1:
if (filldir(dirent, "..", 2, i,
- parent_ino(filp->f_dentry),
+ parent_ino(filp->f_path.dentry),
DT_DIR) < 0)
goto out;
i++;
@@ -558,7 +558,7 @@ static void proc_kill_inodes(struct proc
file_list_lock();
list_for_each(p, &sb->s_files) {
struct file * filp = list_entry(p, struct file, f_u.fu_list);
- struct dentry * dentry = filp->f_dentry;
+ struct dentry * dentry = filp->f_path.dentry;
struct inode * inode;
const struct file_operations *fops;

diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -46,7 +46,7 @@ int nommu_vma_show(struct seq_file *m, s
file = vma->vm_file;

if (file) {
- struct inode *inode = vma->vm_file->f_dentry->d_inode;
+ struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
}
@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, s
if (len < 1)
len = 1;
seq_printf(m, "%*c", len, ' ');
- seq_path(m, file->f_vfsmnt, file->f_dentry, "");
+ seq_path(m, file->f_path.mnt, file->f_path.dentry, "");
}

seq_putc(m, '\n');
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -94,8 +94,8 @@ int proc_exe_link(struct inode *inode, s
}

if (vma) {
- *mnt = mntget(vma->vm_file->f_vfsmnt);
- *dentry = dget(vma->vm_file->f_dentry);
+ *mnt = mntget(vma->vm_file->f_path.mnt);
+ *dentry = dget(vma->vm_file->f_path.dentry);
result = 0;
}

@@ -135,7 +135,7 @@ static int show_map_internal(struct seq_
int len;

if (file) {
- struct inode *inode = vma->vm_file->f_dentry->d_inode;
+ struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
}
@@ -156,7 +156,7 @@ static int show_map_internal(struct seq_
*/
if (file) {
pad_len_spaces(m, len);
- seq_path(m, file->f_vfsmnt, file->f_dentry, "\n");
+ seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n");
} else {
const char *name = arch_vma_name(vma);
if (!name) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -126,8 +126,8 @@ int proc_exe_link(struct inode *inode, s
}

if (vma) {
- *mnt = mntget(vma->vm_file->f_vfsmnt);
- *dentry = dget(vma->vm_file->f_dentry);
+ *mnt = mntget(vma->vm_file->f_path.mnt);
+ *dentry = dget(vma->vm_file->f_path.dentry);
result = 0;
}



2006-10-21 07:19:00

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 21 of 23] cifs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the cifs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

4 files changed, 77 insertions(+), 77 deletions(-)
fs/cifs/cifsfs.c | 4 -
fs/cifs/fcntl.c | 4 -
fs/cifs/file.c | 114 ++++++++++++++++++++++++++---------------------------
fs/cifs/readdir.c | 32 +++++++-------

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -497,7 +497,7 @@ static ssize_t cifs_file_aio_write(struc
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_dentry->d_inode;
+ struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t written;

written = generic_file_aio_write(iocb, iov, nr_segs, pos);
@@ -510,7 +510,7 @@ static loff_t cifs_llseek(struct file *f
{
/* origin == SEEK_END => we must revalidate the cached file length */
if (origin == SEEK_END) {
- int retval = cifs_revalidate(file->f_dentry);
+ int retval = cifs_revalidate(file->f_path.dentry);
if (retval < 0)
return (loff_t)retval;
}
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
--- a/fs/cifs/fcntl.c
+++ b/fs/cifs/fcntl.c
@@ -83,10 +83,10 @@ int cifs_dir_notify(struct file * file,
return 0;

xid = GetXid();
- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

- full_path = build_path_from_dentry(file->f_dentry);
+ full_path = build_path_from_dentry(file->f_path.dentry);

if(full_path == NULL) {
rc = -ENOMEM;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -122,34 +122,34 @@ static inline int cifs_open_inode_helper
/* if not oplocked, invalidate inode pages if mtime or file
size changed */
temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime));
- if (timespec_equal(&file->f_dentry->d_inode->i_mtime, &temp) &&
- (file->f_dentry->d_inode->i_size ==
+ if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&
+ (file->f_path.dentry->d_inode->i_size ==
(loff_t)le64_to_cpu(buf->EndOfFile))) {
cFYI(1, ("inode unchanged on server"));
} else {
- if (file->f_dentry->d_inode->i_mapping) {
+ if (file->f_path.dentry->d_inode->i_mapping) {
/* BB no need to lock inode until after invalidate
since namei code should already have it locked? */
- filemap_write_and_wait(file->f_dentry->d_inode->i_mapping);
+ filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
}
cFYI(1, ("invalidating remote inode since open detected it "
"changed"));
- invalidate_remote_inode(file->f_dentry->d_inode);
+ invalidate_remote_inode(file->f_path.dentry->d_inode);
}

client_can_cache:
if (pTcon->ses->capabilities & CAP_UNIX)
- rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode,
+ rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode,
full_path, inode->i_sb, xid);
else
- rc = cifs_get_inode_info(&file->f_dentry->d_inode,
+ rc = cifs_get_inode_info(&file->f_path.dentry->d_inode,
full_path, buf, inode->i_sb, xid);

if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE;
cFYI(1, ("Exclusive Oplock granted on inode %p",
- file->f_dentry->d_inode));
+ file->f_path.dentry->d_inode));
} else if ((*oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE;

@@ -178,7 +178,7 @@ int cifs_open(struct inode *inode, struc

if (file->f_flags & O_CREAT) {
/* search inode for this file and fill in file->private_data */
- pCifsInode = CIFS_I(file->f_dentry->d_inode);
+ pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &pCifsInode->openFileList) {
pCifsFile = list_entry(tmp, struct cifsFileInfo,
@@ -206,7 +206,7 @@ int cifs_open(struct inode *inode, struc
}
}

- full_path = build_path_from_dentry(file->f_dentry);
+ full_path = build_path_from_dentry(file->f_path.dentry);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
@@ -291,7 +291,7 @@ int cifs_open(struct inode *inode, struc
write_lock(&GlobalSMBSeslock);
list_add(&pCifsFile->tlist, &pTcon->openFileList);

- pCifsInode = CIFS_I(file->f_dentry->d_inode);
+ pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
if (pCifsInode) {
rc = cifs_open_inode_helper(inode, file, pCifsInode,
pCifsFile, pTcon,
@@ -366,7 +366,7 @@ static int cifs_reopen_file(struct inode
return 0;
}

- if (file->f_dentry == NULL) {
+ if (file->f_path.dentry == NULL) {
up(&pCifsFile->fh_sem);
cFYI(1, ("failed file reopen, no valid name if dentry freed"));
FreeXid(xid);
@@ -378,7 +378,7 @@ static int cifs_reopen_file(struct inode
those that already have the rename sem can end up causing writepage
to get called and if the server was down that means we end up here,
and we can never tell if the caller already has the rename_sem */
- full_path = build_path_from_dentry(file->f_dentry);
+ full_path = build_path_from_dentry(file->f_path.dentry);
if (full_path == NULL) {
up(&pCifsFile->fh_sem);
FreeXid(xid);
@@ -444,7 +444,7 @@ static int cifs_reopen_file(struct inode
pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE;
cFYI(1, ("Exclusive Oplock granted on inode %p",
- file->f_dentry->d_inode));
+ file->f_path.dentry->d_inode));
} else if ((oplock & 0xF) == OPLOCK_READ) {
pCifsInode->clientCanCacheRead = TRUE;
pCifsInode->clientCanCacheAll = FALSE;
@@ -547,7 +547,7 @@ int cifs_closedir(struct inode *inode, s

if (pCFileStruct) {
struct cifsTconInfo *pTcon;
- struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);

pTcon = cifs_sb->tcon;

@@ -660,7 +660,7 @@ int cifs_lock(struct file *file, int cmd
} else
cFYI(1, ("Unknown type of lock"));

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

if (file->private_data == NULL) {
@@ -787,10 +787,10 @@ ssize_t cifs_user_write(struct file *fil
int xid, long_op;
struct cifsFileInfo *open_file;

- if (file->f_dentry == NULL)
+ if (file->f_path.dentry == NULL)
return -EBADF;

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
if (cifs_sb == NULL)
return -EBADF;

@@ -798,7 +798,7 @@ ssize_t cifs_user_write(struct file *fil

/* cFYI(1,
(" write %d bytes to offset %lld of %s", write_size,
- *poffset, file->f_dentry->d_name.name)); */
+ *poffset, file->f_path.dentry->d_name.name)); */

if (file->private_data == NULL)
return -EBADF;
@@ -806,12 +806,12 @@ ssize_t cifs_user_write(struct file *fil
open_file = (struct cifsFileInfo *) file->private_data;

xid = GetXid();
- if (file->f_dentry->d_inode == NULL) {
+ if (file->f_path.dentry->d_inode == NULL) {
FreeXid(xid);
return -EBADF;
}

- if (*poffset > file->f_dentry->d_inode->i_size)
+ if (*poffset > file->f_path.dentry->d_inode->i_size)
long_op = 2; /* writes past end of file can take a long time */
else
long_op = 1;
@@ -836,8 +836,8 @@ ssize_t cifs_user_write(struct file *fil
return -EBADF;
}
if (open_file->invalidHandle) {
- if ((file->f_dentry == NULL) ||
- (file->f_dentry->d_inode == NULL)) {
+ if ((file->f_path.dentry == NULL) ||
+ (file->f_path.dentry->d_inode == NULL)) {
FreeXid(xid);
return total_written;
}
@@ -845,7 +845,7 @@ ssize_t cifs_user_write(struct file *fil
filemap_fdatawait from here so tell
reopen_file not to flush data to server
now */
- rc = cifs_reopen_file(file->f_dentry->d_inode,
+ rc = cifs_reopen_file(file->f_path.dentry->d_inode,
file, FALSE);
if (rc != 0)
break;
@@ -874,17 +874,17 @@ ssize_t cifs_user_write(struct file *fil
cifs_stats_bytes_written(pTcon, total_written);

/* since the write may have blocked check these pointers again */
- if (file->f_dentry) {
- if (file->f_dentry->d_inode) {
- struct inode *inode = file->f_dentry->d_inode;
+ if (file->f_path.dentry) {
+ if (file->f_path.dentry->d_inode) {
+ struct inode *inode = file->f_path.dentry->d_inode;
inode->i_ctime = inode->i_mtime =
current_fs_time(inode->i_sb);
if (total_written > 0) {
- if (*poffset > file->f_dentry->d_inode->i_size)
- i_size_write(file->f_dentry->d_inode,
+ if (*poffset > file->f_path.dentry->d_inode->i_size)
+ i_size_write(file->f_path.dentry->d_inode,
*poffset);
}
- mark_inode_dirty_sync(file->f_dentry->d_inode);
+ mark_inode_dirty_sync(file->f_path.dentry->d_inode);
}
}
FreeXid(xid);
@@ -902,17 +902,17 @@ static ssize_t cifs_write(struct file *f
int xid, long_op;
struct cifsFileInfo *open_file;

- if (file->f_dentry == NULL)
+ if (file->f_path.dentry == NULL)
return -EBADF;

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
if (cifs_sb == NULL)
return -EBADF;

pTcon = cifs_sb->tcon;

cFYI(1,("write %zd bytes to offset %lld of %s", write_size,
- *poffset, file->f_dentry->d_name.name));
+ *poffset, file->f_path.dentry->d_name.name));

if (file->private_data == NULL)
return -EBADF;
@@ -920,12 +920,12 @@ static ssize_t cifs_write(struct file *f
open_file = (struct cifsFileInfo *)file->private_data;

xid = GetXid();
- if (file->f_dentry->d_inode == NULL) {
+ if (file->f_path.dentry->d_inode == NULL) {
FreeXid(xid);
return -EBADF;
}

- if (*poffset > file->f_dentry->d_inode->i_size)
+ if (*poffset > file->f_path.dentry->d_inode->i_size)
long_op = 2; /* writes past end of file can take a long time */
else
long_op = 1;
@@ -951,8 +951,8 @@ static ssize_t cifs_write(struct file *f
return -EBADF;
}
if (open_file->invalidHandle) {
- if ((file->f_dentry == NULL) ||
- (file->f_dentry->d_inode == NULL)) {
+ if ((file->f_path.dentry == NULL) ||
+ (file->f_path.dentry->d_inode == NULL)) {
FreeXid(xid);
return total_written;
}
@@ -960,7 +960,7 @@ static ssize_t cifs_write(struct file *f
filemap_fdatawait from here so tell
reopen_file not to flush data to
server now */
- rc = cifs_reopen_file(file->f_dentry->d_inode,
+ rc = cifs_reopen_file(file->f_path.dentry->d_inode,
file, FALSE);
if (rc != 0)
break;
@@ -1007,16 +1007,16 @@ static ssize_t cifs_write(struct file *f
cifs_stats_bytes_written(pTcon, total_written);

/* since the write may have blocked check these pointers again */
- if (file->f_dentry) {
- if (file->f_dentry->d_inode) {
- file->f_dentry->d_inode->i_ctime =
- file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
+ if (file->f_path.dentry) {
+ if (file->f_path.dentry->d_inode) {
+ file->f_path.dentry->d_inode->i_ctime =
+ file->f_path.dentry->d_inode->i_mtime = CURRENT_TIME;
if (total_written > 0) {
- if (*poffset > file->f_dentry->d_inode->i_size)
- i_size_write(file->f_dentry->d_inode,
+ if (*poffset > file->f_path.dentry->d_inode->i_size)
+ i_size_write(file->f_path.dentry->d_inode,
*poffset);
}
- mark_inode_dirty_sync(file->f_dentry->d_inode);
+ mark_inode_dirty_sync(file->f_path.dentry->d_inode);
}
}
FreeXid(xid);
@@ -1380,7 +1380,7 @@ static int cifs_commit_write(struct file
if ((open_file->invalidHandle) &&
(!open_file->closePend)) {
rc = cifs_reopen_file(
- file->f_dentry->d_inode, file);
+ file->f_path.dentry->d_inode, file);
if (rc != 0)
break;
}
@@ -1430,7 +1430,7 @@ int cifs_fsync(struct file *file, struct
{
int xid;
int rc = 0;
- struct inode *inode = file->f_dentry->d_inode;
+ struct inode *inode = file->f_path.dentry->d_inode;

xid = GetXid();

@@ -1478,7 +1478,7 @@ int cifs_fsync(struct file *file, struct
*/
int cifs_flush(struct file *file, fl_owner_t id)
{
- struct inode * inode = file->f_dentry->d_inode;
+ struct inode * inode = file->f_path.dentry->d_inode;
int rc = 0;

/* Rather than do the steps manually:
@@ -1515,7 +1515,7 @@ ssize_t cifs_user_read(struct file *file
struct smb_com_read_rsp *pSMBr;

xid = GetXid();
- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

if (file->private_data == NULL) {
@@ -1538,7 +1538,7 @@ ssize_t cifs_user_read(struct file *file
int buf_type = CIFS_NO_BUFFER;
if ((open_file->invalidHandle) &&
(!open_file->closePend)) {
- rc = cifs_reopen_file(file->f_dentry->d_inode,
+ rc = cifs_reopen_file(file->f_path.dentry->d_inode,
file, TRUE);
if (rc != 0)
break;
@@ -1597,7 +1597,7 @@ static ssize_t cifs_read(struct file *fi
int buf_type = CIFS_NO_BUFFER;

xid = GetXid();
- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

if (file->private_data == NULL) {
@@ -1625,7 +1625,7 @@ static ssize_t cifs_read(struct file *fi
while (rc == -EAGAIN) {
if ((open_file->invalidHandle) &&
(!open_file->closePend)) {
- rc = cifs_reopen_file(file->f_dentry->d_inode,
+ rc = cifs_reopen_file(file->f_path.dentry->d_inode,
file, TRUE);
if (rc != 0)
break;
@@ -1654,7 +1654,7 @@ static ssize_t cifs_read(struct file *fi

int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
{
- struct dentry *dentry = file->f_dentry;
+ struct dentry *dentry = file->f_path.dentry;
int rc, xid;

xid = GetXid();
@@ -1740,7 +1740,7 @@ static int cifs_readpages(struct file *f
return -EBADF;
}
open_file = (struct cifsFileInfo *)file->private_data;
- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

pagevec_init(&lru_pvec, 0);
@@ -1782,7 +1782,7 @@ static int cifs_readpages(struct file *f
while (rc == -EAGAIN) {
if ((open_file->invalidHandle) &&
(!open_file->closePend)) {
- rc = cifs_reopen_file(file->f_dentry->d_inode,
+ rc = cifs_reopen_file(file->f_path.dentry->d_inode,
file, TRUE);
if (rc != 0)
break;
@@ -1897,8 +1897,8 @@ static int cifs_readpage_worker(struct f
else
cFYI(1, ("Bytes read %d",rc));

- file->f_dentry->d_inode->i_atime =
- current_fs_time(file->f_dentry->d_inode->i_sb);
+ file->f_path.dentry->d_inode->i_atime =
+ current_fs_time(file->f_path.dentry->d_inode->i_sb);

if (PAGE_CACHE_SIZE > rc)
memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -68,30 +68,30 @@ static int construct_dentry(struct qstr
int rc = 0;

cFYI(1, ("For %s", qstring->name));
- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;

qstring->hash = full_name_hash(qstring->name, qstring->len);
- tmp_dentry = d_lookup(file->f_dentry, qstring);
+ tmp_dentry = d_lookup(file->f_path.dentry, qstring);
if (tmp_dentry) {
cFYI(0, ("existing dentry with inode 0x%p", tmp_dentry->d_inode));
*ptmp_inode = tmp_dentry->d_inode;
/* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/
if(*ptmp_inode == NULL) {
- *ptmp_inode = new_inode(file->f_dentry->d_sb);
+ *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
if(*ptmp_inode == NULL)
return rc;
rc = 1;
}
} else {
- tmp_dentry = d_alloc(file->f_dentry, qstring);
+ tmp_dentry = d_alloc(file->f_path.dentry, qstring);
if(tmp_dentry == NULL) {
cERROR(1,("Failed allocating dentry"));
*ptmp_inode = NULL;
return rc;
}

- *ptmp_inode = new_inode(file->f_dentry->d_sb);
+ *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
if (pTcon->nocase)
tmp_dentry->d_op = &cifs_ci_dentry_ops;
else
@@ -432,10 +432,10 @@ static int initiate_cifs_search(const in
cifsFile->invalidHandle = TRUE;
cifsFile->srch_inf.endOfSearch = FALSE;

- if(file->f_dentry == NULL)
+ if(file->f_path.dentry == NULL)
return -ENOENT;

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
if(cifs_sb == NULL)
return -EINVAL;

@@ -443,7 +443,7 @@ static int initiate_cifs_search(const in
if(pTcon == NULL)
return -EINVAL;

- full_path = build_path_from_dentry(file->f_dentry);
+ full_path = build_path_from_dentry(file->f_path.dentry);

if(full_path == NULL) {
return -ENOMEM;
@@ -609,10 +609,10 @@ static int is_dir_changed(struct file *
struct inode * inode;
struct cifsInodeInfo *cifsInfo;

- if(file->f_dentry == NULL)
+ if(file->f_path.dentry == NULL)
return 0;

- inode = file->f_dentry->d_inode;
+ inode = file->f_path.dentry->d_inode;

if(inode == NULL)
return 0;
@@ -839,7 +839,7 @@ static int cifs_filldir(char *pfindEntry
if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
return -ENOENT;

- if(file->f_dentry == NULL)
+ if(file->f_path.dentry == NULL)
return -ENOENT;

rc = cifs_entry_is_dot(pfindEntry,pCifsF);
@@ -847,7 +847,7 @@ static int cifs_filldir(char *pfindEntry
if(rc != 0)
return 0;

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);

qstring.name = scratch_buf;
rc = cifs_get_name_from_search_buf(&qstring,pfindEntry,
@@ -981,12 +981,12 @@ int cifs_readdir(struct file *file, void

xid = GetXid();

- if(file->f_dentry == NULL) {
+ if(file->f_path.dentry == NULL) {
FreeXid(xid);
return -EIO;
}

- cifs_sb = CIFS_SB(file->f_dentry->d_sb);
+ cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
if(pTcon == NULL)
return -EINVAL;
@@ -994,7 +994,7 @@ int cifs_readdir(struct file *file, void
switch ((int) file->f_pos) {
case 0:
if (filldir(direntry, ".", 1, file->f_pos,
- file->f_dentry->d_inode->i_ino, DT_DIR) < 0) {
+ file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
cERROR(1, ("Filldir for current dir failed"));
rc = -ENOMEM;
break;
@@ -1002,7 +1002,7 @@ int cifs_readdir(struct file *file, void
file->f_pos++;
case 1:
if (filldir(direntry, "..", 2, file->f_pos,
- file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
+ file->f_path.dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
cERROR(1, ("Filldir for parent dir failed"));
rc = -ENOMEM;
break;


2006-10-21 07:20:17

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 16 of 23] 9p: change uses of f_{dentry,vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the 9p filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

3 files changed, 7 insertions(+), 7 deletions(-)
fs/9p/vfs_addr.c | 2 +-
fs/9p/vfs_dir.c | 4 ++--
fs/9p/vfs_file.c | 8 ++++----

diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -54,7 +54,7 @@ static int v9fs_vfs_readpage(struct file
int retval = -EIO;
loff_t offset = page_offset(page);
int count = PAGE_CACHE_SIZE;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
int rsize = v9ses->maxdata - V9FS_IOHDRSZ;
struct v9fs_fid *v9f = filp->private_data;
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -70,7 +70,7 @@ static int v9fs_dir_readdir(struct file
static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct v9fs_fcall *fcall = NULL;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
struct v9fs_fid *file = filp->private_data;
unsigned int i, n, s;
@@ -79,7 +79,7 @@ static int v9fs_dir_readdir(struct file
struct v9fs_stat stat;
int over = 0;

- dprintk(DEBUG_VFS, "name %s\n", filp->f_dentry->d_name.name);
+ dprintk(DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);

fid = file->fid;

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -59,7 +59,7 @@ int v9fs_file_open(struct inode *inode,

dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);

- vfid = v9fs_fid_lookup(file->f_dentry);
+ vfid = v9fs_fid_lookup(file->f_path.dentry);
if (!vfid) {
dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
return -EBADF;
@@ -132,7 +132,7 @@ static int v9fs_file_lock(struct file *f
static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
{
int res = 0;
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;

dprintk(DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);

@@ -160,7 +160,7 @@ v9fs_file_read(struct file *filp, char _
v9fs_file_read(struct file *filp, char __user * data, size_t count,
loff_t * offset)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
struct v9fs_fid *v9f = filp->private_data;
struct v9fs_fcall *fcall = NULL;
@@ -224,7 +224,7 @@ v9fs_file_write(struct file *filp, const
v9fs_file_write(struct file *filp, const char __user * data,
size_t count, loff_t * offset)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
struct v9fs_fid *v9fid = filp->private_data;
struct v9fs_fcall *fcall;


2006-10-21 07:20:54

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 17 of 23] affs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the affs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

1 file changed, 2 insertions(+), 2 deletions(-)
fs/affs/dir.c | 4 ++--

diff --git a/fs/affs/dir.c b/fs/affs/dir.c
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -41,7 +41,7 @@ static int
static int
affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct inode *inode = filp->f_dentry->d_inode;
+ struct inode *inode = filp->f_path.dentry->d_inode;
struct super_block *sb = inode->i_sb;
struct buffer_head *dir_bh;
struct buffer_head *fh_bh;
@@ -71,7 +71,7 @@ affs_readdir(struct file *filp, void *di
stored++;
}
if (f_pos == 1) {
- if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_dentry), DT_DIR) < 0)
+ if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_path.dentry), DT_DIR) < 0)
return stored;
filp->f_pos = f_pos = 2;
stored++;


2006-10-21 07:21:12

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 20 of 23] configfs: change uses of f_{dentry, vfsmnt} to use f_path

From: Josef "Jeff" Sipek <[email protected]>

This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
in the configfs filesystem.

Signed-off-by: Josef "Jeff" Sipek <[email protected]>

---

2 files changed, 11 insertions(+), 11 deletions(-)
fs/configfs/dir.c | 10 +++++-----
fs/configfs/file.c | 12 ++++++------

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -980,7 +980,7 @@ int configfs_rename_dir(struct config_it

static int configfs_dir_open(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;
struct configfs_dirent * parent_sd = dentry->d_fsdata;

mutex_lock(&dentry->d_inode->i_mutex);
@@ -993,7 +993,7 @@ static int configfs_dir_open(struct inod

static int configfs_dir_close(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;
struct configfs_dirent * cursor = file->private_data;

mutex_lock(&dentry->d_inode->i_mutex);
@@ -1013,7 +1013,7 @@ static inline unsigned char dt_type(stru

static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *dentry = filp->f_path.dentry;
struct configfs_dirent * parent_sd = dentry->d_fsdata;
struct configfs_dirent *cursor = filp->private_data;
struct list_head *p, *q = &cursor->s_sibling;
@@ -1070,7 +1070,7 @@ static int configfs_readdir(struct file

static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
{
- struct dentry * dentry = file->f_dentry;
+ struct dentry * dentry = file->f_path.dentry;

mutex_lock(&dentry->d_inode->i_mutex);
switch (origin) {
@@ -1080,7 +1080,7 @@ static loff_t configfs_dir_lseek(struct
if (offset >= 0)
break;
default:
- mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+ mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return -EINVAL;
}
if (offset != file->f_pos) {
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -134,7 +134,7 @@ configfs_read_file(struct file *file, ch

down(&buffer->sem);
if (buffer->needs_read_fill) {
- if ((retval = fill_read_buffer(file->f_dentry,buffer)))
+ if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
goto out;
}
pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -222,7 +222,7 @@ configfs_write_file(struct file *file, c
down(&buffer->sem);
len = fill_write_buffer(buffer, buf, count);
if (len > 0)
- len = flush_write_buffer(file->f_dentry, buffer, count);
+ len = flush_write_buffer(file->f_path.dentry, buffer, count);
if (len > 0)
*ppos += len;
up(&buffer->sem);
@@ -231,8 +231,8 @@ configfs_write_file(struct file *file, c

static int check_perm(struct inode * inode, struct file * file)
{
- struct config_item *item = configfs_get_config_item(file->f_dentry->d_parent);
- struct configfs_attribute * attr = to_attr(file->f_dentry);
+ struct config_item *item = configfs_get_config_item(file->f_path.dentry->d_parent);
+ struct configfs_attribute * attr = to_attr(file->f_path.dentry);
struct configfs_buffer * buffer;
struct configfs_item_operations * ops = NULL;
int error = 0;
@@ -305,8 +305,8 @@ static int configfs_open_file(struct ino

static int configfs_release(struct inode * inode, struct file * filp)
{
- struct config_item * item = to_item(filp->f_dentry->d_parent);
- struct configfs_attribute * attr = to_attr(filp->f_dentry);
+ struct config_item * item = to_item(filp->f_path.dentry->d_parent);
+ struct configfs_attribute * attr = to_attr(filp->f_path.dentry);
struct module * owner = attr->ca_owner;
struct configfs_buffer * buffer = filp->private_data;



2006-10-21 07:22:20

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 01 of 23] VFS: change struct file to use struct path

On Sat, 21 Oct 2006 02:17:26 -0400
Josef "Jeff" Sipek <[email protected]> wrote:

> From: Josef "Jeff" Sipek <[email protected]>
>
> This patch changes struct file to use struct path instead of having
> independent pointers to struct dentry and struct vfsmount, and converts all
> users of f_{dentry,vfsmnt} in fs/ to use f_path.{dentry,mnt}.
>

why?

> @@ -723,8 +724,9 @@ struct file {
> struct list_head fu_list;
> struct rcu_head fu_rcuhead;
> } f_u;
> - struct dentry *f_dentry;
> - struct vfsmount *f_vfsmnt;
> + struct path f_path;
> +#define f_dentry f_path.dentry
> +#define f_vfsmnt f_path.mnt
> const struct file_operations *f_op;
> atomic_t f_count;
> unsigned int f_flags;

2006-10-21 07:28:22

by Josef Sipek

[permalink] [raw]
Subject: Re: [PATCH 01 of 23] VFS: change struct file to use struct path

On Sat, Oct 21, 2006 at 12:22:00AM -0700, Andrew Morton wrote:
> On Sat, 21 Oct 2006 02:17:26 -0400
> Josef "Jeff" Sipek <[email protected]> wrote:
>
> > From: Josef "Jeff" Sipek <[email protected]>
> >
> > This patch changes struct file to use struct path instead of having
> > independent pointers to struct dentry and struct vfsmount, and converts all
> > users of f_{dentry,vfsmnt} in fs/ to use f_path.{dentry,mnt}.
> >
>
> why?

It's little cleaner than having two pointers. In general, there is a number
of users of dentry-vfsmount pairs in the kernel, and struct path nicely
wraps it.

As to why struct file in particular, and not some other structure, it's
mostly because Al suggested it... "I can give you a dozen examples of
possible users right now - starting with struct file" (from the struct path
thread few days ago.)

Josef "Jeff" Sipek.

--
Don't drink and derive. Alcohol and algebra don't mix.

2006-10-21 12:52:56

by Bob Peterson

[permalink] [raw]
Subject: Re: [PATCH 05 of 23] ext3: change uses of f_{dentry, vfsmnt} to use f_path

Josef Jeff Sipek wrote:
> From: Josef "Jeff" Sipek <[email protected]>
>
> This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
> in the ext3 filesystem.
>
Hey Jeff,

Don't forget about GFS2: fs/gfs2/ops_file.c.

Regards,

Bob Peterson
Red Hat Cluster Suite

2006-10-21 18:27:10

by Josef Sipek

[permalink] [raw]
Subject: Re: [PATCH 05 of 23] ext3: change uses of f_{dentry, vfsmnt} to use f_path

On Sat, Oct 21, 2006 at 07:51:44AM -0500, Robert Peterson wrote:
> Josef Jeff Sipek wrote:
> >From: Josef "Jeff" Sipek <[email protected]>
> >
> >This patch changes all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt}
> >in the ext3 filesystem.
> >
> Hey Jeff,
>
> Don't forget about GFS2: fs/gfs2/ops_file.c.

I'm aware. There are still about 500 instances of f_{dentry,vfsmnt}, but I
just wanted to see whether or not this would go anywhere. If it does, the
remaining instances will get fixed up too.

Josef "Jeff" Sipek.

--
Evolution, n.:
A hypothetical process whereby infinitely improbable events occur with
alarming frequency, order arises from chaos, and no one is given credit.

2006-10-21 23:13:19

by James Morris

[permalink] [raw]
Subject: Re: [PATCH 08 of 23] isofs: change uses of f_{dentry, vfsmnt} to use f_path

On Sat, 21 Oct 2006, Josef Jeff Sipek wrote:

> + struct inode *inode = file->f_path.dentry->d_inode;

It seems clumsy to pepper the kernel code with the above.

What about something like:

static inline struct inode *fpath_ino(struct file *file)
{
return file->f_path.dentry->d_inode;
}



--
James Morris
<[email protected]>

2006-10-22 00:12:01

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH 08 of 23] isofs: change uses of f_{dentry, vfsmnt} to use f_path



On Sat, 21 Oct 2006, James Morris wrote:
>
> What about something like:
>
> static inline struct inode *fpath_ino(struct file *file)
> {
> return file->f_path.dentry->d_inode;
> }

Generally, unless it saves a _lot_ of typing, we've tried to avoid
gratuitous hiding of details. And "ino" isn't a good name, it's something
we've traditionally used for the inode _number_. So it would be
"fpath_inode()" or "file_inode()" or something.

As it is, the difference between

file->f_dentry->d_inode
fpath_inode(file)

is not really enough of a win to merit hiding that it's doing two pointer
dereferences. Now, whether the extra five characters ("path.") merit it, I
don't know. I suspect not. If the line turns long, it's often more
readable to just add a local variable or two, and do

struct dentry *dentry = file->f_[path.]dentry;
struct inode *inode = dentry->d_inode;

which in some situations allow for other readability improvements too (eg
maybe "dentry" or "inode" is used multiple times).

If this was something where we'd expect things to change in the future,
maybe it would be worth it for _that_ reason. That doesn't sound very
likely, though - these things have been fairly stable, and even this patch
is really about syntactic cleanup than any real change.

Adding these kinds of "abstraction layers" is something that people are
taught is good, but I personally tend to think that it makes it less
obvious at the code level what the "costs" are. Unless you know things
intimately, you really have no way of judging whether "fpath_inode()" is
something expensive or not.

I dunno.

Linus

2006-10-23 11:47:54

by Martin Waitz

[permalink] [raw]
Subject: Re: [PATCH 01 of 23] VFS: change struct file to use struct path

hoi :)

On Sat, Oct 21, 2006 at 03:28:07AM -0400, Josef Sipek wrote:
> > why?
>
> It's little cleaner than having two pointers. In general, there is a number
> of users of dentry-vfsmount pairs in the kernel, and struct path nicely
> wraps it.

Sure, but you can split the patch up:

First, change struct file and introduce the #defines so that everything
still works as before.
If this is accepted upstream, you can start to move other kernel
code to use the new names.
If all active trees have finally moved to only use the new name,
then you can remove the #define.

--
Martin Waitz


Attachments:
(No filename) (588.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2006-10-24 09:03:40

by Josef Sipek

[permalink] [raw]
Subject: Re: [PATCH 01 of 23] VFS: change struct file to use struct path

On Mon, Oct 23, 2006 at 01:47:36PM +0200, Martin Waitz wrote:
> hoi :)
>
> On Sat, Oct 21, 2006 at 03:28:07AM -0400, Josef Sipek wrote:
> > > why?
> >
> > It's little cleaner than having two pointers. In general, there is a number
> > of users of dentry-vfsmount pairs in the kernel, and struct path nicely
> > wraps it.
>
> Sure, but you can split the patch up:
>
> First, change struct file and introduce the #defines so that everything
> still works as before.

That's what 01 does (along with fs/*.[ch] changes).

Josef "Jeff" Sipek.

--
Mankind invented the atomic bomb, but no mouse would ever construct a
mousetrap.
- Albert Einstein