Port the remaining time code from 32 bits to 64 bits.
Replace cfs_time_current_sec() to avoid the overflow
issues in 2038 with ktime_get_real_seconds().
Change-Id: Ia97dbfe00cd90dc6ef04583ba2eb512a8feca8c8
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/28788
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
case ARS_STARTED: {
struct hsm_progress_kernel pgs;
struct cdt_agent_req *car;
case ARS_STARTED: {
struct hsm_progress_kernel pgs;
struct cdt_agent_req *car;
- cfs_time_t now = cfs_time_current_sec();
- cfs_time_t last;
+ time64_t now = ktime_get_real_seconds();
+ time64_t last;
if (!hsd->housekeeping)
break;
if (!hsd->housekeeping)
break;
break;
if ((larr->arr_req_change + cdt->cdt_grace_delay) <
break;
if ((larr->arr_req_change + cdt->cdt_grace_delay) <
- cfs_time_current_sec()) {
+ ktime_get_real_seconds()) {
cdt_agent_record_hash_del(cdt,
larr->arr_hai.hai_cookie);
RETURN(LLOG_DEL_RECORD);
cdt_agent_record_hash_del(cdt,
larr->arr_hai.hai_cookie);
RETURN(LLOG_DEL_RECORD);
struct mdt_device *mdt = mti->mti_mdt;
struct coordinator *cdt = &mdt->mdt_coordinator;
struct hsm_scan_data hsd = { NULL };
struct mdt_device *mdt = mti->mti_mdt;
struct coordinator *cdt = &mdt->mdt_coordinator;
struct hsm_scan_data hsd = { NULL };
- time64_t wait_event_time = 1 * HZ;
time64_t last_housekeeping = 0;
int rc = 0;
int request_sz;
time64_t last_housekeeping = 0;
int rc = 0;
int request_sz;
struct hsm_record_update *updates;
/* Limit execution of the expensive requests traversal
struct hsm_record_update *updates;
/* Limit execution of the expensive requests traversal
- * to at most every "wait_event_time" jiffies. This prevents
- * repeatedly locking/unlocking the catalog for each request
- * and preventing other HSM operations from happening */
+ * to at most one second. This prevents repeatedly
+ * locking/unlocking the catalog for each request
+ * and preventing other HSM operations from happening
+ */
wait_event_interruptible_timeout(cdt->cdt_waitq,
kthread_should_stop() ||
cdt->cdt_wakeup_coordinator,
wait_event_interruptible_timeout(cdt->cdt_waitq,
kthread_should_stop() ||
cdt->cdt_wakeup_coordinator,
cdt->cdt_wakeup_coordinator = false;
CDEBUG(D_HSM, "coordinator resumes\n");
cdt->cdt_wakeup_coordinator = false;
CDEBUG(D_HSM, "coordinator resumes\n");
/* If no event, and no housekeeping to do, continue to
* wait. */
if (last_housekeeping + cdt->cdt_loop_period <=
/* If no event, and no housekeeping to do, continue to
* wait. */
if (last_housekeeping + cdt->cdt_loop_period <=
- get_seconds()) {
- last_housekeeping = get_seconds();
+ ktime_get_real_seconds()) {
+ last_housekeeping = ktime_get_real_seconds();
hsd.housekeeping = true;
} else if (cdt->cdt_event) {
hsd.housekeeping = false;
hsd.housekeeping = true;
} else if (cdt->cdt_event) {
hsd.housekeeping = false;
* when being re-started */
if (larr->arr_status == ARS_STARTED) {
larr->arr_status = ARS_WAITING;
* when being re-started */
if (larr->arr_status == ARS_STARTED) {
larr->arr_status = ARS_WAITING;
- larr->arr_req_change = cfs_time_current_sec();
+ larr->arr_req_change = ktime_get_real_seconds();
rc = llog_write(env, llh, hdr, hdr->lrh_index);
if (rc != 0)
GOTO(out, rc);
rc = llog_write(env, llh, hdr, hdr->lrh_index);
if (rc != 0)
GOTO(out, rc);
/* Initialize cdt_compound_id here to allow its usage for
* delayed requests from RAoLU policy */
/* Initialize cdt_compound_id here to allow its usage for
* delayed requests from RAoLU policy */
- atomic_set(&cdt->cdt_compound_id, cfs_time_current_sec());
+ atomic_set(&cdt->cdt_compound_id, ktime_get_real_seconds());
/* by default do not remove archives on last unlink */
cdt->cdt_remove_archive_on_last_unlink = false;
/* by default do not remove archives on last unlink */
cdt->cdt_remove_archive_on_last_unlink = false;
/* just need to be larger than previous one */
/* cdt_last_cookie is protected by cdt_llog_lock */
/* just need to be larger than previous one */
/* cdt_last_cookie is protected by cdt_llog_lock */
- cdt->cdt_last_cookie = cfs_time_current_sec();
+ cdt->cdt_last_cookie = ktime_get_real_seconds();
atomic_set(&cdt->cdt_request_count, 0);
cdt->cdt_user_request_mask = (1UL << HSMA_RESTORE);
cdt->cdt_group_request_mask = (1UL << HSMA_RESTORE);
atomic_set(&cdt->cdt_request_count, 0);
cdt->cdt_user_request_mask = (1UL << HSMA_RESTORE);
cdt->cdt_group_request_mask = (1UL << HSMA_RESTORE);
if (larr->arr_status == ARS_WAITING ||
larr->arr_status == ARS_STARTED) {
larr->arr_status = ARS_CANCELED;
if (larr->arr_status == ARS_WAITING ||
larr->arr_status == ARS_STARTED) {
larr->arr_status = ARS_CANCELED;
- larr->arr_req_change = cfs_time_current_sec();
+ larr->arr_req_change = ktime_get_real_seconds();
rc = llog_write(env, llh, hdr, hdr->lrh_index);
}
rc = llog_write(env, llh, hdr, hdr->lrh_index);
}
if (ma->ma_valid & MA_INODE &&
ma->ma_attr.la_valid & LA_CTIME &&
info->mti_mdt->mdt_namespace->ns_ctime_age_limit +
if (ma->ma_valid & MA_INODE &&
ma->ma_attr.la_valid & LA_CTIME &&
info->mti_mdt->mdt_namespace->ns_ctime_age_limit +
- ma->ma_attr.la_ctime < cfs_time_current_sec())
+ ma->ma_attr.la_ctime < ktime_get_real_seconds())
child_bits |= MDS_INODELOCK_UPDATE;
}
child_bits |= MDS_INODELOCK_UPDATE;
}
larr->arr_compound_id = compound_id;
larr->arr_archive_id = archive_id;
larr->arr_flags = flags;
larr->arr_compound_id = compound_id;
larr->arr_archive_id = archive_id;
larr->arr_flags = flags;
- larr->arr_req_create = cfs_time_current_sec();
+ larr->arr_req_create = ktime_get_real_seconds();
larr->arr_req_change = larr->arr_req_create;
memcpy(&larr->arr_hai, hai, hai->hai_len);
larr->arr_req_change = larr->arr_req_create;
memcpy(&larr->arr_hai, hai, hai->hai_len);
struct hsm_record_update *updates;
unsigned int updates_count;
unsigned int updates_done;
struct hsm_record_update *updates;
unsigned int updates_count;
unsigned int updates_done;
- cfs_time_t change_time;
ducb.updates = updates;
ducb.updates_count = updates_count;
ducb.updates_done = 0;
ducb.updates = updates;
ducb.updates_count = updates_count;
ducb.updates_done = 0;
- ducb.change_time = cfs_time_current_sec();
+ ducb.change_time = ktime_get_real_seconds();
rc = cdt_llog_process(env, mdt, mdt_agent_record_update_cb, &ducb,
start_cat_idx, start_rec_idx, WRITE);
rc = cdt_llog_process(env, mdt, mdt_agent_record_update_cb, &ducb,
start_cat_idx, start_rec_idx, WRITE);
car->car_archive_id = archive_id;
car->car_flags = flags;
car->car_canceled = 0;
car->car_archive_id = archive_id;
car->car_flags = flags;
car->car_canceled = 0;
- car->car_req_start = cfs_time_current_sec();
+ car->car_req_start = ktime_get_real_seconds();
car->car_req_update = car->car_req_start;
car->car_uuid = *uuid;
OBD_ALLOC(car->car_hai, hai->hai_len);
car->car_req_update = car->car_req_start;
car->car_uuid = *uuid;
OBD_ALLOC(car->car_hai, hai->hai_len);
if (car == NULL)
RETURN(ERR_PTR(-ENOENT));
if (car == NULL)
RETURN(ERR_PTR(-ENOENT));
- car->car_req_update = cfs_time_current_sec();
+ car->car_req_update = ktime_get_real_seconds();
/* update data move progress done by copy tool */
if (car->car_hai->hai_action != HSMA_REMOVE && pgs->hpk_errval == 0 &&
/* update data move progress done by copy tool */
if (car->car_hai->hai_action != HSMA_REMOVE && pgs->hpk_errval == 0 &&
* list */
struct mutex cdt_restore_lock; /**< protect restore
* list */
* list */
struct mutex cdt_restore_lock; /**< protect restore
* list */
- cfs_time_t cdt_loop_period; /**< llog scan period */
- cfs_time_t cdt_grace_delay; /**< request grace
+ time64_t cdt_loop_period; /**< llog scan period */
+ time64_t cdt_grace_delay; /**< request grace
- cfs_time_t cdt_active_req_timeout; /**< request timeout */
+ time64_t cdt_active_req_timeout; /**< request timeout */
__u32 cdt_default_archive_id; /**< archive id used
* when none are
* specified */
__u32 cdt_default_archive_id; /**< archive id used
* when none are
* specified */
struct obd_uuid car_uuid; /**< agent doing the req. */
__u32 car_archive_id; /**< archive id */
int car_canceled; /**< request was canceled */
struct obd_uuid car_uuid; /**< agent doing the req. */
__u32 car_archive_id; /**< archive id */
int car_canceled; /**< request was canceled */
- cfs_time_t car_req_start; /**< start time */
- cfs_time_t car_req_update; /**< last update time */
+ time64_t car_req_start; /**< start time */
+ time64_t car_req_update; /**< last update time */
struct hsm_action_item *car_hai; /**< req. to the agent */
struct cdt_req_progress car_progress; /**< track data mvt
* progress */
struct hsm_action_item *car_hai; /**< req. to the agent */
struct cdt_req_progress car_progress; /**< track data mvt
* progress */
"setxattr %s: [object "DFID"] [valid %llu]\n",
mdt_obd_name(info->mti_mdt), xattr_name,
PFID(rr->rr_fid1), valid);
"setxattr %s: [object "DFID"] [valid %llu]\n",
mdt_obd_name(info->mti_mdt), xattr_name,
PFID(rr->rr_fid1), valid);
- attr->la_ctime = cfs_time_current_sec();
+ attr->la_ctime = ktime_get_real_seconds();
}
attr->la_valid = LA_CTIME;
child = mdt_object_child(obj);
}
attr->la_valid = LA_CTIME;
child = mdt_object_child(obj);