Whamcloud - gitweb
b=17167 libcfs: ensure all libcfs exported symbols to have cfs_ prefix
[fs/lustre-release.git] / lustre / ptlrpc / recover.c
index 1ca69ff..79c3d3a 100644 (file)
@@ -73,7 +73,7 @@ void ptlrpc_initiate_recovery(struct obd_import *imp)
 int ptlrpc_replay_next(struct obd_import *imp, int *inflight)
 {
         int rc = 0;
-        struct list_head *tmp, *pos;
+        cfs_list_t *tmp, *pos;
         struct ptlrpc_request *req = NULL;
         __u64 last_transno;
         ENTRY;
@@ -83,11 +83,11 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)
         /* It might have committed some after we last spoke, so make sure we
          * get rid of them now.
          */
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         imp->imp_last_transno_checked = 0;
         ptlrpc_free_committed(imp);
         last_transno = imp->imp_last_replay_transno;
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         CDEBUG(D_HA, "import %p from %s committed "LPU64" last "LPU64"\n",
                imp, obd2cli_tgt(imp->imp_obd),
@@ -108,8 +108,9 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)
          * imp_lock is being held by ptlrpc_replay, but it's not. it's
          * just a little race...
          */
-        list_for_each_safe(tmp, pos, &imp->imp_replay_list) {
-                req = list_entry(tmp, struct ptlrpc_request, rq_replay_list);
+        cfs_list_for_each_safe(tmp, pos, &imp->imp_replay_list) {
+                req = cfs_list_entry(tmp, struct ptlrpc_request,
+                                     rq_replay_list);
 
                 /* If need to resend the last sent transno (because a
                    reconnect has occurred), then stop on the matching
@@ -125,9 +126,9 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)
                 req = NULL;
         }
 
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         imp->imp_resend_replay = 0;
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         if (req != NULL) {
                 rc = ptlrpc_replay_req(req);
@@ -153,37 +154,38 @@ int ptlrpc_resend(struct obd_import *imp)
          */
         /* Well... what if lctl recover is called twice at the same time?
          */
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         if (imp->imp_state != LUSTRE_IMP_RECOVER) {
-                spin_unlock(&imp->imp_lock);
+                cfs_spin_unlock(&imp->imp_lock);
                 RETURN(-1);
         }
 
-        list_for_each_entry_safe(req, next, &imp->imp_sending_list, rq_list) {
+        cfs_list_for_each_entry_safe(req, next, &imp->imp_sending_list,
+                                     rq_list) {
                 LASSERTF((long)req > CFS_PAGE_SIZE && req != LP_POISON,
                          "req %p bad\n", req);
                 LASSERTF(req->rq_type != LI_POISON, "req %p freed\n", req);
                 if (!req->rq_no_resend)
                         ptlrpc_resend_req(req);
         }
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         RETURN(0);
 }
 
 void ptlrpc_wake_delayed(struct obd_import *imp)
 {
-        struct list_head *tmp, *pos;
+        cfs_list_t *tmp, *pos;
         struct ptlrpc_request *req;
 
-        spin_lock(&imp->imp_lock);
-        list_for_each_safe(tmp, pos, &imp->imp_delayed_list) {
-                req = list_entry(tmp, struct ptlrpc_request, rq_list);
+        cfs_spin_lock(&imp->imp_lock);
+        cfs_list_for_each_safe(tmp, pos, &imp->imp_delayed_list) {
+                req = cfs_list_entry(tmp, struct ptlrpc_request, rq_list);
 
                 DEBUG_REQ(D_HA, req, "waking (set %p):", req->rq_set);
                 ptlrpc_client_wake_req(req);
         }
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 }
 
 void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
@@ -212,10 +214,10 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
 
         /* Wait for recovery to complete and resend. If evicted, then
            this request will be errored out later.*/
-        spin_lock(&failed_req->rq_lock);
+        cfs_spin_lock(&failed_req->rq_lock);
         if (!failed_req->rq_no_resend)
                 failed_req->rq_resend = 1;
-        spin_unlock(&failed_req->rq_lock);
+        cfs_spin_unlock(&failed_req->rq_lock);
 
         EXIT;
 }
@@ -243,9 +245,9 @@ int ptlrpc_set_import_active(struct obd_import *imp, int active)
 
                 /* set before invalidate to avoid messages about imp_inval
                  * set without imp_deactive in ptlrpc_import_delay_req */
-                spin_lock(&imp->imp_lock);
+                cfs_spin_lock(&imp->imp_lock);
                 imp->imp_deactive = 1;
-                spin_unlock(&imp->imp_lock);
+                cfs_spin_unlock(&imp->imp_lock);
 
                 ptlrpc_invalidate_import(imp);
         }
@@ -266,19 +268,19 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
         int rc;
         ENTRY;
 
-        spin_lock(&imp->imp_lock);
-        if (atomic_read(&imp->imp_inval_count)) {
-                spin_unlock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
+        if (cfs_atomic_read(&imp->imp_inval_count)) {
+                cfs_spin_unlock(&imp->imp_lock);
                 RETURN(-EINVAL);
         }
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         /* force import to be disconnected. */
         ptlrpc_set_import_discon(imp, 0);
 
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         imp->imp_deactive = 0;
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         rc = ptlrpc_recover_import_no_retry(imp, new_uuid);
 
@@ -288,12 +290,12 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
 int ptlrpc_import_in_recovery(struct obd_import *imp)
 {
         int in_recovery = 1;
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         if (imp->imp_state == LUSTRE_IMP_FULL ||
             imp->imp_state == LUSTRE_IMP_CLOSED ||
             imp->imp_state == LUSTRE_IMP_DISCON)
                 in_recovery = 0;
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
         return in_recovery;
 }
 
@@ -306,11 +308,11 @@ static int ptlrpc_recover_import_no_retry(struct obd_import *imp,
         ENTRY;
 
         /* Check if reconnect is already in progress */
-        spin_lock(&imp->imp_lock);
+        cfs_spin_lock(&imp->imp_lock);
         if (imp->imp_state != LUSTRE_IMP_DISCON) {
                 in_recovery = 1;
         }
-        spin_unlock(&imp->imp_lock);
+        cfs_spin_unlock(&imp->imp_lock);
 
         if (in_recovery == 1)
                 RETURN(-EALREADY);