Message ID | 20161017081423.GH31239@veci.piliscsaba.szeredi.hu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Oct 17, 2016, at 2:14 AM, Miklos Szeredi <miklos@szeredi.hu> wrote: > > Instead use d_fsdata which is the same size. Hoping to get rid of d_time, > which is used by very few filesystems by this time. > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > --- > fs/orangefs/dcache.c | 5 +++-- > fs/orangefs/namei.c | 8 ++++---- > fs/orangefs/orangefs-kernel.h | 7 +++++++ > 3 files changed, 14 insertions(+), 6 deletions(-) > > --- a/fs/orangefs/dcache.c > +++ b/fs/orangefs/dcache.c > @@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(st > } > } > > - 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(st > static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) > { > int ret; > + unsigned long time = (unsigned long) dentry->d_fsdata; Not my filesystem, but IMHO it would make sense to have a symmetrical API for this, so having an orangefs_get_timeout(dentry) helper would isolate the ugly details here and may also be useful for other code in the future. Cheers, Andreas > - if (time_before(jiffies, dentry->d_time)) > + if (time_before(jiffies, time)) > return 1; > > if (flags & LOOKUP_RCU) > --- a/fs/orangefs/namei.c > +++ b/fs/orangefs/namei.c > @@ -72,7 +72,7 @@ static int orangefs_create(struct inode > > 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(st > 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 > > 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 * > > 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, > --- a/fs/orangefs/orangefs-kernel.h > +++ b/fs/orangefs/orangefs-kernel.h > @@ -580,4 +580,11 @@ static inline void orangefs_i_size_write > #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 */ > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Cheers, Andreas
On Mon, 17 Oct 2016, Miklos Szeredi wrote: > Instead use d_fsdata which is the same size. Hoping to get rid of d_time, > which is used by very few filesystems by this time. > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> This looks good to me. Reviewed-by: Martin Brandenburg <martin@omnibond.com> > --- > fs/orangefs/dcache.c | 5 +++-- > fs/orangefs/namei.c | 8 ++++---- > fs/orangefs/orangefs-kernel.h | 7 +++++++ > 3 files changed, 14 insertions(+), 6 deletions(-) > > --- a/fs/orangefs/dcache.c > +++ b/fs/orangefs/dcache.c > @@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(st > } > } > > - 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(st > 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) > --- a/fs/orangefs/namei.c > +++ b/fs/orangefs/namei.c > @@ -72,7 +72,7 @@ static int orangefs_create(struct inode > > 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(st > 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 > > 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 * > > 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, > --- a/fs/orangefs/orangefs-kernel.h > +++ b/fs/orangefs/orangefs-kernel.h > @@ -580,4 +580,11 @@ static inline void orangefs_i_size_write > #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 */ > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c @@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(st } } - 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(st 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) --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -72,7 +72,7 @@ static int orangefs_create(struct inode 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(st 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 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 * 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, --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h @@ -580,4 +580,11 @@ static inline void orangefs_i_size_write #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 */
Instead use d_fsdata which is the same size. Hoping to get rid of d_time, which is used by very few filesystems by this time. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> --- fs/orangefs/dcache.c | 5 +++-- fs/orangefs/namei.c | 8 ++++---- fs/orangefs/orangefs-kernel.h | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html