Commit e3300ffe authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-4.9-rc2-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux

Pull oreangefs updates from Mike Marshall:
 "A couple of orangefs cleanups sent in by other developers:

   - use d_fsdata instead of d_time (Miklos Szeredi)

   - use file_inode(file) instead of file->f_path.dentry->d_inode (Amir
     Goldstein)"

* tag 'for-linus-4.9-rc2-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  orangefs: don't use d_time
  orangefs: user file_inode() where it is due
parents e890038e 804b1737
......@@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
}
}
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
orangefs_set_timeout(dentry);
ret = 1;
out_release_op:
op_release(new_op);
......@@ -94,8 +94,9 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
{
int ret;
unsigned long time = (unsigned long) dentry->d_fsdata;
if (time_before(jiffies, dentry->d_time))
if (time_before(jiffies, time))
return 1;
if (flags & LOOKUP_RCU)
......
......@@ -621,9 +621,9 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
* readahead cache (if any); this forces an expensive refresh of
* data for the next caller of mmap (or 'get_block' accesses)
*/
if (file->f_path.dentry->d_inode &&
file->f_path.dentry->d_inode->i_mapping &&
mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
if (file_inode(file) &&
file_inode(file)->i_mapping &&
mapping_nrpages(&file_inode(file)->i_data)) {
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
gossip_debug(GOSSIP_INODE_DEBUG,
"calling flush_racache on %pU\n",
......@@ -632,7 +632,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
gossip_debug(GOSSIP_INODE_DEBUG,
"flush_racache finished\n");
}
truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
truncate_inode_pages(file_inode(file)->i_mapping,
0);
}
return 0;
......@@ -648,7 +648,7 @@ static int orangefs_fsync(struct file *file,
{
int ret = -EINVAL;
struct orangefs_inode_s *orangefs_inode =
ORANGEFS_I(file->f_path.dentry->d_inode);
ORANGEFS_I(file_inode(file));
struct orangefs_kernel_op_s *new_op = NULL;
/* required call */
......@@ -661,7 +661,7 @@ static int orangefs_fsync(struct file *file,
ret = service_operation(new_op,
"orangefs_fsync",
get_interruptible_flag(file->f_path.dentry->d_inode));
get_interruptible_flag(file_inode(file)));
gossip_debug(GOSSIP_FILE_DEBUG,
"orangefs_fsync got return value of %d\n",
......@@ -669,7 +669,7 @@ static int orangefs_fsync(struct file *file,
op_release(new_op);
orangefs_flush_inode(file->f_path.dentry->d_inode);
orangefs_flush_inode(file_inode(file));
return ret;
}
......
......@@ -72,7 +72,7 @@ static int orangefs_create(struct inode *dir,
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
orangefs_set_timeout(dentry);
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......@@ -183,7 +183,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
goto out;
}
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
orangefs_set_timeout(dentry);
inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
if (IS_ERR(inode)) {
......@@ -322,7 +322,7 @@ static int orangefs_symlink(struct inode *dir,
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
orangefs_set_timeout(dentry);
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......@@ -386,7 +386,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
orangefs_set_timeout(dentry);
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......
......@@ -580,4 +580,11 @@ static inline void orangefs_i_size_write(struct inode *inode, loff_t i_size)
#endif
}
static inline void orangefs_set_timeout(struct dentry *dentry)
{
unsigned long time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
dentry->d_fsdata = (void *) time;
}
#endif /* __ORANGEFSKERNEL_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment