[openib-general] [PATCH][kdapl] Remove dapl_hash (there is no need for the hash)

Itamar Rabenstein itamar at mellanox.co.il
Mon Jun 20 01:44:50 PDT 2005


Remove dapl_hash (there is no need for the hash)

Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>

diff -Nurp -X dontdiff dat-provider_bind/Makefile dat-provider/Makefile
--- dat-provider_bind/Makefile	Sun Jun 19 15:17:54 2005
+++ dat-provider/Makefile	Sun Jun 19 15:24:03 2005
@@ -20,7 +20,6 @@ PROVIDER_MODULES := \
         dapl_cr                  	\
         dapl_ep                         \
         dapl_evd                        \
-        dapl_hash                     	\
         dapl_hca_util                 	\
         dapl_ia                  	\
         dapl_lmr                 	\
diff -Nurp -X dontdiff dat-provider_bind/dapl.h dat-provider/dapl.h
--- dat-provider_bind/dapl.h	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl.h	Sun Jun 19 15:24:06 2005
@@ -84,9 +84,6 @@ typedef enum dapl_evd_completion {
 
 typedef void (*ib_async_handler_t) (struct ib_event *, void *);
 
-typedef u64 DAPL_HASH_KEY;
-typedef void *DAPL_HASH_DATA;
-
 /*********************************************************************
  *                                                                   *
  * Structures                                                        *
@@ -125,8 +122,6 @@ struct dapl_hca {
         u8 port_num;
 	struct ib_device *ib_hca_handle;
 	struct ib_cq *null_cq; 	/* CQ with 0 entries */
-	/* Memory Subsystem Support */
-	struct dapl_hash_table *lmr_hash_table;
 	/* Limits & useful HCA attributes */
 	struct dat_ia_attr ia_attr;
 	struct dat_ep_attr ep_attr;
diff -Nurp -X dontdiff dat-provider_bind/dapl_hash.c dat-provider/dapl_hash.c
--- dat-provider_bind/dapl_hash.c	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_hash.c	Thu Jan  1 02:00:00 1970
@@ -1,462 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- *    copy of which is available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * Provides a generic hash table with chaining.
- *
- * $Id: dapl_hash.c 2640 2005-06-16 16:22:46Z jlentini $
- */
-
-#include "dapl_hash.h"
-
-/*********************************************************************
- *                                                                   *
- * Structures                                                        *
- *                                                                   *
- *********************************************************************/
-
-/*
- * A hash table element
- */
-typedef struct DAPL_HASH_ELEM {
-	struct DAPL_HASH_ELEM *next_element;
-	DAPL_HASH_KEY key;
-	void *datum;
-} DAPL_HASH_ELEM;
-
-/*
- * The hash table
- */
-struct dapl_hash_table {
-	unsigned long num_entries;
-	unsigned long tbl_size;
-	DAPL_HASH_ELEM *table;
-	spinlock_t lock;
-	unsigned long flags;
-	/*
-	 * statistics - we tally on insert operations, counting
-	 * the number of entries in the whole hash table, as
-	 * well as the length of chains we walk to insert.  This
-	 * ignores empty buckets, giving us data on overall table
-	 * occupancy, as well as max/average chain length for
-	 * the buckets used.  If our hash function results in
-	 * hot buckets, this will show it.
-	 */
-	uint64_t hash_tbl_inserts;	/* total inserts ops    */
-	uint64_t hash_tbl_max;	/* max in entire table  */
-	uint64_t hash_tbl_total;	/* total in table       */
-	uint64_t hash_chn_max;	/* longest chain        */
-	uint64_t hash_chn_total;	/* total non-0 lenghts  */
-};
-
-/*********************************************************************
- *                                                                   *
- * Defines                                                           *
- *                                                                   *
- *********************************************************************/
-
-/* datum value in empty table slots  (use 0UL or ~0UL as appropriate) */
-#define NO_DATUM_VALUE          ((void *) 0UL)
-#define NO_DATUM(value)         ((value) == NO_DATUM_VALUE)
-
-/* Lookup macro (which falls back to function to rehash) */
-#define DAPL_HASHLOOKUP( p_table, in_key, out_datum, bucket_head) \
-    do { \
-        DAPL_HASH_KEY save_key = in_key; \
-        DAPL_HASH_ELEM *element = \
-            &((p_table)->table)[DAPL_DOHASH(in_key,(p_table)->tbl_size)]; \
-        in_key = save_key; \
-        if (NO_DATUM(element->datum)) { \
-            (bucket_head) = (void *)0; \
-        } else if (element->key == (DAPL_HASH_KEY) (in_key)) { \
-            (out_datum) = element->datum; \
-            (bucket_head) = (void *)element; \
-        } else if (element->next_element) { \
-            dapl_hash_rehash(element, \
-                            (in_key), \
-                            (void **)&(out_datum), \
-                            (DAPL_HASH_ELEM **)&(bucket_head)); \
-        } else { \
-            (bucket_head) = (void *)0; \
-        }\
-    } while (0)
-
-/*********************************************************************
- *                                                                   *
- * Internal Functions                                                *
- *                                                                   *
- *********************************************************************/
-
-/*
- * Rehash the key (used by add and lookup functions)
- * 
- * Inputs:  element	element to rehash key
- *	    key, datum	datum for key head
- *	    head	head for list
- */
-static void
-dapl_hash_rehash(DAPL_HASH_ELEM * element,
-		 DAPL_HASH_KEY key, void **datum, DAPL_HASH_ELEM ** head)
-{
-	/*
-	 * assume we looked at the contents of element already,
-	 * and start with the next element.
-	 */
-	dapl_os_assert(element->next_element);
-	dapl_os_assert(!NO_DATUM(element->datum));
-
-	*head = element;
-	while (1) {
-		element = element->next_element;
-		if (!element) {
-			break;
-		}
-		if (element->key == key) {
-			*datum = element->datum;
-			return;
-		}
-	}
-	*head = NULL;
-}
-
-/*
- * Add a new key to the hash table
- * 
- * Inputs:
- *          table, key and datum to be added
- *          allow_dup   - TRUE if dups are allowed
- * Outputs: 
- *          report_dup  - should you care to know
- * Returns:
- *          TRUE on success     
- */
-static boolean_t
-dapl_hash_add(struct dapl_hash_table *table, DAPL_HASH_KEY key, void *datum,
-	      boolean_t allow_dup, boolean_t *report_dup)
-{
-	void *olddatum;
-	DAPL_HASH_KEY hashValue, save_key = key;
-	DAPL_HASH_ELEM *found;
-	boolean_t status = FALSE;
-	unsigned int chain_len = 0;
-
-	if (report_dup) {
-		(*report_dup) = FALSE;
-	}
-
-	if (NO_DATUM(datum)) {
-		/*
-		 * Reserved value used for datum
-		 */
-		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
-			     "dapl_hash_add() called with magic NO_DATA "
-			     "value (%p) used as datum!\n", datum);
-		return FALSE;
-	}
-
-	DAPL_HASHLOOKUP(table, key, olddatum, found);
-	if (found) {
-		/*
-		 * key exists already
-		 */
-		if (report_dup) {
-			*report_dup = TRUE;
-		}
-
-		if (!allow_dup) {
-			dapl_dbg_log(DAPL_DBG_TYPE_ERR,
-				     "dapl_hash_add() called with duplicate "
-				     "key (" F64x ")\n", key);
-			return FALSE;
-		}
-	}
-
-	hashValue = DAPL_DOHASH(key, table->tbl_size);
-	key = save_key;
-	if (NO_DATUM(table->table[hashValue].datum)) {
-		/*
-		 * Empty head - just fill it in
-		 */
-		table->table[hashValue].key = key;
-		table->table[hashValue].datum = datum;
-		table->table[hashValue].next_element = NULL;
-		table->num_entries++;
-		status = TRUE;
-	} else {
-		DAPL_HASH_ELEM *newelement = kmalloc(sizeof *newelement,
-						     GFP_ATOMIC);
-		/*
-		 * Add an element to the end of the chain
-		 */
-		if (newelement) {
-			DAPL_HASH_ELEM *lastelement;
-			newelement->key = key;
-			newelement->datum = datum;
-			newelement->next_element = NULL;
-			for (lastelement = &table->table[hashValue];
-			     lastelement->next_element;
-			     lastelement = lastelement->next_element) {
-				/* Walk to the end of the chain */
-				chain_len++;
-			}
-			lastelement->next_element = newelement;
-			table->num_entries++;
-			status = TRUE;
-		} else
-			status = FALSE;
-	}
-
-	/*
-	 * Tally up our counters. chain_len is one less than current chain
-	 * length.
-	 */
-	chain_len++;
-	table->hash_tbl_inserts++;
-	table->hash_tbl_total += table->num_entries;
-	table->hash_chn_total += chain_len;
-	if (table->num_entries > table->hash_tbl_max) {
-		table->hash_tbl_max = table->num_entries;
-	}
-	if (chain_len > table->hash_chn_max) {
-		table->hash_chn_max = chain_len;
-	}
-
-	return status;
-}
-
-/*
- * Remove element from hash bucket
- * 
- * Inputs:
- *          element, key        to be deleted
- * Returns:
- *          TRUE on success
- */
-static boolean_t
-dapl_hash_delete_element(DAPL_HASH_ELEM * element,
-			 DAPL_HASH_KEY key, DAPL_HASH_DATA * p_datum)
-{
-	DAPL_HASH_ELEM *curelement;
-	DAPL_HASH_ELEM *lastelement;
-
-	lastelement = NULL;
-	for (curelement = element;
-	     curelement;
-	     lastelement = curelement, curelement = curelement->next_element) {
-		if (curelement->key == key) {
-			if (p_datum) {
-				*p_datum = curelement->datum;
-			}
-			if (lastelement) {
-				/*
-				 * curelement was malloc'd; free it
-				 */
-				lastelement->next_element =
-				    curelement->next_element;
-				kfree(curelement);
-			} else {
-				/*
-				 * curelement is static list head
-				 */
-				DAPL_HASH_ELEM *n = curelement->next_element;
-				if (n) {
-					/*
-					 * If there is a next element, copy its contents into the
-					 * head and free the original next element.
-					 */
-					curelement->key = n->key;
-					curelement->datum = n->datum;
-					curelement->next_element =
-					    n->next_element;
-					kfree(n);
-				} else {
-					curelement->datum = NO_DATUM_VALUE;
-				}
-			}
-			break;
-		}
-	}
-
-	return (curelement != NULL ? TRUE : FALSE);
-}
-
-/*********************************************************************
- *                                                                   *
- * External Functions                                                *
- *                                                                   *
- *********************************************************************/
-
-/*
- * Create a new hash table with at least 'table_size' hash buckets.
- */
-u32 dapl_hash_create(int table_size, struct dapl_hash_table **pp_table)
-{
-	struct dapl_hash_table *p_table;
-	int table_length = table_size * sizeof (struct DAPL_HASH_ELEM);
-	u32 dat_status = DAT_SUCCESS;
-	int i;
-
-	dapl_os_assert(pp_table);
-
-	/* Allocate hash table */
-	p_table = kmalloc(sizeof *p_table, GFP_ATOMIC);
-	if (!p_table) {
-		dat_status =
-		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
-		goto bail;
-	}
-
-	/* Init hash table, allocate and init and buckets */
-	memset(p_table, 0, sizeof *p_table);
-	p_table->tbl_size = table_size;
-	p_table->table = kmalloc(table_length, GFP_ATOMIC);
-	if (!p_table->table) {
-		kfree(p_table);
-		dat_status =
-		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
-		goto bail;
-	}
-
-	spin_lock_init(&p_table->lock);
-	for (i = 0; i < table_size; i++) {
-		p_table->table[i].datum = NO_DATUM_VALUE;
-		p_table->table[i].key = 0;
-		p_table->table[i].next_element = NULL;
-	}
-
-	*pp_table = p_table;
-
-bail:
-	return DAT_SUCCESS;
-}
-
-/*
- * Destroy a hash table
- */
-u32 dapl_hash_free(struct dapl_hash_table *p_table)
-{
-	dapl_os_assert(p_table && p_table->table);
-
-	/* no need to destroy p_table->lock */
-	kfree(p_table->table);
-	kfree(p_table);
-
-	return DAT_SUCCESS;
-}
-
-/*
- * Returns the number of elements stored in the table
- */
-
-u32 dapl_hash_size(struct dapl_hash_table *p_table, int *p_size)
-{
-	dapl_os_assert(p_table && p_size);
-
-	*p_size = p_table->num_entries;
-
-	return DAT_SUCCESS;
-}
-
-/*
- * Inserts the specified data into the table with the given key.
- * Duplicates are not expected, and return in error, having done nothing.
- */
-
-u32 dapl_hash_insert(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-		     DAPL_HASH_DATA data)
-{
-	u32 dat_status = DAT_SUCCESS;
-
-	dapl_os_assert(p_table);
-
-	spin_lock_irqsave(&p_table->lock, p_table->flags);
-	if (!dapl_hash_add(p_table, key, data, FALSE, NULL)) {
-		dat_status =
-		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
-	}
-	spin_unlock_irqrestore(&p_table->lock, p_table->flags);
-
-	return dat_status;
-}
-
-/*
- * Searches for the given key.  If found, 
- * DAT_SUCCESS is returned and the associated 
- * data is returned in the DAPL_HASH_DATA 
- * pointer if that pointer is not NULL.
- */
-u32 dapl_hash_search(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-		     DAPL_HASH_DATA *p_data)
-{
-	u32 dat_status;
-	void *olddatum;
-	DAPL_HASH_ELEM *found;
-
-	dapl_os_assert(p_table);
-	dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, 0);
-
-	spin_lock_irqsave(&p_table->lock, p_table->flags);
-	DAPL_HASHLOOKUP(p_table, key, olddatum, found);
-	spin_unlock_irqrestore(&p_table->lock, p_table->flags);
-
-	if (found) {
-		if (p_data) {
-			*p_data = olddatum;
-		}
-		dat_status = DAT_SUCCESS;
-	}
-
-	return dat_status;
-}
-
-u32 dapl_hash_remove(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-		     DAPL_HASH_DATA *p_data)
-{
-	u32 dat_status;
-	DAPL_HASH_KEY hashValue, save_key = key;
-
-	dapl_os_assert(p_table);
-	dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, 0);
-
-	if (p_table->num_entries == 0) {
-		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
-			     "dapl_hash_remove () called on empty hash table!\n");
-		return dat_status;
-	}
-
-	hashValue = DAPL_DOHASH(key, p_table->tbl_size);
-	key = save_key;
-	spin_lock_irqsave(&p_table->lock, p_table->flags);
-	if (dapl_hash_delete_element(&p_table->table[hashValue], key, p_data)) {
-		p_table->num_entries--;
-		dat_status = DAT_SUCCESS;
-	}
-	spin_unlock_irqrestore(&p_table->lock, p_table->flags);
-
-	return dat_status;
-}
diff -Nurp -X dontdiff dat-provider_bind/dapl_hash.h dat-provider/dapl_hash.h
--- dat-provider_bind/dapl_hash.h	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_hash.h	Thu Jan  1 02:00:00 1970
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- *    copy of which is available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * $Id: dapl_hash.h 2640 2005-06-16 16:22:46Z jlentini $
- */
-
-#ifndef DAPL_HASH_H
-#define DAPL_HASH_H
-
-#include "dapl.h"
-
-/*********************************************************************
- *                                                                   *
- * Defines                                                           *
- *                                                                   *
- *********************************************************************/
-
-/*
- * Hash table size.
- *
- * Default is small; use the larger sample values for hash tables
- * known to be heavily used.  The sample values chosen are the
- * largest primes below 2^8, 2^9, and 2^10.
- */
-#define DAPL_DEF_HASHSIZE               251
-#define DAPL_MED_HASHSIZE               509
-#define DAPL_LRG_HASHSIZE               1021
-
-#define DAPL_HASH_TABLE_DEFAULT_CAPACITY DAPL_DEF_HASHSIZE
-
-/* The hash function */
-#define DAPL_DOHASH(key,hashsize) dapl_os_mod64(key,hashsize)
-
-/*********************************************************************
- *                                                                   *
- * Function Prototypes                                               *
- *                                                                   *
- *********************************************************************/
-
-extern u32 dapl_hash_create(int capacity, struct dapl_hash_table **pp_table);
-
-extern u32 dapl_hash_free(struct dapl_hash_table *p_table);
-
-extern u32 dapl_hash_size(struct dapl_hash_table *p_table, int *p_size);
-
-extern u32 dapl_hash_insert(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-			    DAPL_HASH_DATA data);
-
-extern u32 dapl_hash_search(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-			    DAPL_HASH_DATA *p_data);
-
-extern u32 dapl_hash_remove(struct dapl_hash_table *p_table, DAPL_HASH_KEY key,
-			    DAPL_HASH_DATA *p_data);
-
-#endif				/* DAPL_HASH_H */
diff -Nurp -X dontdiff dat-provider_bind/dapl_hca_util.c dat-provider/dapl_hca_util.c
--- dat-provider_bind/dapl_hca_util.c	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_hca_util.c	Sun Jun 19 15:24:06 2005
@@ -34,7 +34,6 @@
 #include "dapl_openib_util.h"
 #include "dapl_provider.h"
 #include "dapl_hca_util.h"
-#include "dapl_hash.h"
 
 /*
  * dapl_hca_alloc
@@ -60,20 +59,13 @@ struct dapl_hca *dapl_hca_alloc(char *na
 	if (hca) {
 		memset(hca, 0, sizeof *hca);
 
-		if (DAT_SUCCESS ==
-		    dapl_hash_create(DAPL_HASH_TABLE_DEFAULT_CAPACITY,
-				     &hca->lmr_hash_table)) {
-			spin_lock_init(&hca->lock);
-			INIT_LIST_HEAD(&hca->ia_list);
-
-			hca->name = dapl_os_strdup(name);
-			hca->ib_hca_handle = device;
-			hca->port_num = port;
-			if (hca->name == NULL) {
-				kfree(hca);
-				hca = NULL;
-			}
-		} else {
+		spin_lock_init(&hca->lock);
+		INIT_LIST_HEAD(&hca->ia_list);
+
+		hca->name = dapl_os_strdup(name);
+		hca->ib_hca_handle = device;
+		hca->port_num = port;
+		if (hca->name == NULL) {
 			kfree(hca);
 			hca = NULL;
 		}
@@ -99,7 +91,6 @@ struct dapl_hca *dapl_hca_alloc(char *na
  */
 void dapl_hca_free(struct dapl_hca *hca)
 {
-	(void)dapl_hash_free(hca->lmr_hash_table);
 	kfree(hca->name);
 	kfree(hca);
 }
diff -Nurp -X dontdiff dat-provider_bind/dapl_lmr.c dat-provider/dapl_lmr.c
--- dat-provider_bind/dapl_lmr.c	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_lmr.c	Sun Jun 19 15:24:06 2005
@@ -32,7 +32,6 @@
 
 #include "dapl_openib_util.h"
 #include "dapl_ia.h"
-#include "dapl_hash.h"
 
 static struct dapl_lmr *dapl_lmr_alloc(struct dapl_ia *ia,
 				       enum dat_mem_type mem_type,
@@ -104,17 +103,6 @@ static inline u32 dapl_lmr_create_virtua
 	if (DAT_SUCCESS != status)
 		goto error2;
 
-	/* if the LMR context is already in the hash table */
-	status = dapl_hash_search(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, NULL);
-	if (status == DAT_SUCCESS)
-		goto error3;
-
-	status = dapl_hash_insert(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, lmr);
-	if (status != DAT_SUCCESS)
-		goto error3;
-
 	atomic_inc(&pz->pz_ref_count);
 
 	if (lmr)
@@ -130,8 +118,6 @@ static inline u32 dapl_lmr_create_virtua
 
 	return DAT_SUCCESS;
 	
-error3:
-	(void)dapl_ib_mr_deregister(new_lmr);
 error2:
 	dapl_lmr_dealloc(new_lmr);	
 error1:
@@ -168,17 +154,6 @@ static inline u32 dapl_lmr_create_physic
 	if (DAT_SUCCESS != status)
 		goto error2;
 
-	/* if the LMR context is already in the hash table */
-	status = dapl_hash_search(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, NULL);
-	if (status == DAT_SUCCESS)
-		goto error3;
-
-	status = dapl_hash_insert(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, lmr);
-	if (status != DAT_SUCCESS)
-		goto error3;
-
 	atomic_inc(&pz->pz_ref_count);
 
 	if (lmr)
@@ -194,8 +169,6 @@ static inline u32 dapl_lmr_create_physic
 
 	return DAT_SUCCESS;
 
-error3:
-	(void)dapl_ib_mr_deregister(new_lmr);
 error2:
 	dapl_lmr_dealloc(new_lmr);
 error1:
@@ -216,12 +189,6 @@ static inline u32 dapl_lmr_create_lmr(st
 	DAT_REGION_DESCRIPTION reg_desc;
 	u32 status;
 	
-	status = dapl_hash_search(ia->hca->lmr_hash_table,
-				  original_lmr->param.lmr_context,
-				  (DAPL_HASH_DATA *) &lmr);
-	if (status != DAT_SUCCESS)
-		goto error1;
-	
 	reg_desc.for_lmr = (struct dat_lmr *) original_lmr;
 	
 	new_lmr = dapl_lmr_alloc(ia, DAT_MEM_TYPE_LMR, reg_desc, 0,
@@ -236,17 +203,6 @@ static inline u32 dapl_lmr_create_lmr(st
 	if (DAT_SUCCESS != status)
 		goto error2;
 
-	/* if the LMR context is already in the hash table */
-	status = dapl_hash_search(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, NULL);
-	if (status == DAT_SUCCESS)
-		goto error3;
-
-	status = dapl_hash_insert(ia->hca->lmr_hash_table,
-				  new_lmr->param.lmr_context, lmr);
-	if (status != DAT_SUCCESS)
-		goto error3;
-
 	atomic_inc(&pz->pz_ref_count);
 
 	if (lmr)
@@ -263,8 +219,6 @@ static inline u32 dapl_lmr_create_lmr(st
 
 	return DAT_SUCCESS;
 
-error3:
-	dapl_ib_mr_deregister(new_lmr);
 error2:
 	dapl_lmr_dealloc(new_lmr);
 error1:
@@ -372,22 +326,12 @@ u32 dapl_lmr_free(struct dat_lmr *lmr)
 		if (0 != atomic_read(&dapl_lmr->lmr_ref_count))
 			return DAT_INVALID_STATE;
 		
-		status = dapl_hash_remove(
-			dapl_lmr->common.owner_ia->hca->lmr_hash_table,
-			dapl_lmr->param.lmr_context, NULL);
-		if (status != DAT_SUCCESS)
-			goto error;
-		
 		status = dapl_ib_mr_deregister(dapl_lmr);
 		if (status == DAT_SUCCESS) {
 			pz = (struct dapl_pz *)dapl_lmr->param.pz;
 			atomic_dec(&pz->pz_ref_count);
 			dapl_lmr_dealloc(dapl_lmr);
-		} else /* failure; put dapl_lmr back in hash table */
-			dapl_hash_insert(dapl_lmr->common.owner_ia->
-					 hca->lmr_hash_table,
-					 dapl_lmr->param.lmr_context, dapl_lmr);
-		
+		}
 		break;
 	}
 	case DAT_MEM_TYPE_PLATFORM:
diff -Nurp -X dontdiff dat-provider_bind/dapl_rmr.c dat-provider/dapl_rmr.c
--- dat-provider_bind/dapl_rmr.c	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_rmr.c	Sun Jun 19 15:24:06 2005
@@ -33,7 +33,6 @@
 #include "dapl.h"
 #include "dapl_ep.h"
 #include "dapl_ia.h"
-#include "dapl_hash.h"
 #include "dapl_cookie.h"
 #include "dapl_openib_util.h"
 
diff -Nurp -X dontdiff dat-provider_bind/dapl_util.h dat-provider/dapl_util.h
--- dat-provider_bind/dapl_util.h	Sun Jun 19 15:17:54 2005
+++ dat-provider/dapl_util.h	Sun Jun 19 15:24:30 2005
@@ -144,22 +144,6 @@ static inline char *dapl_os_strdup(const
 #endif
 
 /*
- * dapl_os_mod64
- *
- * Returne the modulo of a 64 bit number. Given that this is running
- * on a 32 bit platform, we need to use the kernel macro to prevent
- * exceptions from killing the machine.
- */
-static inline long dapl_os_mod64(uint64_t key, unsigned long hashsize)
-{
-#ifdef __ia64__
-	return ((uint64_t) ((key) % (hashsize)))
-#else
-	return do_div(key, hashsize);
-#endif
-}
-
-/*
  *  Debug Functions
  */
 
-- 
Itamar



More information about the general mailing list