Whamcloud - gitweb
Obsolete CURRENT_SECONDS and use cfs_time_current_sec() instead.
authorshadow <shadow>
Fri, 9 May 2008 12:22:47 +0000 (12:22 +0000)
committershadow <shadow>
Fri, 9 May 2008 12:22:47 +0000 (12:22 +0000)
b=14929
i=zam

19 files changed:
lustre/ChangeLog
lustre/include/darwin/lustre_compat.h
lustre/include/liblustre.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_request.c
lustre/llite/llite_lib.c
lustre/lvfs/fsfilt_ext3.c
lustre/mdd/mdd_object.c
lustre/mds/mds_fs.c
lustre/mds/mds_reint.c
lustre/obdclass/genops.c
lustre/obdclass/llog.c
lustre/obdclass/lprocfs_status.c
lustre/osc/osc_request.c
lustre/osd/osd_handler.c
lustre/ptlrpc/client.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/service.c

index c16f5ac..600acb0 100644 (file)
@@ -13,6 +13,10 @@ tbd  Sun Microsystems, Inc.
         removed cwd "./" (refer to Bugzilla 14399).
 
 Severity   : minor
+Bugzilla   : 14929
+Description: Obsolete CURRENT_SECONDS and use cfs_time_current_sec() instead.
+
+Severity   : minor
 Bugzilla   : 14645
 Frequency  : rare, on shutdown ost
 Description: don't hit live lock with umount ost.
index d11c8d6..ec7e6c3 100644 (file)
@@ -15,7 +15,6 @@
 
 /* XXX */
 #define LOOKUP_COBD                    4096
-#define CURRENT_SECONDS                        cfs_unix_seconds()
 
 #endif
 
index c562e75..b64ae31 100644 (file)
@@ -83,9 +83,6 @@ typedef unsigned short umode_t;
 
 #endif
 
-#ifndef CURRENT_SECONDS
-# define CURRENT_SECONDS time(0)
-#endif
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) ((sizeof (a))/(sizeof ((a)[0])))
index 1dcc960..ba1b24f 100644 (file)
@@ -763,7 +763,7 @@ int target_handle_connect(struct ptlrpc_request *req)
                 if (req->rq_export == NULL && initial_conn)
                        export->exp_last_request_time =
                                max(export->exp_last_request_time,
-                                   (time_t)CURRENT_SECONDS);
+                                   (time_t)cfs_time_current_sec());
         }
 
         /* We want to handle EALREADY but *not* -EALREADY from
@@ -779,7 +779,7 @@ int target_handle_connect(struct ptlrpc_request *req)
         CWARN("%s: connection from %s@%s %st"LPU64" exp %p cur %ld last %ld\n",
                target->obd_name, cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
               target->obd_recovering ? "recovering/" : "", data->ocd_transno,
-              export, (long)CURRENT_SECONDS,
+              export, (long)cfs_time_current_sec(),
               export ? (long)export->exp_last_request_time : 0);
 
 
@@ -1102,7 +1102,7 @@ static void target_finish_recovery(struct obd_device *obd)
                               rc < 0 ? "failed" : "complete", rc);
         }
 
-        obd->obd_recovery_end = CURRENT_SECONDS;
+        obd->obd_recovery_end = cfs_time_current_sec();
         EXIT;
 }
 
@@ -1215,7 +1215,7 @@ static void reset_recovery_timer(struct obd_device *obd)
         CDEBUG(D_HA, "%s: timer will expire in %u seconds\n", obd->obd_name,
                (unsigned int)timeout_shift);
         /* Only used for lprocfs_status */
-        obd->obd_recovery_end = CURRENT_SECONDS + timeout_shift;
+        obd->obd_recovery_end = cfs_time_current_sec() + timeout_shift;
 }
 
 
@@ -1645,7 +1645,7 @@ void target_recovery_init(struct obd_device *obd, svc_handler_t handler)
               obd->obd_max_recoverable_clients, obd->obd_last_committed);
         obd->obd_next_recovery_transno = obd->obd_last_committed + 1;
         target_start_recovery_thread(obd, handler);
-        obd->obd_recovery_start = CURRENT_SECONDS;
+        obd->obd_recovery_start = cfs_time_current_sec();
         /* Only used for lprocfs_status */
         obd->obd_recovery_end = obd->obd_recovery_start + OBD_RECOVERY_TIMEOUT;
         /* bz13079: this should be set to desired value for ost but not for mds */
index 6c305f4..5d0c289 100644 (file)
@@ -64,7 +64,7 @@ int ldlm_expired_completion_wait(void *data)
                 LDLM_ERROR(lock, "lock timed out (enqueued at %lu, %lus ago); "
                            "not entering recovery in server code, just going "
                            "back to sleep", lock->l_enqueued_time.tv_sec,
-                           CURRENT_SECONDS - lock->l_enqueued_time.tv_sec);
+                           cfs_time_current_sec() - lock->l_enqueued_time.tv_sec);
                 if (cfs_time_after(cfs_time_current(), next_dump)) {
                         last_dump = next_dump;
                         next_dump = cfs_time_shift(300);
@@ -81,7 +81,7 @@ int ldlm_expired_completion_wait(void *data)
         ptlrpc_fail_import(imp, lwd->lwd_conn_cnt);
         LDLM_ERROR(lock, "lock timed out (enqueued at %lu, %lus ago), entering "
                    "recovery for %s@%s", lock->l_enqueued_time.tv_sec,
-                   CURRENT_SECONDS - lock->l_enqueued_time.tv_sec,
+                   cfs_time_current_sec() - lock->l_enqueued_time.tv_sec,
                    obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
 
         RETURN(0);
index 7b63ce3..7c6fd9d 100644 (file)
@@ -1403,7 +1403,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
         if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
                 CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n",
                        LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
-                       CURRENT_SECONDS);
+                       cfs_time_current_sec());
 
         /* NB: ATTR_SIZE will only be set after this point if the size
          * resides on the MDS, ie, this file has no objects. */
@@ -2242,7 +2242,7 @@ struct md_op_data * ll_prep_md_op_data(struct md_op_data *op_data,
         op_data->op_name = name;
         op_data->op_namelen = namelen;
         op_data->op_mode = mode;
-        op_data->op_mod_time = CURRENT_SECONDS;
+        op_data->op_mod_time = cfs_time_current_sec();
         op_data->op_fsuid = current->fsuid;
         op_data->op_fsgid = current->fsgid;
         op_data->op_cap = current->cap_effective;
index ba6f612..e65ce42 100644 (file)
@@ -1772,7 +1772,7 @@ static int commit_chkquot(struct super_block *sb, struct qchk_ctxt *qctxt,
         if (!oqc)
                 RETURN(-ENOMEM);
 
-        now = CURRENT_SECONDS;
+        now = cfs_time_current_sec();
 
         if (cdqb->dqb_bsoftlimit &&
             toqb(cdqb->dqb_curspace) >= cdqb->dqb_bsoftlimit &&
index 2cc5974..38a1ceb 100644 (file)
@@ -902,7 +902,7 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
         rc = mdd_xattr_set_txn(env, md2mdd_obj(obj), buf, name,
                                fl, handle);
         if (rc == 0) {
-                la_copy->la_ctime = CURRENT_SECONDS;
+                la_copy->la_ctime = cfs_time_current_sec();
                 la_copy->la_valid = LA_CTIME;
                 rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy,
                                                   handle, 0);
@@ -936,7 +936,7 @@ int mdd_xattr_del(const struct lu_env *env, struct md_object *obj,
                            mdd_object_capa(env, mdd_obj));
         mdd_write_unlock(env, mdd_obj);
         if (rc == 0) {
-                la_copy->la_ctime = CURRENT_SECONDS;
+                la_copy->la_ctime = cfs_time_current_sec();
                 la_copy->la_valid = LA_CTIME;
                 rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy,
                                                   handle, 0);
index 54c577e..5ecaf5a 100644 (file)
@@ -446,7 +446,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file)
                       obd->obd_max_recoverable_clients, mds->mds_last_transno);
                 obd->obd_next_recovery_transno = obd->obd_last_committed + 1;
                 obd->obd_recovering = 1;
-                obd->obd_recovery_start = CURRENT_SECONDS;
+                obd->obd_recovery_start = cfs_time_current_sec();
                 /* Only used for lprocfs_status */
                 obd->obd_recovery_end = obd->obd_recovery_start +
                         OBD_RECOVERY_TIMEOUT;
index 9ff31cb..bf8b8e5 100644 (file)
@@ -241,7 +241,7 @@ commit:
  */
 int mds_fix_attr(struct inode *inode, struct mds_update_record *rec)
 {
-        time_t now = CURRENT_SECONDS;
+        time_t now = cfs_time_current_sec();
         struct iattr *attr = &rec->ur_iattr;
         unsigned int ia_valid = attr->ia_valid;
         int error;
@@ -1330,7 +1330,7 @@ cleanup:
 
 #define INODE_CTIME_AGE (10)
 #define INODE_CTIME_OLD(inode) (LTIME_S(inode->i_ctime) +               \
-                                INODE_CTIME_AGE < CURRENT_SECONDS)
+                                INODE_CTIME_AGE < cfs_time_current_sec())
 
 int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
                                 struct ll_fid *fid,
index 4e49f34..93a11de 100644 (file)
@@ -708,7 +708,7 @@ struct obd_export *class_new_export(struct obd_device *obd,
 
         CFS_INIT_LIST_HEAD(&export->exp_handle.h_link);
         class_handle_hash(&export->exp_handle, export_handle_addref);
-        export->exp_last_request_time = CURRENT_SECONDS;
+        export->exp_last_request_time = cfs_time_current_sec();
         spin_lock_init(&export->exp_lock);
         INIT_HLIST_NODE(&export->exp_uuid_hash);
         INIT_HLIST_NODE(&export->exp_nid_hash);
index 4718009..0cc9e0e 100644 (file)
@@ -161,7 +161,7 @@ int llog_init_handle(struct llog_handle *handle, int flags,
         llh->llh_hdr.lrh_type = LLOG_HDR_MAGIC;
         llh->llh_hdr.lrh_len = llh->llh_tail.lrt_len = LLOG_CHUNK_SIZE;
         llh->llh_hdr.lrh_index = llh->llh_tail.lrt_index = 0;
-        llh->llh_timestamp = CURRENT_SECONDS;
+        llh->llh_timestamp = cfs_time_current_sec();
         if (uuid)
                 memcpy(&llh->llh_tgtuuid, uuid, sizeof(llh->llh_tgtuuid));
         llh->llh_bitmap_offset = offsetof(typeof(*llh),llh_bitmap);
index a8b4a18..9afb4dd 100644 (file)
@@ -1681,8 +1681,8 @@ int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
                 goto out;
 
         if (lprocfs_obd_snprintf(&page, size, &len, "time remaining: %lu\n",
-                                 CURRENT_SECONDS >= obd->obd_recovery_end ? 0 :
-                                 obd->obd_recovery_end - CURRENT_SECONDS) <= 0)
+                                 cfs_time_current_sec() >= obd->obd_recovery_end ? 0 :
+                                 obd->obd_recovery_end - cfs_time_current_sec()) <= 0)
                 goto out;
 
         if(lprocfs_obd_snprintf(&page, size, &len, "connected_clients: %d/%d\n",
index 2bad71a..3a8b7ab 100644 (file)
@@ -1488,7 +1488,7 @@ int osc_brw_redo_request(struct ptlrpc_request *request,
         aa->aa_resends++;
         new_req->rq_interpret_reply = request->rq_interpret_reply;
         new_req->rq_async_args = request->rq_async_args;
-        new_req->rq_sent = CURRENT_SECONDS + aa->aa_resends;
+        new_req->rq_sent = cfs_time_current_sec() + aa->aa_resends;
 
         new_aa = (struct osc_brw_async_args *)&new_req->rq_async_args;
 
index 68f2e3e..25df3a4 100644 (file)
@@ -1487,7 +1487,7 @@ static struct obd_capa *osd_capa_get(const struct lu_env *env,
         spin_unlock(&capa_lock);
 
         capa->lc_keyid = key->lk_keyid;
-        capa->lc_expiry = CURRENT_SECONDS + dev->od_capa_timeout;
+        capa->lc_expiry = cfs_time_current_sec() + dev->od_capa_timeout;
 
         rc = capa_hmac(capa->lc_hmac, capa, key->lk_key);
         if (rc) {
index f4b6a80..5124f28 100644 (file)
@@ -873,7 +873,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
         ENTRY;
 
         LASSERT(req->rq_phase == RQ_PHASE_NEW);
-        if (req->rq_sent && (req->rq_sent > CURRENT_SECONDS))
+        if (req->rq_sent && (req->rq_sent > cfs_time_current_sec()))
                 RETURN (0);
         
         req->rq_phase = RQ_PHASE_RPC;
@@ -921,7 +921,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
                         RETURN(1);
                 } else {
                         /* here begins timeout counting */
-                        req->rq_sent = CURRENT_SECONDS;
+                        req->rq_sent = cfs_time_current_sec();
                         req->rq_wait_ctx = 1;
                         RETURN(0);
                 }
@@ -1081,7 +1081,7 @@ check_ctx:
                                         }
                                         if (!req->rq_wait_ctx) {
                                                 /* begins timeout counting */
-                                                req->rq_sent = CURRENT_SECONDS;
+                                                req->rq_sent = cfs_time_current_sec();
                                                 req->rq_wait_ctx = 1;
                                         }
                                         continue;
@@ -1193,7 +1193,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req)
 
         DEBUG_REQ(D_ERROR|D_NETERROR, req, "%s (sent at %lu, %lus ago)",
                   req->rq_net_err ? "network error" : "timeout",
-                  (long)req->rq_sent, CURRENT_SECONDS - req->rq_sent);
+                  (long)req->rq_sent, cfs_time_current_sec() - req->rq_sent);
 
         if (imp != NULL && obd_debug_peer_on_timeout)
                 LNetCtl(IOC_LIBCFS_DEBUG_PEER, &imp->imp_connection->c_peer);
@@ -1247,7 +1247,7 @@ int ptlrpc_expired_set(void *data)
 {
         struct ptlrpc_request_set *set = data;
         struct list_head          *tmp;
-        time_t                     now = CURRENT_SECONDS;
+        time_t                     now = cfs_time_current_sec();
         ENTRY;
 
         LASSERT(set != NULL);
@@ -1307,7 +1307,7 @@ void ptlrpc_interrupted_set(void *data)
 int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
 {
         struct list_head      *tmp;
-        time_t                 now = CURRENT_SECONDS;
+        time_t                 now = cfs_time_current_sec();
         time_t                 deadline;
         int                    timeout = 0;
         struct ptlrpc_request *req;
index d4c8fe0..cb92a0a 100644 (file)
@@ -513,7 +513,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
 
         OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
 
-        request->rq_sent = CURRENT_SECONDS;
+        request->rq_sent = cfs_time_current_sec();
         do_gettimeofday(&request->rq_arrival_time);
         ptlrpc_pinger_sending_on_import(request->rq_import);
         rc = ptl_send_buf(&request->rq_req_md_h,
index ab5647f..819cad6 100644 (file)
@@ -433,7 +433,7 @@ static int ping_evictor_main(void *arg)
                 obd = pet_exp->exp_obd;
                 spin_unlock(&pet_lock);
 
-                expire_time = CURRENT_SECONDS - (3 * obd_timeout / 2);
+                expire_time = cfs_time_current_sec() - (3 * obd_timeout / 2);
 
                 CDEBUG(D_HA, "evicting all exports of obd %s older than %ld\n",
                        obd->obd_name, expire_time);
@@ -457,9 +457,9 @@ static int ping_evictor_main(void *arg)
                                               obd->obd_name,
                                               obd_uuid2str(&exp->exp_client_uuid),
                                               obd_export_nid2str(exp),
-                                              (long)(CURRENT_SECONDS -
+                                              (long)(cfs_time_current_sec() -
                                                      exp->exp_last_request_time),
-                                              exp, (long)CURRENT_SECONDS,
+                                              exp, (long)cfs_time_current_sec(),
                                               (long)expire_time,
                                               (long)exp->exp_last_request_time);
                                 CDEBUG(D_HA, "Last request was at %ld\n",
index 5949cc4..cca0fd0 100644 (file)
@@ -465,7 +465,7 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)
            at the exact right moment.  Eventually, all silent exports
            will make it to the top of the list. */
         exp->exp_last_request_time = max(exp->exp_last_request_time,
-                                         (time_t)CURRENT_SECONDS + extra_delay);
+                                         cfs_time_current_sec() + extra_delay);
 
         CDEBUG(D_HA, "updating export %s at %ld exp %p\n",
                exp->exp_client_uuid.uuid,
@@ -500,20 +500,20 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)
         /* Note - racing to start/reset the obd_eviction timer is safe */
         if (exp->exp_obd->obd_eviction_timer == 0) {
                 /* Check if the oldest entry is expired. */
-                if (CURRENT_SECONDS > (oldest_time +
+                if (cfs_time_current_sec() > (oldest_time +
                                        (3 * obd_timeout / 2) + extra_delay)) {
                         /* We need a second timer, in case the net was down and
                          * it just came back. Since the pinger may skip every
                          * other PING_INTERVAL (see note in ptlrpc_pinger_main),
                          * we better wait for 3. */
-                        exp->exp_obd->obd_eviction_timer = CURRENT_SECONDS +
+                        exp->exp_obd->obd_eviction_timer = cfs_time_current_sec() +
                                 3 * PING_INTERVAL;
                         CDEBUG(D_HA, "%s: Think about evicting %s from %ld\n",
                                exp->exp_obd->obd_name, obd_export_nid2str(exp),
                                oldest_time);
                 }
         } else {
-                if (CURRENT_SECONDS > (exp->exp_obd->obd_eviction_timer +
+                if (cfs_time_current_sec() > (exp->exp_obd->obd_eviction_timer +
                                        extra_delay)) {
                         /* The evictor won't evict anyone who we've heard from
                          * recently, so we don't have to check before we start