@@ -134,10 +134,10 @@ struct obd_import_conn {
struct ptlrpc_connection *oic_conn;
/** uuid of remote side */
struct obd_uuid oic_uuid;
- /**
- * Time (64 bit jiffies) of last connection attempt on this connection
+ /*
+ * Time (64 bit seconds) of last connection attempt on this connection
*/
- u64 oic_last_attempt;
+ time64_t oic_last_attempt;
};
/* state history */
@@ -251,8 +251,8 @@ struct obd_import {
struct lustre_handle imp_remote_handle;
/** When to perform next ping. time in jiffies. */
time64_t imp_next_ping;
- /** When we last successfully connected. time in 64bit jiffies */
- u64 imp_last_success_conn;
+ /** When we last successfully connected. time in 64bit seconds */
+ time64_t imp_last_success_conn;
/** List of all possible connection for import. */
struct list_head imp_conn_list;
@@ -587,7 +587,7 @@ struct obd_device {
spinlock_t obd_dev_lock; /* protect OBD bitfield above */
spinlock_t obd_osfs_lock;
struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */
- u64 obd_osfs_age;
+ time64_t obd_osfs_age;
u64 obd_last_committed;
struct mutex obd_dev_mutex;
struct lvfs_run_ctxt obd_lvfs_ctxt;
@@ -850,9 +850,9 @@ struct obd_ops {
* about this.
*/
int (*statfs)(const struct lu_env *, struct obd_export *exp,
- struct obd_statfs *osfs, u64 max_age, u32 flags);
+ struct obd_statfs *osfs, time64_t max_age, u32 flags);
int (*statfs_async)(struct obd_export *exp, struct obd_info *oinfo,
- u64 max_age, struct ptlrpc_request_set *set);
+ time64_t max_age, struct ptlrpc_request_set *set);
int (*create)(const struct lu_env *env, struct obd_export *exp,
struct obdo *oa);
int (*destroy)(const struct lu_env *env, struct obd_export *exp,
@@ -874,7 +874,7 @@ static inline int obd_destroy_export(struct obd_export *exp)
*/
static inline int obd_statfs_async(struct obd_export *exp,
struct obd_info *oinfo,
- u64 max_age,
+ time64_t max_age,
struct ptlrpc_request_set *rqset)
{
int rc = 0;
@@ -889,9 +889,9 @@ static inline int obd_statfs_async(struct obd_export *exp,
return -EOPNOTSUPP;
}
- CDEBUG(D_SUPER, "%s: osfs %p age %llu, max_age %llu\n",
+ CDEBUG(D_SUPER, "%s: osfs %p age %lld, max_age %lld\n",
obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
- if (time_before64(obd->obd_osfs_age, max_age)) {
+ if (obd->obd_osfs_age < max_age) {
rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
} else {
CDEBUG(D_SUPER,
@@ -915,7 +915,7 @@ static inline int obd_statfs_async(struct obd_export *exp,
* target. Use a value of "jiffies + HZ" to guarantee freshness.
*/
static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
- struct obd_statfs *osfs, u64 max_age,
+ struct obd_statfs *osfs, time64_t max_age,
u32 flags)
{
struct obd_device *obd = exp->exp_obd;
@@ -929,14 +929,14 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
return -EOPNOTSUPP;
}
- CDEBUG(D_SUPER, "osfs %llu, max_age %llu\n",
+ CDEBUG(D_SUPER, "osfs %lld, max_age %lld\n",
obd->obd_osfs_age, max_age);
- if (time_before64(obd->obd_osfs_age, max_age)) {
+ if (obd->obd_osfs_age < max_age) {
rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
if (rc == 0) {
spin_lock(&obd->obd_osfs_lock);
memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
- obd->obd_osfs_age = get_jiffies_64();
+ obd->obd_osfs_age = ktime_get_seconds();
spin_unlock(&obd->obd_osfs_lock);
}
} else {
@@ -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,
- u64 max_age, u32 flags);
+ time64_t max_age, __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);
@@ -288,7 +288,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
* available
*/
err = obd_statfs(NULL, sbi->ll_md_exp, osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_FOR_MDT0);
if (err)
goto out_md_fid;
@@ -1716,7 +1716,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
}
int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
- u64 max_age, u32 flags)
+ time64_t max_age, u32 flags)
{
struct obd_statfs obd_osfs;
int rc;
@@ -1775,7 +1775,7 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
/* Some amount of caching on the client is allowed */
rc = ll_statfs_internal(ll_s2sbi(sb), &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
0);
if (rc)
return rc;
@@ -141,7 +141,7 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -193,7 +193,7 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -219,7 +219,7 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -245,7 +245,7 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -269,7 +269,7 @@ static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -287,7 +287,7 @@ static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr,
int rc;
rc = ll_statfs_internal(sbi, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
OBD_STATFS_NODELAY);
if (rc)
return rc;
@@ -893,7 +893,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
return -EFAULT;
rc = obd_statfs(NULL, tgt->ltd_exp, &stat_buf,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
0);
if (rc)
return rc;
@@ -1326,7 +1326,7 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf)
}
static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
- struct obd_statfs *osfs, u64 max_age, u32 flags)
+ struct obd_statfs *osfs, time64_t max_age, u32 flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct lmv_obd *lmv = &obd->u.lmv;
@@ -915,7 +915,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg,
}
static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
- struct obd_statfs *osfs, u64 max_age, u32 flags)
+ struct obd_statfs *osfs, time64_t max_age, u32 flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct lov_obd *lov = &obd->u.lov;
@@ -1001,7 +1001,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
/* got statfs data */
rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
flags);
if (rc)
return rc;
@@ -158,7 +158,7 @@ static int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs,
spin_lock(&obd->obd_osfs_lock);
memcpy(&obd->obd_osfs, osfs, sizeof(*osfs));
- obd->obd_osfs_age = get_jiffies_64();
+ obd->obd_osfs_age = ktime_get_seconds();
spin_unlock(&obd->obd_osfs_lock);
return 0;
}
@@ -275,7 +275,7 @@ static int cb_statfs_update(void *cookie, int rc)
spin_lock(&tgtobd->obd_osfs_lock);
memcpy(&tgtobd->obd_osfs, lov_sfs, sizeof(*lov_sfs));
if ((oinfo->oi_flags & OBD_STATFS_FROM_CACHE) == 0)
- tgtobd->obd_osfs_age = get_jiffies_64();
+ tgtobd->obd_osfs_age = ktime_get_seconds();
spin_unlock(&tgtobd->obd_osfs_lock);
out_update:
@@ -1439,7 +1439,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data,
static int mdc_statfs(const struct lu_env *env,
struct obd_export *exp, struct obd_statfs *osfs,
- u64 max_age, u32 flags)
+ time64_t max_age, u32 flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct ptlrpc_request *req;
@@ -2002,7 +2002,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
}
rc = mdc_statfs(NULL, obd->obd_self_export, &stat_buf,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
0);
if (rc != 0)
goto out;
@@ -307,7 +307,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name,
/* newdev->obd_osfs_age must be set to a value in the distant
* past to guarantee a fresh statfs is fetched on mount.
*/
- newdev->obd_osfs_age = get_jiffies_64() - 1000 * HZ;
+ newdev->obd_osfs_age = ktime_get_seconds() - 1000;
/* XXX belongs in setup not attach */
init_rwsem(&newdev->obd_observer_link_sem);
@@ -351,9 +351,11 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc)
return sprintf(buf, "%u\n", osfs.os_bsize);
@@ -367,9 +369,11 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc) {
u32 blk_size = osfs.os_bsize >> 10;
u64 result = osfs.os_blocks;
@@ -388,9 +392,11 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc) {
u32 blk_size = osfs.os_bsize >> 10;
u64 result = osfs.os_bfree;
@@ -410,9 +416,11 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc) {
u32 blk_size = osfs.os_bsize >> 10;
u64 result = osfs.os_bavail;
@@ -432,9 +440,11 @@ static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc)
return sprintf(buf, "%llu\n", osfs.os_files);
@@ -448,9 +458,11 @@ static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct obd_statfs osfs;
- int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
- get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ,
- OBD_STATFS_NODELAY);
+ int rc;
+
+ rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ ktime_get_seconds() - OBD_STATFS_CACHE_SECONDS,
+ OBD_STATFS_NODELAY);
if (!rc)
return sprintf(buf, "%llu\n", osfs.os_ffree);
@@ -2471,7 +2471,7 @@ static int osc_statfs_interpret(const struct lu_env *env,
}
static int osc_statfs_async(struct obd_export *exp,
- struct obd_info *oinfo, u64 max_age,
+ struct obd_info *oinfo, time64_t max_age,
struct ptlrpc_request_set *rqset)
{
struct obd_device *obd = class_exp2obd(exp);
@@ -2515,7 +2515,7 @@ static int osc_statfs_async(struct obd_export *exp,
}
static int osc_statfs(const struct lu_env *env, struct obd_export *exp,
- struct obd_statfs *osfs, u64 max_age, u32 flags)
+ struct obd_statfs *osfs, time64_t max_age, u32 flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_statfs *msfs;
@@ -462,7 +462,7 @@ static int import_select_connection(struct obd_import *imp)
}
list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
- CDEBUG(D_HA, "%s: connect to NID %s last attempt %llu\n",
+ CDEBUG(D_HA, "%s: connect to NID %s last attempt %lld\n",
imp->imp_obd->obd_name,
libcfs_nid2str(conn->oic_conn->c_peer.nid),
conn->oic_last_attempt);
@@ -471,8 +471,7 @@ static int import_select_connection(struct obd_import *imp)
* the last successful attempt, go with this one
*/
if ((conn->oic_last_attempt == 0) ||
- time_before_eq64(conn->oic_last_attempt,
- imp->imp_last_success_conn)) {
+ conn->oic_last_attempt <= imp->imp_last_success_conn) {
imp_conn = conn;
tried_all = 0;
break;
@@ -484,8 +483,7 @@ static int import_select_connection(struct obd_import *imp)
*/
if (!imp_conn)
imp_conn = conn;
- else if (time_before64(conn->oic_last_attempt,
- imp_conn->oic_last_attempt))
+ else if (imp_conn->oic_last_attempt > conn->oic_last_attempt)
imp_conn = conn;
}
@@ -517,7 +515,7 @@ static int import_select_connection(struct obd_import *imp)
imp->imp_obd->obd_name, at_get(at));
}
- imp_conn->oic_last_attempt = get_jiffies_64();
+ imp_conn->oic_last_attempt = ktime_get_seconds();
/* switch connection, don't mind if it's same as the current one */
ptlrpc_connection_put(imp->imp_connection);