Whamcloud - gitweb
LU-1445 fid: start ptlrpc service for OST FID
authorwangdi <di.wang@whamcloud.com>
Tue, 24 Sep 2013 19:32:05 +0000 (12:32 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 17 Jan 2013 01:54:47 +0000 (20:54 -0500)
Start FID service on OST for FID on OST.

Change-Id: I58b36e052a2f09fc6707107f805176dcdca7e86a
Signed-off-by: Wang Di <di.wang@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/4328
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
lustre/fid/fid_handler.c
lustre/include/lustre_fid.h
lustre/include/obd.h
lustre/ost/ost_handler.c

index ecb630f..295c685 100644 (file)
@@ -431,7 +431,7 @@ static void seq_thread_info_fini(struct seq_thread_info *info)
         req_capsule_fini(info->sti_pill);
 }
 
-static int seq_handle(struct ptlrpc_request *req)
+int seq_handle(struct ptlrpc_request *req)
 {
         const struct lu_env *env;
         struct seq_thread_info *info;
@@ -452,6 +452,7 @@ static int seq_handle(struct ptlrpc_request *req)
 
         return rc;
 }
+EXPORT_SYMBOL(seq_handle);
 
 /*
  * Entry point for handling FLD RPCs called from MDT.
index 99d38da..08bf3de 100644 (file)
@@ -388,6 +388,7 @@ struct lu_server_seq {
 };
 
 int seq_query(struct com_thread_info *info);
+int seq_handle(struct ptlrpc_request *req);
 
 /* Server methods */
 int seq_server_init(struct lu_server_seq *seq,
index ae3043c..7941a83 100644 (file)
@@ -576,6 +576,7 @@ struct ost_obd {
        struct ptlrpc_service   *ost_service;
        struct ptlrpc_service   *ost_create_service;
        struct ptlrpc_service   *ost_io_service;
+       struct ptlrpc_service   *ost_seq_service;
        struct mutex            ost_health_mutex;
 };
 
index df2710d..d8fcccb 100644 (file)
@@ -52,6 +52,7 @@
 #include <lprocfs_status.h>
 #include <libcfs/list.h>
 #include "ost_internal.h"
+#include <lustre_fid.h>
 
 static int oss_num_threads;
 CFS_MODULE_PARM(oss_num_threads, "i", int, 0444,
@@ -1663,6 +1664,15 @@ int ost_msg_check_version(struct lustre_msg *msg)
                                lustre_msg_get_version(msg),
                                LUSTRE_OBD_VERSION);
                 break;
+       case SEQ_QUERY:
+               /* Note: client always use MDS_VERSION for FID request */
+               rc = lustre_msg_check_version(msg, LUSTRE_MDS_VERSION);
+               if (rc)
+                       CERROR("bad opc %u version %08x, expecting %08x\n",
+                              lustre_msg_get_opc(msg),
+                              lustre_msg_get_version(msg),
+                              LUSTRE_MDS_VERSION);
+               break;
         case OST_CREATE:
         case OST_DESTROY:
         case OST_GETATTR:
@@ -2299,6 +2309,10 @@ int ost_handle(struct ptlrpc_request *req)
                 req_capsule_set(&req->rq_pill, &RQF_OST_GET_INFO_GENERIC);
                 rc = ost_get_info(req->rq_export, req);
                 break;
+       case SEQ_QUERY:
+               CDEBUG(D_INODE, "seq\n");
+               rc = seq_handle(req);
+               break;
         case OST_QUOTACHECK:
                 CDEBUG(D_INODE, "quotacheck\n");
                 req_capsule_set(&req->rq_pill, &RQF_OST_QUOTACHECK);
@@ -2605,10 +2619,53 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                GOTO(out_create, rc);
         }
 
+       memset(&svc_conf, 0, sizeof(svc_conf));
+       svc_conf = (typeof(svc_conf)) {
+               .psc_name               = "ost_seq",
+               .psc_watchdog_factor    = OSS_SERVICE_WATCHDOG_FACTOR,
+               .psc_buf                = {
+                       .bc_nbufs               = OST_NBUFS,
+                       .bc_buf_size            = OST_BUFSIZE,
+                       .bc_req_max_size        = OST_MAXREQSIZE,
+                       .bc_rep_max_size        = OST_MAXREPSIZE,
+                       .bc_req_portal          = SEQ_DATA_PORTAL,
+                       .bc_rep_portal          = OSC_REPLY_PORTAL,
+               },
+               .psc_thr                = {
+                       .tc_thr_name            = "ll_ost_seq",
+                       .tc_thr_factor          = OSS_CR_THR_FACTOR,
+                       .tc_nthrs_init          = OSS_CR_NTHRS_INIT,
+                       .tc_nthrs_base          = OSS_CR_NTHRS_BASE,
+                       .tc_nthrs_max           = OSS_CR_NTHRS_MAX,
+                       .tc_nthrs_user          = oss_num_create_threads,
+                       .tc_cpu_affinity        = 1,
+                       .tc_ctx_tags            = LCT_DT_THREAD,
+               },
+
+               .psc_cpt                = {
+                       .cc_pattern          = oss_cpts,
+               },
+               .psc_ops                = {
+                       .so_req_handler         = ost_handle,
+                       .so_req_printer         = target_print_req,
+                       .so_hpreq_handler       = NULL,
+               },
+       };
+       ost->ost_seq_service = ptlrpc_register_service(&svc_conf,
+                                                     obd->obd_proc_entry);
+       if (IS_ERR(ost->ost_seq_service)) {
+               rc = PTR_ERR(ost->ost_seq_service);
+               CERROR("failed to start OST seq service: %d\n", rc);
+               ost->ost_seq_service = NULL;
+               GOTO(out_io, rc);
+       }
+
         ping_evictor_start();
 
         RETURN(0);
-
+out_io:
+       ptlrpc_unregister_service(ost->ost_io_service);
+       ost->ost_io_service = NULL;
 out_create:
         ptlrpc_unregister_service(ost->ost_create_service);
         ost->ost_create_service = NULL;
@@ -2622,22 +2679,24 @@ out_lprocfs:
 
 static int ost_cleanup(struct obd_device *obd)
 {
-        struct ost_obd *ost = &obd->u.ost;
-        int err = 0;
-        ENTRY;
+       struct ost_obd *ost = &obd->u.ost;
+       int err = 0;
+       ENTRY;
 
-        ping_evictor_stop();
+       ping_evictor_stop();
 
-        /* there is no recovery for OST OBD, all recovery is controlled by
-         * obdfilter OBD */
-        LASSERT(obd->obd_recovering == 0);
+       /* there is no recovery for OST OBD, all recovery is controlled by
+        * obdfilter OBD */
+       LASSERT(obd->obd_recovering == 0);
        mutex_lock(&ost->ost_health_mutex);
-        ptlrpc_unregister_service(ost->ost_service);
-        ptlrpc_unregister_service(ost->ost_create_service);
-        ptlrpc_unregister_service(ost->ost_io_service);
-        ost->ost_service = NULL;
-        ost->ost_create_service = NULL;
+       ptlrpc_unregister_service(ost->ost_service);
+       ptlrpc_unregister_service(ost->ost_create_service);
+       ptlrpc_unregister_service(ost->ost_io_service);
+       ptlrpc_unregister_service(ost->ost_seq_service);
+       ost->ost_service = NULL;
+       ost->ost_create_service = NULL;
        ost->ost_io_service = NULL;
+       ost->ost_seq_service = NULL;
 
        mutex_unlock(&ost->ost_health_mutex);