Whamcloud - gitweb
LU-2219 ptlrpc: so_hpreq_handler is set twice for the ost_io svc
authorNikitas Angelinas <nikitas_angelinas@xyratex.com>
Thu, 25 Oct 2012 09:04:20 +0000 (10:04 +0100)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2012 05:09:48 +0000 (01:09 -0400)
ptlrpc_service_conf.psc_ops.so_hpreq_handler is set twice for
the ost_io service in ost_setup(); the second assignment
overwrites the first to NULL, so ost_io threads would never
handle RPCs as high-priority ones.

While we are at it, remove some superfluous assignments of
so_hpreq_handler to NULL for statically allocated
ptlrpc_service_conf structs when initializing other ptlrpc
services, and rename some relevant functions.

Signed-off-by: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
Change-Id: Ia728a3d7f20511fcb58b259126b05055d5860455
Xyratex-bug-id: MRP-724
Reviewed-on: http://review.whamcloud.com/4368
Tested-by: Hudson
Reviewed-by: Liang Zhen <liang@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_handler.c
lustre/ost/ost_handler.c
lustre/ptlrpc/service.c

index e1b23e3..f752015 100644 (file)
@@ -4396,7 +4396,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_readpage_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        m->mdt_readpage_service = ptlrpc_register_service(&conf, procfs_entry);
@@ -4443,7 +4442,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_regular_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        m->mdt_setattr_service = ptlrpc_register_service(&conf, procfs_entry);
@@ -4479,7 +4477,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_mdsc_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        m->mdt_mdsc_service = ptlrpc_register_service(&conf, procfs_entry);
@@ -4515,7 +4512,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_mdss_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
         };
        m->mdt_mdss_service = ptlrpc_register_service(&conf, procfs_entry);
@@ -4553,7 +4549,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_dtss_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
         };
        m->mdt_dtss_service = ptlrpc_register_service(&conf, procfs_entry);
@@ -4587,7 +4582,6 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m)
                .psc_ops                = {
                        .so_req_handler         = mdt_fld_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        m->mdt_fld_service = ptlrpc_register_service(&conf, procfs_entry);
index b32b988..4be096a 100644 (file)
@@ -665,7 +665,7 @@ static struct ost_thread_local_cache *ost_tls_get(struct ptlrpc_request *r)
 
         /* In normal mode of operation an I/O request is serviced only
          * by ll_ost_io threads each of them has own tls buffers allocated by
-         * ost_thread_init().
+         * ost_io_thread_init().
          * During recovery, an I/O request may be queued until any of the ost
          * service threads process it. Not necessary it should be one of
          * ll_ost_io threads. In that case we dynamically allocating tls
@@ -2001,7 +2001,7 @@ struct ptlrpc_hpreq_ops ost_hpreq_punch = {
 };
 
 /** Assign high priority operations to the request if needed. */
-static int ost_hpreq_handler(struct ptlrpc_request *req)
+static int ost_io_hpreq_handler(struct ptlrpc_request *req)
 {
         ENTRY;
         if (req->rq_export) {
@@ -2386,10 +2386,11 @@ out:
         return 0;
 }
 EXPORT_SYMBOL(ost_handle);
+
 /*
- * free per-thread pool created by ost_thread_init().
+ * free per-thread pool created by ost_io_thread_init().
  */
-static void ost_thread_done(struct ptlrpc_thread *thread)
+static void ost_io_thread_done(struct ptlrpc_thread *thread)
 {
         struct ost_thread_local_cache *tls; /* TLS stands for Thread-Local
                                              * Storage */
@@ -2400,7 +2401,7 @@ static void ost_thread_done(struct ptlrpc_thread *thread)
 
         /*
          * be prepared to handle partially-initialized pools (because this is
-         * called from ost_thread_init() for cleanup.
+         * called from ost_io_thread_init() for cleanup.
          */
         tls = thread->t_data;
         if (tls != NULL) {
@@ -2413,7 +2414,7 @@ static void ost_thread_done(struct ptlrpc_thread *thread)
 /*
  * initialize per-thread page pool (bug 5137).
  */
-static int ost_thread_init(struct ptlrpc_thread *thread)
+static int ost_io_thread_init(struct ptlrpc_thread *thread)
 {
         struct ost_thread_local_cache *tls;
 
@@ -2518,7 +2519,6 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                .psc_ops                = {
                        .so_req_handler         = ost_handle,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        ost->ost_create_service = ptlrpc_register_service(&svc_conf,
@@ -2582,12 +2582,11 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                                                  oss_io_cpts : NULL,
                },
                .psc_ops                = {
-                       .so_thr_init            = ost_thread_init,
-                       .so_thr_done            = ost_thread_done,
+                       .so_thr_init            = ost_io_thread_init,
+                       .so_thr_done            = ost_io_thread_done,
                        .so_req_handler         = ost_handle,
-                       .so_hpreq_handler       = ost_hpreq_handler,
+                       .so_hpreq_handler       = ost_io_hpreq_handler,
                        .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
                },
        };
        ost->ost_io_service = ptlrpc_register_service(&svc_conf,
index 0746e71..168cd4b 100644 (file)
@@ -64,7 +64,7 @@ CFS_MODULE_PARM(at_extra, "i", int, 0644,
 
 /* forward ref */
 static int ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt);
-static void ptlrpc_hpreq_fini(struct ptlrpc_request *req);
+static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req);
 static void ptlrpc_at_remove_timed(struct ptlrpc_request *req);
 
 static CFS_LIST_HEAD(ptlrpc_all_services);
@@ -964,7 +964,7 @@ void ptlrpc_server_drop_request(struct ptlrpc_request *req)
 static void ptlrpc_server_finish_request(struct ptlrpc_service_part *svcpt,
                                         struct ptlrpc_request *req)
 {
-       ptlrpc_hpreq_fini(req);
+       ptlrpc_server_hpreq_fini(req);
 
        cfs_spin_lock(&svcpt->scp_req_lock);
        svcpt->scp_nreqs_active--;
@@ -1447,8 +1447,8 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
  * Put the request to the export list if the request may become
  * a high priority one.
  */
-static int ptlrpc_hpreq_init(struct ptlrpc_service *svc,
-                             struct ptlrpc_request *req)
+static int ptlrpc_server_hpreq_init(struct ptlrpc_service *svc,
+                                   struct ptlrpc_request *req)
 {
         int rc = 0;
         ENTRY;
@@ -1475,7 +1475,7 @@ static int ptlrpc_hpreq_init(struct ptlrpc_service *svc,
 }
 
 /** Remove the request from the export list. */
-static void ptlrpc_hpreq_fini(struct ptlrpc_request *req)
+static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req)
 {
         ENTRY;
         if (req->rq_export && req->rq_ops) {
@@ -1497,9 +1497,7 @@ static int ptlrpc_hpreq_check(struct ptlrpc_request *req)
 }
 
 static struct ptlrpc_hpreq_ops ptlrpc_hpreq_common = {
-       .hpreq_lock_match  = NULL,
        .hpreq_check       = ptlrpc_hpreq_check,
-       .hpreq_fini        = NULL,
 };
 
 /* Hi-Priority RPC check by RPC operation code. */
@@ -1566,21 +1564,17 @@ void ptlrpc_hpreq_reorder(struct ptlrpc_request *req)
 }
 EXPORT_SYMBOL(ptlrpc_hpreq_reorder);
 
-/** Check if the request is a high priority one. */
-static int ptlrpc_server_hpreq_check(struct ptlrpc_service *svc,
-                                     struct ptlrpc_request *req)
-{
-       return ptlrpc_hpreq_init(svc, req);
-}
-
-/** Check if a request is a high priority one. */
+/**
+ * Add a request to the regular or HP queue; optionally perform HP request
+ * initialization.
+ */
 static int ptlrpc_server_request_add(struct ptlrpc_service_part *svcpt,
                                     struct ptlrpc_request *req)
 {
        int     rc;
        ENTRY;
 
-       rc = ptlrpc_server_hpreq_check(svcpt->scp_service, req);
+       rc = ptlrpc_server_hpreq_init(svcpt->scp_service, req);
        if (rc < 0)
                RETURN(rc);
 
@@ -1833,7 +1827,7 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt)
         /* Move it over to the request processing queue */
        rc = ptlrpc_server_request_add(svcpt, req);
        if (rc) {
-               ptlrpc_hpreq_fini(req);
+               ptlrpc_server_hpreq_fini(req);
                GOTO(err_req, rc);
        }
        cfs_waitq_signal(&svcpt->scp_waitq);
@@ -3047,7 +3041,7 @@ ptlrpc_service_purge_all(struct ptlrpc_service *svc)
                        req = ptlrpc_server_request_get(svcpt, 1);
                        cfs_list_del(&req->rq_list);
                        svcpt->scp_nreqs_active++;
-                       ptlrpc_hpreq_fini(req);
+                       ptlrpc_server_hpreq_fini(req);
 
                        if (req->rq_export != NULL)
                                class_export_rpc_put(req->rq_export);