Commit 48be378d authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: lnet: change lnet_handle_eq_t to proper struct

Change lnet_handle_eq_t from a typedef of another typedef into
a proper stand alone structure. Create the inline functions
LNetInvalidateEQHandle and LNetEQHandleIsInvalid to handle this
new piece of data.
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/20831Reviewed-by: default avatarOlaf Weber <olaf@sgi.com>
Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ea43b5a
...@@ -147,7 +147,7 @@ int LNetMDUnlink(lnet_handle_md_t md_in); ...@@ -147,7 +147,7 @@ int LNetMDUnlink(lnet_handle_md_t md_in);
* associated with it. If an event handler exists, it will be run for each * associated with it. If an event handler exists, it will be run for each
* event that is deposited into the EQ. * event that is deposited into the EQ.
* *
* In addition to the lnet_handle_eq_t, the LNet API defines two types * In addition to the lnet_handle_eq, the LNet API defines two types
* associated with events: The ::lnet_event_kind_t defines the kinds of events * associated with events: The ::lnet_event_kind_t defines the kinds of events
* that can be stored in an EQ. The lnet_event_t defines a structure that * that can be stored in an EQ. The lnet_event_t defines a structure that
* holds the information about with an event. * holds the information about with an event.
...@@ -162,11 +162,11 @@ int LNetMDUnlink(lnet_handle_md_t md_in); ...@@ -162,11 +162,11 @@ int LNetMDUnlink(lnet_handle_md_t md_in);
*/ */
int LNetEQAlloc(unsigned int count_in, int LNetEQAlloc(unsigned int count_in,
lnet_eq_handler_t handler, lnet_eq_handler_t handler,
lnet_handle_eq_t *handle_out); struct lnet_handle_eq *handle_out);
int LNetEQFree(lnet_handle_eq_t eventq_in); int LNetEQFree(struct lnet_handle_eq eventq_in);
int LNetEQPoll(lnet_handle_eq_t *eventqs_in, int LNetEQPoll(struct lnet_handle_eq *eventqs_in,
int neq_in, int neq_in,
int timeout_ms, int timeout_ms,
lnet_event_t *event_out, lnet_event_t *event_out,
......
...@@ -278,10 +278,10 @@ lnet_res_lh_invalidate(lnet_libhandle_t *lh) ...@@ -278,10 +278,10 @@ lnet_res_lh_invalidate(lnet_libhandle_t *lh)
} }
static inline void static inline void
lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq) lnet_eq2handle(struct lnet_handle_eq *handle, lnet_eq_t *eq)
{ {
if (!eq) { if (!eq) {
LNetInvalidateHandle(handle); LNetInvalidateEQHandle(handle);
return; return;
} }
...@@ -289,7 +289,7 @@ lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq) ...@@ -289,7 +289,7 @@ lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq)
} }
static inline lnet_eq_t * static inline lnet_eq_t *
lnet_handle2eq(lnet_handle_eq_t *handle) lnet_handle2eq(struct lnet_handle_eq *handle)
{ {
lnet_libhandle_t *lh; lnet_libhandle_t *lh;
......
...@@ -598,13 +598,13 @@ typedef struct { ...@@ -598,13 +598,13 @@ typedef struct {
lnet_rtrbufpool_t **ln_rtrpools; lnet_rtrbufpool_t **ln_rtrpools;
lnet_handle_md_t ln_ping_target_md; lnet_handle_md_t ln_ping_target_md;
lnet_handle_eq_t ln_ping_target_eq; struct lnet_handle_eq ln_ping_target_eq;
struct lnet_ping_info *ln_ping_info; struct lnet_ping_info *ln_ping_info;
/* router checker startup/shutdown state */ /* router checker startup/shutdown state */
int ln_rc_state; int ln_rc_state;
/* router checker's event queue */ /* router checker's event queue */
lnet_handle_eq_t ln_rc_eqh; struct lnet_handle_eq ln_rc_eqh;
/* rcd still pending on net */ /* rcd still pending on net */
struct list_head ln_rcd_deathrow; struct list_head ln_rcd_deathrow;
/* rcd ready for free */ /* rcd ready for free */
......
...@@ -284,7 +284,6 @@ typedef struct { ...@@ -284,7 +284,6 @@ typedef struct {
__u64 cookie; __u64 cookie;
} lnet_handle_any_t; } lnet_handle_any_t;
typedef lnet_handle_any_t lnet_handle_eq_t;
typedef lnet_handle_any_t lnet_handle_md_t; typedef lnet_handle_any_t lnet_handle_md_t;
typedef lnet_handle_any_t lnet_handle_me_t; typedef lnet_handle_any_t lnet_handle_me_t;
...@@ -318,6 +317,28 @@ static inline int LNetHandleIsInvalid(lnet_handle_any_t h) ...@@ -318,6 +317,28 @@ static inline int LNetHandleIsInvalid(lnet_handle_any_t h)
return h.cookie == LNET_WIRE_HANDLE_COOKIE_NONE; return h.cookie == LNET_WIRE_HANDLE_COOKIE_NONE;
} }
struct lnet_handle_eq {
u64 cookie;
};
/**
* Invalidate eq handle @h.
*/
static inline void LNetInvalidateEQHandle(struct lnet_handle_eq *h)
{
h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE;
}
/**
* Check whether eq handle @h is invalid.
*
* @return 1 if handle is invalid, 0 if valid.
*/
static inline int LNetEQHandleIsInvalid(struct lnet_handle_eq h)
{
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
/** /**
* Global process ID. * Global process ID.
*/ */
...@@ -461,7 +482,7 @@ typedef struct { ...@@ -461,7 +482,7 @@ typedef struct {
* by LNetInvalidateHandle()), operations performed on this memory * by LNetInvalidateHandle()), operations performed on this memory
* descriptor are not logged. * descriptor are not logged.
*/ */
lnet_handle_eq_t eq_handle; struct lnet_handle_eq eq_handle;
} lnet_md_t; } lnet_md_t;
/* /*
......
...@@ -1433,7 +1433,7 @@ int lnet_lib_init(void) ...@@ -1433,7 +1433,7 @@ int lnet_lib_init(void)
} }
the_lnet.ln_refcount = 0; the_lnet.ln_refcount = 0;
LNetInvalidateHandle(&the_lnet.ln_rc_eqh); LNetInvalidateEQHandle(&the_lnet.ln_rc_eqh);
INIT_LIST_HEAD(&the_lnet.ln_lnds); INIT_LIST_HEAD(&the_lnet.ln_lnds);
INIT_LIST_HEAD(&the_lnet.ln_rcd_zombie); INIT_LIST_HEAD(&the_lnet.ln_rcd_zombie);
INIT_LIST_HEAD(&the_lnet.ln_rcd_deathrow); INIT_LIST_HEAD(&the_lnet.ln_rcd_deathrow);
...@@ -2138,7 +2138,7 @@ EXPORT_SYMBOL(LNetSnprintHandle); ...@@ -2138,7 +2138,7 @@ EXPORT_SYMBOL(LNetSnprintHandle);
static int lnet_ping(lnet_process_id_t id, int timeout_ms, static int lnet_ping(lnet_process_id_t id, int timeout_ms,
lnet_process_id_t __user *ids, int n_ids) lnet_process_id_t __user *ids, int n_ids)
{ {
lnet_handle_eq_t eqh; struct lnet_handle_eq eqh;
lnet_handle_md_t mdh; lnet_handle_md_t mdh;
lnet_event_t event; lnet_event_t event;
lnet_md_t md = { NULL }; lnet_md_t md = { NULL };
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
*/ */
int int
LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
lnet_handle_eq_t *handle) struct lnet_handle_eq *handle)
{ {
lnet_eq_t *eq; lnet_eq_t *eq;
...@@ -152,7 +152,7 @@ EXPORT_SYMBOL(LNetEQAlloc); ...@@ -152,7 +152,7 @@ EXPORT_SYMBOL(LNetEQAlloc);
* \retval -EBUSY If the EQ is still in use by some MDs. * \retval -EBUSY If the EQ is still in use by some MDs.
*/ */
int int
LNetEQFree(lnet_handle_eq_t eqh) LNetEQFree(struct lnet_handle_eq eqh)
{ {
struct lnet_eq *eq; struct lnet_eq *eq;
lnet_event_t *events = NULL; lnet_event_t *events = NULL;
...@@ -370,7 +370,7 @@ __must_hold(&the_lnet.ln_eq_wait_lock) ...@@ -370,7 +370,7 @@ __must_hold(&the_lnet.ln_eq_wait_lock)
* \retval -ENOENT If there's an invalid handle in \a eventqs. * \retval -ENOENT If there's an invalid handle in \a eventqs.
*/ */
int int
LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms, LNetEQPoll(struct lnet_handle_eq *eventqs, int neq, int timeout_ms,
lnet_event_t *event, int *which) lnet_event_t *event, int *which)
{ {
int wait = 1; int wait = 1;
......
...@@ -165,7 +165,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) ...@@ -165,7 +165,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink)
/* must be called with resource lock held */ /* must be called with resource lock held */
static int static int
lnet_md_link(lnet_libmd_t *md, lnet_handle_eq_t eq_handle, int cpt) lnet_md_link(lnet_libmd_t *md, struct lnet_handle_eq eq_handle, int cpt)
{ {
struct lnet_res_container *container = the_lnet.ln_md_containers[cpt]; struct lnet_res_container *container = the_lnet.ln_md_containers[cpt];
...@@ -185,7 +185,7 @@ lnet_md_link(lnet_libmd_t *md, lnet_handle_eq_t eq_handle, int cpt) ...@@ -185,7 +185,7 @@ lnet_md_link(lnet_libmd_t *md, lnet_handle_eq_t eq_handle, int cpt)
* maybe there we shouldn't even allow LNET_EQ_NONE!) * maybe there we shouldn't even allow LNET_EQ_NONE!)
* LASSERT(!eq); * LASSERT(!eq);
*/ */
if (!LNetHandleIsInvalid(eq_handle)) { if (!LNetEQHandleIsInvalid(eq_handle)) {
md->md_eq = lnet_handle2eq(&eq_handle); md->md_eq = lnet_handle2eq(&eq_handle);
if (!md->md_eq) if (!md->md_eq)
......
...@@ -933,7 +933,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway) ...@@ -933,7 +933,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway)
md.options = LNET_MD_TRUNCATE; md.options = LNET_MD_TRUNCATE;
md.eq_handle = the_lnet.ln_rc_eqh; md.eq_handle = the_lnet.ln_rc_eqh;
LASSERT(!LNetHandleIsInvalid(the_lnet.ln_rc_eqh)); LASSERT(!LNetEQHandleIsInvalid(the_lnet.ln_rc_eqh));
rc = LNetMDBind(md, LNET_UNLINK, &rcd->rcd_mdh); rc = LNetMDBind(md, LNET_UNLINK, &rcd->rcd_mdh);
if (rc < 0) { if (rc < 0) {
CERROR("Can't bind MD: %d\n", rc); CERROR("Can't bind MD: %d\n", rc);
......
...@@ -53,7 +53,7 @@ enum srpc_state { ...@@ -53,7 +53,7 @@ enum srpc_state {
static struct smoketest_rpc { static struct smoketest_rpc {
spinlock_t rpc_glock; /* global lock */ spinlock_t rpc_glock; /* global lock */
struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1]; struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1];
lnet_handle_eq_t rpc_lnet_eq; /* _the_ LNet event queue */ struct lnet_handle_eq rpc_lnet_eq; /* _the_ LNet event queue */
enum srpc_state rpc_state; enum srpc_state rpc_state;
struct srpc_counters rpc_counters; struct srpc_counters rpc_counters;
__u64 rpc_matchbits; /* matchbits counter */ __u64 rpc_matchbits; /* matchbits counter */
...@@ -1622,7 +1622,7 @@ srpc_startup(void) ...@@ -1622,7 +1622,7 @@ srpc_startup(void)
srpc_data.rpc_state = SRPC_STATE_NI_INIT; srpc_data.rpc_state = SRPC_STATE_NI_INIT;
LNetInvalidateHandle(&srpc_data.rpc_lnet_eq); LNetInvalidateEQHandle(&srpc_data.rpc_lnet_eq);
rc = LNetEQAlloc(0, srpc_lnet_ev_handler, &srpc_data.rpc_lnet_eq); rc = LNetEQAlloc(0, srpc_lnet_ev_handler, &srpc_data.rpc_lnet_eq);
if (rc) { if (rc) {
CERROR("LNetEQAlloc() has failed: %d\n", rc); CERROR("LNetEQAlloc() has failed: %d\n", rc);
......
...@@ -1749,7 +1749,7 @@ static inline bool nrs_policy_compat_one(const struct ptlrpc_service *svc, ...@@ -1749,7 +1749,7 @@ static inline bool nrs_policy_compat_one(const struct ptlrpc_service *svc,
/** @} nrs */ /** @} nrs */
/* ptlrpc/events.c */ /* ptlrpc/events.c */
extern lnet_handle_eq_t ptlrpc_eq_h; extern struct lnet_handle_eq ptlrpc_eq_h;
int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
lnet_process_id_t *peer, lnet_nid_t *self); lnet_process_id_t *peer, lnet_nid_t *self);
/** /**
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "../include/lustre_sec.h" #include "../include/lustre_sec.h"
#include "ptlrpc_internal.h" #include "ptlrpc_internal.h"
lnet_handle_eq_t ptlrpc_eq_h; struct lnet_handle_eq ptlrpc_eq_h;
/* /*
* Client's outgoing request callback * Client's outgoing request callback
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment