Whamcloud - gitweb
Add ability to start more than one create thread per OSS.
[fs/lustre-release.git] / lustre / ost / ost_handler.c
index 2b14646..e72d6d1 100644 (file)
@@ -59,6 +59,10 @@ static int ost_num_threads;
 CFS_MODULE_PARM(ost_num_threads, "i", int, 0444,
                 "number of OST service threads to start (deprecated)");
 
+static int oss_num_create_threads;
+CFS_MODULE_PARM(oss_num_create_threads, "i", int, 0444,
+                "number of OSS create threads to start");
+
 void oti_to_request(struct obd_trans_info *oti, struct ptlrpc_request *req)
 {
         struct oti_req_ack_lock *ack_lock;
@@ -92,6 +96,15 @@ static int ost_destroy(struct obd_export *exp, struct ptlrpc_request *req,
         if (body == NULL)
                 RETURN(-EFAULT);
 
+        if (lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1)) {
+                struct ldlm_request *dlm;
+                dlm = lustre_swab_reqbuf(req, REQ_REC_OFF + 1, sizeof(*dlm),
+                                         lustre_swab_ldlm_request);
+                if (dlm == NULL)
+                        RETURN (-EFAULT);
+                ldlm_request_cancel(req, dlm, 0);
+        }
+        
         rc = lustre_pack_reply(req, 2, size, NULL);
         if (rc)
                 RETURN(rc);
@@ -1651,7 +1664,7 @@ static void ost_thread_done(struct ptlrpc_thread *thread)
         if (tls != NULL) {
                 for (i = 0; i < OST_THREAD_POOL_SIZE; ++ i) {
                         if (tls->page[i] != NULL)
-                                __free_page(tls->page[i]);
+                                __cfs_free_page(tls->page[i]);
                 }
                 OBD_FREE_PTR(tls);
                 thread->t_data = NULL;
@@ -1682,7 +1695,7 @@ static int ost_thread_init(struct ptlrpc_thread *thread)
                  * populate pool
                  */
                 for (i = 0; i < OST_THREAD_POOL_SIZE; ++ i) {
-                        tls->page[i] = alloc_page(OST_THREAD_POOL_GFP);
+                        tls->page[i] = cfs_alloc_page(OST_THREAD_POOL_GFP);
                         if (tls->page[i] == NULL) {
                                 ost_thread_done(thread);
                                 result = -ENOMEM;
@@ -1703,6 +1716,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
         struct lprocfs_static_vars lvars;
         int oss_min_threads;
         int oss_max_threads;
+        int oss_min_create_threads;
+        int oss_max_create_threads;
         int rc;
         ENTRY;
 
@@ -1756,12 +1771,26 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
         if (rc)
                 GOTO(out_service, rc = -EINVAL);
 
+        if (oss_num_create_threads) {
+                if (oss_num_create_threads > OSS_MAX_CREATE_THREADS)
+                        oss_num_create_threads = OSS_MAX_CREATE_THREADS;
+                if (oss_num_create_threads < OSS_DEF_CREATE_THREADS)
+                        oss_num_create_threads = OSS_DEF_CREATE_THREADS;
+                oss_min_create_threads = oss_max_create_threads =
+                        oss_num_create_threads;
+        } else {
+                oss_min_create_threads = OSS_DEF_CREATE_THREADS;
+                oss_max_create_threads = OSS_MAX_CREATE_THREADS;
+        }
+
         ost->ost_create_service =
                 ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
                                 OST_MAXREPSIZE, OST_CREATE_PORTAL,
                                 OSC_REPLY_PORTAL,
                                 OST_WATCHDOG_TIMEOUT, ost_handle, "ost_create",
-                                obd->obd_proc_entry, ost_print_req, 1, 1,
+                                obd->obd_proc_entry, ost_print_req,
+                                oss_min_create_threads,
+                                oss_max_create_threads,
                                 "ll_ost_creat", LCT_DT_THREAD);
         if (ost->ost_create_service == NULL) {
                 CERROR("failed to start OST create service\n");