Whamcloud - gitweb
LU-13005 lnet: remove lib-eq. 47/36847/8
authorMr NeilBrown <neilb@suse.de>
Wed, 20 Nov 2019 02:56:44 +0000 (13:56 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Apr 2020 08:10:08 +0000 (08:10 +0000)
There is nothing of value in left in lib-eq.  An 'lnet_eq' just holds
a function pointer.
So change all 'struct lnet_eq' pointers to function pointers, and
bypass the "event queues".

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I16786e44ab712a76860fe8d83543a292555cf557
Reviewed-on: https://review.whamcloud.com/36847
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
15 files changed:
lnet/include/lnet/api.h
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/lnet/Makefile.in
lnet/lnet/api-ni.c
lnet/lnet/lib-eq.c [deleted file]
lnet/lnet/lib-md.c
lnet/lnet/lib-me.c
lnet/lnet/lib-move.c
lnet/lnet/lib-msg.c
lnet/lnet/peer.c
lnet/selftest/rpc.c
lustre/ptlrpc/events.c
lustre/ptlrpc/ptlrpc_internal.h

index 1bd0f94..02b43ce 100644 (file)
@@ -130,32 +130,6 @@ int LNetMDBind(struct lnet_md       md_in,
 int LNetMDUnlink(struct lnet_handle_md md_in);
 /** @} lnet_md */
 
-/** \defgroup lnet_eq Events and event queues
- *
- * Event queues (abbreviated as EQ) are used to log operations performed on
- * local MDs. In particular, they signal the completion of a data transmission
- * into or out of a MD. They can also be used to hold acknowledgments for
- * completed PUT operations and indicate when a MD has been unlinked. Multiple
- * MDs can share a single EQ. An EQ must have an event handler
- * associated with it. It will be run for each event that is deposited into
- * the EQ.
- *
- * In addition to the struct lnet_eq, the LNet API defines two types
- * associated with events: The ::lnet_event_kind defines the kinds of events
- * that can be stored in an EQ. The struct lnet_event defines a structure that
- * holds the information about with an event.
- *
- * There are two functions for dealing with EQs: LNetEQAlloc() is used
- * to create an EQ and allocate the resources needed, while LNetEQFree()
- * releases these resources and frees the EQ.
- * @{ */
-struct lnet_eq *
-LNetEQAlloc(lnet_eq_handler_t handler);
-
-void LNetEQFree(struct lnet_eq *eventq_in);
-
-/** @} lnet_eq */
-
 /** \defgroup lnet_data Data movement operations
  *
  * The LNet API provides two data movement operations: LNetPut()
index 7a5b47f..34c1411 100644 (file)
@@ -201,8 +201,6 @@ lnet_net_lock_current(void)
 
 #define lnet_ptl_lock(ptl)     spin_lock(&(ptl)->ptl_lock)
 #define lnet_ptl_unlock(ptl)   spin_unlock(&(ptl)->ptl_lock)
-#define lnet_eq_wait_lock()    spin_lock(&the_lnet.ln_eq_wait_lock)
-#define lnet_eq_wait_unlock()  spin_unlock(&the_lnet.ln_eq_wait_lock)
 #define lnet_ni_lock(ni)       spin_lock(&(ni)->ni_lock)
 #define lnet_ni_unlock(ni)     spin_unlock(&(ni)->ni_lock)
 
@@ -215,21 +213,6 @@ extern struct kmem_cache *lnet_small_mds_cachep; /* <= LNET_SMALL_MD_SIZE bytes
 extern struct kmem_cache *lnet_rspt_cachep;
 extern struct kmem_cache *lnet_msg_cachep;
 
-static inline struct lnet_eq *
-lnet_eq_alloc (void)
-{
-       struct lnet_eq *eq;
-
-       LIBCFS_ALLOC(eq, sizeof(*eq));
-       return (eq);
-}
-
-static inline void
-lnet_eq_free(struct lnet_eq *eq)
-{
-       LIBCFS_FREE(eq, sizeof(*eq));
-}
-
 static inline struct lnet_libmd *
 lnet_md_alloc(struct lnet_md *umd)
 {
@@ -584,13 +567,12 @@ void lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type);
 void lnet_msg_commit(struct lnet_msg *msg, int cpt);
 void lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status);
 
-void lnet_eq_enqueue_event(struct lnet_eq *eq, struct lnet_event *ev);
 void lnet_prep_send(struct lnet_msg *msg, int type,
                    struct lnet_process_id target, unsigned int offset,
                    unsigned int len);
 int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid);
 int lnet_send_ping(lnet_nid_t dest_nid, struct lnet_handle_md *mdh, int nnis,
-                  void *user_ptr, struct lnet_eq *eq, bool recovery);
+                  void *user_ptr, lnet_eq_handler_t eq, bool recovery);
 void lnet_return_tx_credits_locked(struct lnet_msg *msg);
 void lnet_return_rx_credits_locked(struct lnet_msg *msg);
 void lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp);
index 6486e83..41d7ee7 100644 (file)
@@ -182,10 +182,6 @@ struct lnet_libhandle {
 #define lh_entry(ptr, type, member) \
        ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
 
-struct lnet_eq {
-       lnet_eq_handler_t       eq_callback;
-};
-
 struct lnet_me {
        struct list_head        me_list;
        int                     me_cpt;
@@ -213,7 +209,7 @@ struct lnet_libmd {
        unsigned int             md_niov;       /* # frags at end of struct */
        void                    *md_user_ptr;
        struct lnet_rsp_tracker *md_rspt_ptr;
-       struct lnet_eq          *md_eq;
+       lnet_eq_handler_t        md_eq;
        struct lnet_handle_md    md_bulk_handle;
        union {
                struct kvec      iov[LNET_MAX_IOV];
@@ -1056,7 +1052,7 @@ struct lnet {
         * ln_api_mutex.
         */
        struct lnet_handle_md           ln_ping_target_md;
-       struct lnet_eq                  *ln_ping_target_eq;
+       lnet_eq_handler_t               ln_ping_target_eq;
        struct lnet_ping_buffer         *ln_ping_target;
        atomic_t                        ln_ping_target_seqno;
 
@@ -1068,13 +1064,13 @@ struct lnet {
         * buffer may linger a while after it has been unlinked, in
         * which case the event handler cleans up.
         */
-       struct lnet_eq                  *ln_push_target_eq;
+       lnet_eq_handler_t               ln_push_target_eq;
        struct lnet_handle_md           ln_push_target_md;
        struct lnet_ping_buffer         *ln_push_target;
        int                             ln_push_target_nnis;
 
        /* discovery event queue handle */
-       struct lnet_eq                  *ln_dc_eq;
+       lnet_eq_handler_t               ln_dc_eq;
        /* discovery requests */
        struct list_head                ln_dc_request;
        /* discovery working list */
@@ -1145,7 +1141,7 @@ struct lnet {
         */
        struct list_head                **ln_mt_zombie_rstqs;
        /* recovery eq handler */
-       struct lnet_eq                  *ln_mt_eq;
+       lnet_eq_handler_t               ln_mt_eq;
 
        /*
         * Completed when the discovery and monitor threads can enter their
index e488e7d..be0c510 100644 (file)
@@ -395,6 +395,20 @@ enum lnet_ins_pos {
  * @{ */
 
 /**
+ * Event queue handler function type.
+ *
+ * The EQ handler runs for each event that is deposited into the EQ. The
+ * handler is supplied with a pointer to the event that triggered the
+ * handler invocation.
+ *
+ * The handler must not block, must be reentrant, and must not call any LNet
+ * API functions. It should return as quickly as possible.
+ */
+struct lnet_event;
+typedef void (*lnet_eq_handler_t)(struct lnet_event *event);
+#define LNET_EQ_HANDLER_NONE NULL
+
+/**
  * Defines the visible parts of a memory descriptor. Values of this type
  * are used to initialize memory descriptors.
  */
@@ -480,11 +494,11 @@ struct lnet_md {
         */
        void            *user_ptr;
        /**
-        * A handle for the event queue used to log the operations performed on
-        * the memory region. If this argument is a NULL handle operations
+        * The event handler used to log the operations performed on
+        * the memory region. If this argument is NULL operations
         * performed on this memory descriptor are not logged.
         */
-       struct lnet_eq *eq_handle;
+       lnet_eq_handler_t eq_handle;
        /**
         * The bulk MD handle which was registered to describe the buffers
         * either to be used to transfer data to the peer or receive data
@@ -657,20 +671,6 @@ struct lnet_event {
        volatile unsigned long sequence;
 };
 
-/**
- * Event queue handler function type.
- *
- * The EQ handler runs for each event that is deposited into the EQ. The
- * handler is supplied with a pointer to the event that triggered the
- * handler invocation.
- *
- * The handler must not block, must be reentrant, and must not call any LNet
- * API functions. It should return as quickly as possible.
- */
-typedef void (*lnet_eq_handler_t)(struct lnet_event *event);
-#define LNET_EQ_HANDLER_NONE NULL
-/** @} lnet_eq */
-
 /** \addtogroup lnet_data
  * @{ */
 
index ee119ad..b55ee89 100644 (file)
@@ -1,7 +1,7 @@
 MODULES := lnet
 
 lnet-objs := api-ni.o config.o nidstrings.o
-lnet-objs += lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o
+lnet-objs += lib-me.o lib-msg.o lib-md.o lib-ptl.o
 lnet-objs += lib-socket.o lib-move.o module.o lo.o
 lnet-objs += router.o router_proc.o acceptor.o peer.o net_fault.o
 
index 110b13a..2b49505 100644 (file)
@@ -1270,10 +1270,7 @@ lnet_unprepare (void)
                the_lnet.ln_mt_zombie_rstqs = NULL;
        }
 
-       if (the_lnet.ln_mt_eq) {
-               LNetEQFree(the_lnet.ln_mt_eq);
-               the_lnet.ln_mt_eq = NULL;
-       }
+       the_lnet.ln_mt_eq = NULL;
 
        lnet_portals_destroy();
 
@@ -1696,15 +1693,9 @@ lnet_ping_target_setup(struct lnet_ping_buffer **ppbuf,
        struct lnet_md md = { NULL };
        int rc;
 
-       if (set_eq) {
+       if (set_eq)
                the_lnet.ln_ping_target_eq =
-                       LNetEQAlloc(lnet_ping_target_event_handler);
-               if (IS_ERR(the_lnet.ln_ping_target_eq)) {
-                       rc = PTR_ERR(the_lnet.ln_ping_target_eq);
-                       CERROR("Can't allocate ping buffer EQ: %d\n", rc);
-                       return rc;
-               }
-       }
+                       lnet_ping_target_event_handler;
 
        *ppbuf = lnet_ping_target_create(ni_count);
        if (*ppbuf == NULL) {
@@ -1748,9 +1739,6 @@ fail_decref_ping_buffer:
        lnet_ping_buffer_decref(*ppbuf);
        *ppbuf = NULL;
 fail_free_eq:
-       if (set_eq)
-               LNetEQFree(the_lnet.ln_ping_target_eq);
-
        return rc;
 }
 
@@ -1854,8 +1842,6 @@ lnet_ping_target_fini(void)
        lnet_ping_md_unlink(the_lnet.ln_ping_target,
                            &the_lnet.ln_ping_target_md);
 
-       LNetEQFree(the_lnet.ln_ping_target_eq);
-
        lnet_ping_target_destroy();
 }
 
@@ -1990,12 +1976,7 @@ static int lnet_push_target_init(void)
                return -EALREADY;
 
        the_lnet.ln_push_target_eq =
-               LNetEQAlloc(lnet_push_target_event_handler);
-       if (IS_ERR(the_lnet.ln_push_target_eq)) {
-               rc = PTR_ERR(the_lnet.ln_push_target_eq);
-               CERROR("Can't allocated push target EQ: %d\n", rc);
-               return rc;
-       }
+               lnet_push_target_event_handler;
 
        rc = LNetSetLazyPortal(LNET_RESERVED_PORTAL);
        LASSERT(rc == 0);
@@ -2007,7 +1988,6 @@ static int lnet_push_target_init(void)
 
        if (rc) {
                LNetClearLazyPortal(LNET_RESERVED_PORTAL);
-               LNetEQFree(the_lnet.ln_push_target_eq);
                the_lnet.ln_push_target_eq = NULL;
        }
 
@@ -2035,7 +2015,6 @@ static void lnet_push_target_fini(void)
        the_lnet.ln_push_target_nnis = 0;
 
        LNetClearLazyPortal(LNET_RESERVED_PORTAL);
-       LNetEQFree(the_lnet.ln_push_target_eq);
        the_lnet.ln_push_target_eq = NULL;
 }
 
@@ -2696,12 +2675,7 @@ LNetNIInit(lnet_pid_t requested_pid)
 
        lnet_ping_target_update(pbuf, ping_mdh);
 
-       the_lnet.ln_mt_eq = LNetEQAlloc(lnet_mt_event_handler);
-       if (IS_ERR(the_lnet.ln_mt_eq)) {
-               rc = PTR_ERR(the_lnet.ln_mt_eq);
-               CERROR("Can't allocate monitor thread EQ: %d\n", rc);
-               goto err_stop_ping;
-       }
+       the_lnet.ln_mt_eq = lnet_mt_event_handler;
 
        rc = lnet_push_target_init();
        if (rc != 0)
@@ -4145,7 +4119,6 @@ lnet_ping_event_handler(struct lnet_event *event)
 static int lnet_ping(struct lnet_process_id id, signed long timeout,
                     struct lnet_process_id __user *ids, int n_ids)
 {
-       struct lnet_eq *eq;
        struct lnet_md md = { NULL };
        struct ping_data pd = { 0 };
        struct lnet_ping_buffer *pbuf;
@@ -4173,13 +4146,6 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
        if (!pbuf)
                return -ENOMEM;
 
-       eq = LNetEQAlloc(lnet_ping_event_handler);
-       if (IS_ERR(eq)) {
-               rc = PTR_ERR(eq);
-               CERROR("Can't allocate EQ: %d\n", rc);
-               goto fail_ping_buffer_decref;
-       }
-
        /* initialize md content */
        md.start     = &pbuf->pb_info;
        md.length    = LNET_PING_INFO_SIZE(n_ids);
@@ -4187,14 +4153,14 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
        md.max_size  = 0;
        md.options   = LNET_MD_TRUNCATE;
        md.user_ptr  = &pd;
-       md.eq_handle = eq;
+       md.eq_handle = lnet_ping_event_handler;
 
        init_completion(&pd.completion);
 
        rc = LNetMDBind(md, LNET_UNLINK, &pd.mdh);
        if (rc != 0) {
                CERROR("Can't bind MD: %d\n", rc);
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        rc = LNetGet(LNET_NID_ANY, pd.mdh, id,
@@ -4216,7 +4182,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
        }
        if (!pd.replied) {
                rc = -EIO;
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        nob = pd.rc;
@@ -4227,7 +4193,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
        if (nob < 8) {
                CERROR("%s: ping info too short %d\n",
                       libcfs_id2str(id), nob);
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        if (pbuf->pb_info.pi_magic == __swab32(LNET_PROTO_PING_MAGIC)) {
@@ -4235,20 +4201,20 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
        } else if (pbuf->pb_info.pi_magic != LNET_PROTO_PING_MAGIC) {
                CERROR("%s: Unexpected magic %08x\n",
                       libcfs_id2str(id), pbuf->pb_info.pi_magic);
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        if ((pbuf->pb_info.pi_features & LNET_PING_FEAT_NI_STATUS) == 0) {
                CERROR("%s: ping w/o NI status: 0x%x\n",
                       libcfs_id2str(id), pbuf->pb_info.pi_features);
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        if (nob < LNET_PING_INFO_SIZE(0)) {
                CERROR("%s: Short reply %d(%d min)\n",
                       libcfs_id2str(id),
                       nob, (int)LNET_PING_INFO_SIZE(0));
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        if (pbuf->pb_info.pi_nnis < n_ids)
@@ -4258,7 +4224,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
                CERROR("%s: Short reply %d(%d expected)\n",
                       libcfs_id2str(id),
                       nob, (int)LNET_PING_INFO_SIZE(n_ids));
-               goto fail_free_eq;
+               goto fail_ping_buffer_decref;
        }
 
        rc = -EFAULT;           /* if I segv in copy_to_user()... */
@@ -4268,13 +4234,10 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
                tmpid.pid = pbuf->pb_info.pi_pid;
                tmpid.nid = pbuf->pb_info.pi_ni[i].ns_nid;
                if (copy_to_user(&ids[i], &tmpid, sizeof(tmpid)))
-                       goto fail_free_eq;
+                       goto fail_ping_buffer_decref;
        }
        rc = pbuf->pb_info.pi_nnis;
 
- fail_free_eq:
-       LNetEQFree(eq);
-
  fail_ping_buffer_decref:
        lnet_ping_buffer_decref(pbuf);
        return rc;
diff --git a/lnet/lnet/lib-eq.c b/lnet/lnet/lib-eq.c
deleted file mode 100644 (file)
index 4bcf3b4..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2016, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lnet/lnet/lib-eq.c
- *
- * Library level Event queue management routines
- */
-
-#define DEBUG_SUBSYSTEM S_LNET
-#include <lnet/lib-lnet.h>
-
-/**
- * Create an event queue that calls a @callback on each event.
- *
- * \param callback A handler function that runs when an event is deposited
- * into the EQ.
- *
- * \retval eq     On successful return, the newly created EQ is returned.
- *                On failure, an error code encoded with ERR_PTR() is returned.
- * \retval -EINVAL If an parameter is not valid.
- * \retval -ENOMEM If memory for the EQ can't be allocated.
- *
- * \see lnet_eq_handler_t for the discussion on EQ handler semantics.
- */
-struct lnet_eq *
-LNetEQAlloc(lnet_eq_handler_t callback)
-{
-       struct lnet_eq *eq;
-
-       LASSERT(the_lnet.ln_refcount > 0);
-
-       if (callback == LNET_EQ_HANDLER_NONE)
-               return ERR_PTR(-EINVAL);
-
-       eq = lnet_eq_alloc();
-       if (eq == NULL)
-               return ERR_PTR(-ENOMEM);
-
-       eq->eq_callback = callback;
-
-       return eq;
-}
-EXPORT_SYMBOL(LNetEQAlloc);
-
-/**
- * Release the resources associated with an event queue if it's idle;
- * otherwise do nothing and it's up to the user to try again.
- *
- * \param eq The event queue to be released.
- *
- */
-void
-LNetEQFree(struct lnet_eq *eq)
-{
-       lnet_eq_free(eq);
-}
-EXPORT_SYMBOL(LNetEQFree);
-
-void
-lnet_eq_enqueue_event(struct lnet_eq *eq, struct lnet_event *ev)
-{
-       LASSERT(eq->eq_callback != LNET_EQ_HANDLER_NONE);
-       eq->eq_callback(ev);
-}
index caab997..c3b9daa 100644 (file)
@@ -238,7 +238,7 @@ lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink)
 
 /* must be called with resource lock held */
 static int
-lnet_md_link(struct lnet_libmd *md, struct lnet_eq *eq, int cpt)
+lnet_md_link(struct lnet_libmd *md, lnet_eq_handler_t eq, int cpt)
 {
        struct lnet_res_container *container = the_lnet.ln_md_containers[cpt];
 
@@ -254,8 +254,7 @@ lnet_md_link(struct lnet_libmd *md, struct lnet_eq *eq, int cpt)
         * maybe there we shouldn't even allow LNET_EQ_NONE!)
         * LASSERT (eq == NULL);
         */
-       if (eq)
-               md->md_eq = eq;
+       md->md_eq = eq;
 
        lnet_res_lh_initialize(container, &md->md_lh);
 
@@ -511,7 +510,7 @@ LNetMDUnlink(struct lnet_handle_md mdh)
         * unlinked. Otherwise, we enqueue an event now... */
        if (md->md_eq != NULL && md->md_refcount == 0) {
                lnet_build_unlink_event(md, &ev);
-               lnet_eq_enqueue_event(md->md_eq, &ev);
+               md->md_eq(&ev);
        }
 
        if (md->md_rspt_ptr != NULL)
index aed1c4b..3e0c940 100644 (file)
@@ -150,7 +150,7 @@ LNetMEUnlink(struct lnet_me *me)
                md->md_flags |= LNET_MD_FLAG_ABORTED;
                if (md->md_eq != NULL && md->md_refcount == 0) {
                        lnet_build_unlink_event(md, &ev);
-                       lnet_eq_enqueue_event(md->md_eq, &ev);
+                       md->md_eq(&ev);
                }
        }
 
index b32642a..0c9c4f3 100644 (file)
@@ -3565,7 +3565,7 @@ lnet_monitor_thread(void *arg)
 int
 lnet_send_ping(lnet_nid_t dest_nid,
               struct lnet_handle_md *mdh, int nnis,
-              void *user_data, struct lnet_eq *eq, bool recovery)
+              void *user_data, lnet_eq_handler_t eq, bool recovery)
 {
        struct lnet_md md = { NULL };
        struct lnet_process_id id;
index 3e2c1f2..69f0700 100644 (file)
@@ -947,7 +947,7 @@ lnet_msg_detach_md(struct lnet_msg *msg, int cpt, int status)
                        msg->msg_ev.status   = status;
                }
                msg->msg_ev.unlinked = unlink;
-               lnet_eq_enqueue_event(md->md_eq, &msg->msg_ev);
+               md->md_eq(&msg->msg_ev);
        }
 
        if (unlink || (md->md_refcount == 0 &&
index 22c9053..b2750ac 100644 (file)
@@ -3475,7 +3475,6 @@ static int lnet_peer_discovery(void *arg)
        }
        lnet_net_unlock(LNET_LOCK_EX);
 
-       LNetEQFree(the_lnet.ln_dc_eq);
        the_lnet.ln_dc_eq = NULL;
 
        the_lnet.ln_dc_state = LNET_DC_STATE_SHUTDOWN;
@@ -3495,20 +3494,13 @@ int lnet_peer_discovery_start(void)
        if (the_lnet.ln_dc_state != LNET_DC_STATE_SHUTDOWN)
                return -EALREADY;
 
-       the_lnet.ln_dc_eq = LNetEQAlloc(lnet_discovery_event_handler);
-       if (IS_ERR(the_lnet.ln_dc_eq)) {
-               rc = PTR_ERR(the_lnet.ln_dc_eq);
-               CERROR("Can't allocate discovery EQ: %d\n", rc);
-               return rc;
-       }
-
+       the_lnet.ln_dc_eq = lnet_discovery_event_handler;
        the_lnet.ln_dc_state = LNET_DC_STATE_RUNNING;
        task = kthread_run(lnet_peer_discovery, NULL, "lnet_discovery");
        if (IS_ERR(task)) {
                rc = PTR_ERR(task);
                CERROR("Can't start peer discovery thread: %d\n", rc);
 
-               LNetEQFree(the_lnet.ln_dc_eq);
                the_lnet.ln_dc_eq = NULL;
 
                the_lnet.ln_dc_state = LNET_DC_STATE_SHUTDOWN;
index 57d21e2..71fa157 100644 (file)
@@ -53,7 +53,7 @@ enum srpc_state {
 static struct smoketest_rpc {
        spinlock_t       rpc_glock;     /* global lock */
        struct srpc_service     *rpc_services[SRPC_SERVICE_MAX_ID + 1];
-       struct lnet_eq          *rpc_lnet_eq;   /* _the_ LNet event queue */
+       lnet_eq_handler_t        rpc_lnet_eq;   /* _the_ LNet event handler */
        enum srpc_state          rpc_state;
        struct srpc_counters     rpc_counters;
        __u64                    rpc_matchbits; /* matchbits counter */
@@ -1621,12 +1621,7 @@ srpc_startup (void)
 
        srpc_data.rpc_state = SRPC_STATE_NI_INIT;
 
-       srpc_data.rpc_lnet_eq = LNetEQAlloc(srpc_lnet_ev_handler);
-       if (IS_ERR(srpc_data.rpc_lnet_eq)) {
-               rc = PTR_ERR(srpc_data.rpc_lnet_eq);
-               CERROR("LNetEQAlloc() has failed: %d\n", rc);
-               goto bail;
-       }
+       srpc_data.rpc_lnet_eq = srpc_lnet_ev_handler;
 
        rc = LNetSetLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
        LASSERT(rc == 0);
@@ -1637,7 +1632,6 @@ srpc_startup (void)
 
        rc = stt_startup();
 
-bail:
        if (rc != 0)
                srpc_shutdown();
        else
@@ -1680,7 +1674,6 @@ srpc_shutdown (void)
                rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
                rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL);
                LASSERT(rc == 0);
-               LNetEQFree(srpc_data.rpc_lnet_eq);
                /* fallthrough */
 
        case SRPC_STATE_NI_INIT:
index 34d1282..0a76d9a 100644 (file)
@@ -40,7 +40,7 @@
 #include <lustre_sec.h>
 #include "ptlrpc_internal.h"
 
-struct lnet_eq *ptlrpc_eq;
+lnet_eq_handler_t ptlrpc_eq;
 struct percpu_ref ptlrpc_pending;
 
 /*
@@ -566,7 +566,6 @@ static void ptlrpc_ni_fini(void)
        percpu_ref_kill(&ptlrpc_pending);
        wait_for_completion(&ptlrpc_done);
 
-       LNetEQFree(ptlrpc_eq);
        LNetNIFini();
 }
 
@@ -603,15 +602,8 @@ int ptlrpc_ni_init(void)
         * because we are guaranteed to get every event via callback,
         * so we just set EQ size to 0 to avoid overhread of serializing
         * enqueue/dequeue operations in LNet. */
-       ptlrpc_eq = LNetEQAlloc(ptlrpc_master_callback);
-       if (!IS_ERR(ptlrpc_eq))
-               return 0;
-
-       rc = PTR_ERR(ptlrpc_eq);
-       CERROR("Failed to allocate event queue: %d\n", rc);
-       LNetNIFini();
-
-       return rc;
+       ptlrpc_eq = ptlrpc_master_callback;
+       return 0;
 }
 
 int ptlrpc_init_portals(void)
index 359cccb..5624e50 100644 (file)
@@ -63,7 +63,7 @@ extern struct nrs_core nrs_core;
 extern struct mutex ptlrpcd_mutex;
 extern struct mutex pinger_mutex;
 
-extern struct lnet_eq *ptlrpc_eq;
+extern lnet_eq_handler_t ptlrpc_eq;
 extern struct percpu_ref ptlrpc_pending;
 
 int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait);