Whamcloud - gitweb
LU-1347 ldlm: makes EXPORT_SYMBOL follows function body
[fs/lustre-release.git] / lustre / ldlm / ldlm_lib.c
index 7138b19..f0123e0 100644 (file)
@@ -131,6 +131,7 @@ int client_import_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
 {
         return import_set_conn(imp, uuid, priority, 1);
 }
+EXPORT_SYMBOL(client_import_add_conn);
 
 int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
 {
@@ -186,6 +187,7 @@ out:
                 CERROR("connection %s not found\n", uuid->uuid);
         RETURN(rc);
 }
+EXPORT_SYMBOL(client_import_del_conn);
 
 /**
  * Find conn uuid by peer nid. @peer is a server nid. This function is used
@@ -266,7 +268,9 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
 
         /* In a more perfect world, we would hang a ptlrpc_client off of
          * obd_type and just use the values from there. */
-        if (!strcmp(name, LUSTRE_OSC_NAME)) {
+       if (!strcmp(name, LUSTRE_OSC_NAME) ||
+           (!strcmp(name, LUSTRE_OSP_NAME) &&
+            !is_osp_on_ost(lustre_cfg_buf(lcfg, 0)))) {
                 rq_portal = OST_REQUEST_PORTAL;
                 rp_portal = OSC_REPLY_PORTAL;
                 connect_op = OST_CONNECT;
@@ -274,7 +278,9 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
                 cli->cl_sp_to = LUSTRE_SP_OST;
                 ns_type = LDLM_NS_TYPE_OSC;
 
-        } else if (!strcmp(name, LUSTRE_MDC_NAME)) {
+       } else if (!strcmp(name, LUSTRE_MDC_NAME) ||
+                  (!strcmp(name, LUSTRE_OSP_NAME) &&
+                   is_osp_on_ost(lustre_cfg_buf(lcfg, 0)))) {
                 rq_portal = MDS_REQUEST_PORTAL;
                 rp_portal = MDC_REPLY_PORTAL;
                 connect_op = MDS_CONNECT;
@@ -291,6 +297,14 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
                 cli->cl_flvr_mgc.sf_rpc = SPTLRPC_FLVR_INVALID;
                 ns_type = LDLM_NS_TYPE_MGC;
 
+       } else if (!strcmp(name, LUSTRE_OSP_NAME)) {
+               rq_portal = OST_REQUEST_PORTAL;
+               rp_portal = OSC_REPLY_PORTAL;
+               connect_op = OST_CONNECT;
+               cli->cl_sp_me = LUSTRE_SP_CLI;
+               cli->cl_sp_to = LUSTRE_SP_OST;
+               ns_type = LDLM_NS_TYPE_OSC;
+
         } else {
                 CERROR("unknown client OBD type \"%s\", can't setup\n",
                        name);
@@ -347,6 +361,15 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
         cfs_spin_lock_init(&cli->cl_write_page_hist.oh_lock);
         cfs_spin_lock_init(&cli->cl_read_offset_hist.oh_lock);
         cfs_spin_lock_init(&cli->cl_write_offset_hist.oh_lock);
+
+       /* lru for osc. */
+       CFS_INIT_LIST_HEAD(&cli->cl_lru_osc);
+       cfs_atomic_set(&cli->cl_lru_shrinkers, 0);
+       cfs_atomic_set(&cli->cl_lru_busy, 0);
+       cfs_atomic_set(&cli->cl_lru_in_list, 0);
+       CFS_INIT_LIST_HEAD(&cli->cl_lru_list);
+       client_obd_list_lock_init(&cli->cl_lru_list_lock);
+
         cfs_waitq_init(&cli->cl_destroy_waitq);
         cfs_atomic_set(&cli->cl_destroy_in_flight, 0);
 #ifdef ENABLE_CHECKSUM
@@ -443,6 +466,7 @@ err:
         RETURN(rc);
 
 }
+EXPORT_SYMBOL(client_obd_setup);
 
 int client_obd_cleanup(struct obd_device *obddev)
 {
@@ -456,6 +480,7 @@ int client_obd_cleanup(struct obd_device *obddev)
         ldlm_put_ref();
         RETURN(0);
 }
+EXPORT_SYMBOL(client_obd_cleanup);
 
 /* ->o_connect() method for client side (OSC and MDC and MGC) */
 int client_connect_import(const struct lu_env *env,
@@ -524,6 +549,7 @@ out_sem:
 
         return rc;
 }
+EXPORT_SYMBOL(client_connect_import);
 
 int client_disconnect_export(struct obd_export *exp)
 {
@@ -598,6 +624,7 @@ int client_disconnect_export(struct obd_export *exp)
 
         RETURN(rc);
 }
+EXPORT_SYMBOL(client_disconnect_export);
 
 #ifdef HAVE_SERVER_SUPPORT
 int server_disconnect_export(struct obd_export *exp)
@@ -635,6 +662,7 @@ int server_disconnect_export(struct obd_export *exp)
 
        RETURN(rc);
 }
+EXPORT_SYMBOL(server_disconnect_export);
 
 /* --------------------------------------------------------------------------
  * from old lib/target.c
@@ -1257,6 +1285,7 @@ out:
                 req->rq_status = rc;
         RETURN(rc);
 }
+EXPORT_SYMBOL(target_handle_connect);
 
 int target_handle_disconnect(struct ptlrpc_request *req)
 {
@@ -1272,6 +1301,7 @@ int target_handle_disconnect(struct ptlrpc_request *req)
 
         RETURN(0);
 }
+EXPORT_SYMBOL(target_handle_disconnect);
 
 void target_destroy_export(struct obd_export *exp)
 {
@@ -1292,6 +1322,7 @@ void target_destroy_export(struct obd_export *exp)
        LASSERT_ATOMIC_ZERO(&exp->exp_cb_count);
        LASSERT_ATOMIC_ZERO(&exp->exp_replay_count);
 }
+EXPORT_SYMBOL(target_destroy_export);
 
 /*
  * Recovery functions
@@ -1364,17 +1395,20 @@ static void target_exp_dequeue_req_replay(struct ptlrpc_request *req)
 #ifdef __KERNEL__
 static void target_finish_recovery(struct obd_device *obd)
 {
-        time_t elapsed_time = max_t(time_t, 1, cfs_time_current_sec() -
-                                    obd->obd_recovery_start);
         ENTRY;
 
-        LCONSOLE_INFO("%s: Recovery over after %d:%.02d, of %d clients "
-                      "%d recovered and %d %s evicted.\n", obd->obd_name,
-                      (int)elapsed_time / 60, (int)elapsed_time % 60,
-                      obd->obd_max_recoverable_clients,
-                      cfs_atomic_read(&obd->obd_connected_clients),
-                      obd->obd_stale_clients,
-                      obd->obd_stale_clients == 1 ? "was" : "were");
+       /* only log a recovery message when recovery has occurred */
+       if (obd->obd_recovery_start) {
+               time_t elapsed_time = max_t(time_t, 1, cfs_time_current_sec() -
+                                       obd->obd_recovery_start);
+               LCONSOLE_INFO("%s: Recovery over after %d:%.02d, of %d clients "
+                       "%d recovered and %d %s evicted.\n", obd->obd_name,
+                       (int)elapsed_time / 60, (int)elapsed_time % 60,
+                       obd->obd_max_recoverable_clients,
+                       cfs_atomic_read(&obd->obd_connected_clients),
+                       obd->obd_stale_clients,
+                       obd->obd_stale_clients == 1 ? "was" : "were");
+       }
 
         ldlm_reprocess_all_ns(obd->obd_namespace);
         cfs_spin_lock(&obd->obd_recovery_task_lock);
@@ -1494,6 +1528,7 @@ void target_cleanup_recovery(struct obd_device *obd)
 
         EXIT;
 }
+EXPORT_SYMBOL(target_cleanup_recovery);
 
 /* obd_recovery_task_lock should be held */
 void target_cancel_recovery_timer(struct obd_device *obd)
@@ -1501,6 +1536,7 @@ void target_cancel_recovery_timer(struct obd_device *obd)
         CDEBUG(D_HA, "%s: cancel recovery timer\n", obd->obd_name);
         cfs_timer_disarm(&obd->obd_recovery_timer);
 }
+EXPORT_SYMBOL(target_cancel_recovery_timer);
 
 static void target_start_recovery_timer(struct obd_device *obd)
 {
@@ -2112,6 +2148,7 @@ void target_stop_recovery_thread(struct obd_device *obd)
                 cfs_wait_for_completion(&trd->trd_finishing);
         }
 }
+EXPORT_SYMBOL(target_stop_recovery_thread);
 
 void target_recovery_fini(struct obd_device *obd)
 {
@@ -2325,12 +2362,14 @@ int target_queue_recovery_request(struct ptlrpc_request *req,
         cfs_waitq_signal(&obd->obd_next_transno_waitq);
         RETURN(0);
 }
+EXPORT_SYMBOL(target_queue_recovery_request);
 
 int target_handle_ping(struct ptlrpc_request *req)
 {
         obd_ping(req->rq_svc_thread->t_env, req->rq_export);
         return req_capsule_server_pack(&req->rq_pill);
 }
+EXPORT_SYMBOL(target_handle_ping);
 
 void target_committed_to_req(struct ptlrpc_request *req)
 {
@@ -2382,6 +2421,7 @@ int target_pack_pool_reply(struct ptlrpc_request *req)
 
         RETURN(0);
 }
+EXPORT_SYMBOL(target_pack_pool_reply);
 
 int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 {
@@ -2445,7 +2485,7 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
         rs->rs_xid       = req->rq_xid;
         rs->rs_transno   = req->rq_transno;
         rs->rs_export    = exp;
-        rs->rs_opc       = lustre_msg_get_opc(rs->rs_msg);
+        rs->rs_opc       = lustre_msg_get_opc(req->rq_reqmsg);
 
         cfs_spin_lock(&exp->exp_uncommitted_replies_lock);
         CDEBUG(D_NET, "rs transno = "LPU64", last committed = "LPU64"\n",
@@ -2492,6 +2532,7 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
        cfs_spin_unlock(&svcpt->scp_rep_lock);
        EXIT;
 }
+EXPORT_SYMBOL(target_send_reply);
 
 ldlm_mode_t lck_compat_array[] = {
         [LCK_EX] LCK_COMPAT_EX,