orangefs: a couple of cleanups sent in by other developers
use d_fsdata instead of d_time Miklos Szeredi <mszeredi@redhat.com> use file_inode(file) instead of file->f_path.dentry->d_inode Amir Goldstein <amir73il@gmail.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJYD65MAAoJEM9EDqnrzg2+kaUP/0HPDYJyWSgbGVSKuNqOiyml VbAGRbDAcpyYCFww2cRO9Xvvh6bJmGEqZUUbNxgi3q5L2KnvvoQ0jkHFfHaVii53 uWP0WGrxBcRNxv72jfo1cBxYTcTqEfzXZBQb6HhzfbjMCvejbhSbYDowElTE7Oar AwcgEdv0Utm7zD/0K+OW56Q4fUYzOSFI4c/tNGUyjQCLE+N3R2roXdivz3maEfee uDg262lfQgkzbEYGJOdt8MpUak6YEp2bFa+Xf8bRoKMze8KbVDLwuTlYXuSdc/i8 e8QO/Zr+irX/jJ/Sc998FwGquUljPuxz4wHSNEVO3HqYFIe30zkUD0mqQcxqx6YD F4DhSn8Ok5PuKv5aw1Q7AMA0Zd+bKaJzb/E0JdlHn1n9PFMiod82rdTfmGxP1rZb BwuOW/dsp/RLBZhCYpkNTBiNAH+TSIp8M7eOavO68AZ2zJXN69e/Qv2iJsaAZJZ0 of+i9I4kmXUS4F6OPjgT6xJbH4aD/X4/jei4dPKDATXM0MW+GsZ7VodAYmAqGGCO l66UoL4o11BCMJNGfsdPxWJkUgpn4OBb+RSkS0f6qQ7Nlp1OaYeRYKNbX5ICHcgj A0PHXZ8Pub3iVgX5xUrQmYk3txbLt0ISDYBXzfPZ0rreztN0o5FRB4TNVLC82VwJ XHBdehhgLsNc1PMKSzZo =b9Ly -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
e3300ffef0
@ -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;
|
ret = 1;
|
||||||
out_release_op:
|
out_release_op:
|
||||||
op_release(new_op);
|
op_release(new_op);
|
||||||
@ -94,8 +94,9 @@ out_drop:
|
|||||||
static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
|
static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
unsigned long time = (unsigned long) dentry->d_fsdata;
|
||||||
|
|
||||||
if (time_before(jiffies, dentry->d_time))
|
if (time_before(jiffies, time))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (flags & LOOKUP_RCU)
|
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
|
* readahead cache (if any); this forces an expensive refresh of
|
||||||
* data for the next caller of mmap (or 'get_block' accesses)
|
* data for the next caller of mmap (or 'get_block' accesses)
|
||||||
*/
|
*/
|
||||||
if (file->f_path.dentry->d_inode &&
|
if (file_inode(file) &&
|
||||||
file->f_path.dentry->d_inode->i_mapping &&
|
file_inode(file)->i_mapping &&
|
||||||
mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
|
mapping_nrpages(&file_inode(file)->i_data)) {
|
||||||
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
|
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
|
||||||
gossip_debug(GOSSIP_INODE_DEBUG,
|
gossip_debug(GOSSIP_INODE_DEBUG,
|
||||||
"calling flush_racache on %pU\n",
|
"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,
|
gossip_debug(GOSSIP_INODE_DEBUG,
|
||||||
"flush_racache finished\n");
|
"flush_racache finished\n");
|
||||||
}
|
}
|
||||||
truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
|
truncate_inode_pages(file_inode(file)->i_mapping,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -648,7 +648,7 @@ static int orangefs_fsync(struct file *file,
|
|||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
struct orangefs_inode_s *orangefs_inode =
|
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;
|
struct orangefs_kernel_op_s *new_op = NULL;
|
||||||
|
|
||||||
/* required call */
|
/* required call */
|
||||||
@ -661,7 +661,7 @@ static int orangefs_fsync(struct file *file,
|
|||||||
|
|
||||||
ret = service_operation(new_op,
|
ret = service_operation(new_op,
|
||||||
"orangefs_fsync",
|
"orangefs_fsync",
|
||||||
get_interruptible_flag(file->f_path.dentry->d_inode));
|
get_interruptible_flag(file_inode(file)));
|
||||||
|
|
||||||
gossip_debug(GOSSIP_FILE_DEBUG,
|
gossip_debug(GOSSIP_FILE_DEBUG,
|
||||||
"orangefs_fsync got return value of %d\n",
|
"orangefs_fsync got return value of %d\n",
|
||||||
@ -669,7 +669,7 @@ static int orangefs_fsync(struct file *file,
|
|||||||
|
|
||||||
op_release(new_op);
|
op_release(new_op);
|
||||||
|
|
||||||
orangefs_flush_inode(file->f_path.dentry->d_inode);
|
orangefs_flush_inode(file_inode(file));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ static int orangefs_create(struct inode *dir,
|
|||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(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;
|
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
|
||||||
|
|
||||||
gossip_debug(GOSSIP_NAME_DEBUG,
|
gossip_debug(GOSSIP_NAME_DEBUG,
|
||||||
@ -183,7 +183,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
goto out;
|
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);
|
inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
@ -322,7 +322,7 @@ static int orangefs_symlink(struct inode *dir,
|
|||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(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;
|
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
|
||||||
|
|
||||||
gossip_debug(GOSSIP_NAME_DEBUG,
|
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);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(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;
|
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
|
||||||
|
|
||||||
gossip_debug(GOSSIP_NAME_DEBUG,
|
gossip_debug(GOSSIP_NAME_DEBUG,
|
||||||
|
@ -580,4 +580,11 @@ static inline void orangefs_i_size_write(struct inode *inode, loff_t i_size)
|
|||||||
#endif
|
#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 */
|
#endif /* __ORANGEFSKERNEL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user