@@ -868,9 +868,9 @@ static inline int obd_destroy_export(struct obd_export *exp)
}
/*
- * @max_age is the oldest time in jiffies that we accept using a cached data.
+ * @max_age is the oldest time in seconds that we accept using a cached data.
* If the cache is older than @max_age we will get a new value from the
- * target. Use a value of "jiffies + HZ" to guarantee freshness.
+ * target. Use a value of 'ktime_get_seconds() + X' to guarantee freshness.
*/
static inline int obd_statfs_async(struct obd_export *exp,
struct obd_info *oinfo,
@@ -910,9 +910,9 @@ static inline int obd_statfs_async(struct obd_export *exp,
}
/*
- * @max_age is the oldest time in jiffies that we accept using a cached data.
+ * @max_age is the oldest time in seconds that we accept using a cached data.
* If the cache is older than @max_age we will get a new value from the
- * target. Use a value of "jiffies + HZ" to guarantee freshness.
+ * target. Use a value of 'ktime_get_seconds() + X' to guarantee freshness.
*/
static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
struct obd_statfs *osfs, time64_t max_age,
@@ -878,7 +878,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
int ll_setattr(struct dentry *de, struct iattr *attr);
int ll_statfs(struct dentry *de, struct kstatfs *sfs);
int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
- time64_t max_age, __u32 flags);
+ u32 flags);
int ll_update_inode(struct inode *inode, struct lustre_md *md);
void ll_update_inode_flags(struct inode *inode, int ext_flags);
int ll_read_inode2(struct inode *inode, void *opaque);
@@ -1716,11 +1716,14 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
}
int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
- time64_t max_age, u32 flags)
+ u32 flags)
{
struct obd_statfs obd_osfs;
+ time64_t max_age;
int rc;
+ max_age = ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS;
+
rc = obd_statfs(NULL, sbi->ll_md_exp, osfs, max_age, flags);
if (rc) {
CERROR("md_statfs fails: rc = %d\n", rc);
@@ -1774,9 +1777,7 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
/* Some amount of caching on the client is allowed */
- rc = ll_statfs_internal(ll_s2sbi(sb), &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- 0);
+ rc = ll_statfs_internal(ll_s2sbi(sb), &osfs, 0);
if (rc)
return rc;
@@ -140,9 +140,7 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
struct obd_statfs osfs;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -192,9 +190,7 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
u64 result;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -218,9 +214,7 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
u64 result;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -244,9 +238,7 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
u64 result;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -268,9 +260,7 @@ static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr,
struct obd_statfs osfs;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -286,9 +276,7 @@ static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr,
struct obd_statfs osfs;
int rc;
- rc = ll_statfs_internal(sbi, &osfs,
- ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
- OBD_STATFS_NODELAY);
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
if (rc)
return rc;