diff -rbu ../nfs-utils-1.0.7/support/export/export.c ./support/export/export.c
--- ../nfs-utils-1.0.7/support/export/export.c	2003-07-03 03:28:45.000000000 +0200
+++ ./support/export/export.c	2005-08-24 15:45:36.000000000 +0200
@@ -4,6 +4,8 @@
  * Maintain list of exported file systems.
  *
  * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
+ *
+ * 2005 Tomas Richter <krik3t@gmail.com> Added hashing for exportlist
  */
 
 #include "config.h"
@@ -17,13 +19,15 @@
 #include "nfslib.h"
 #include "exportfs.h"
 
-nfs_export	*exportlist[MCL_MAXTYPES] = { NULL, };
+hash_table	exportlist[MCL_MAXTYPES] = {{NULL, {{NULL,NULL}, }}, }; 
 
 static void	export_init(nfs_export *exp, nfs_client *clp,
 					struct exportent *nep);
 static int	export_check(nfs_export *, struct hostent *, char *);
 static nfs_export *
 		export_allowed_internal(struct hostent *hp, char *path);
+void          export_add(nfs_export*);
+nfs_export *  export_lookup(char*, char*, int);
 
 int
 export_read(char *fname)
@@ -118,21 +122,38 @@
 	return new;
 }
 
-void
-export_add(nfs_export *exp)
-{
-	nfs_export	**epp;
+/*
+* add nfs_export exp into hash table
+*/
+void export_add(nfs_export *exp){
+  hash_table * p_tbl;
+  hash_entry * p_hen;
+  nfs_export * p_next;
+  
 	int		type = exp->m_client->m_type;
-	int		slen = strlen(exp->m_export.e_path);
+  /* hashing by m_hostname */
+  int pos = hashint(strtoint(exp->m_client->m_hostname)); 
+  
+  if (type < 0 || type >= MCL_MAXTYPES) {
+    xlog(L_FATAL, "unknown client type in hash_export_add");
+  }
+  
+  p_tbl = &(exportlist[type]); /* pointer to hash table */
+  p_hen = &(p_tbl->entries[pos]); /* pointer to hash table entry */
+  
+  if (!(p_hen->p_first)) { /* hash table entry is empty */ 
+     p_hen->p_first = exp;
+     p_hen->p_last  = exp;
 
-	if (type < 0 || type >= MCL_MAXTYPES)
-		xlog(L_FATAL, "unknown client type in export_add");
+     exp->m_next = p_tbl->p_head;
+     p_tbl->p_head = exp;
 
-	epp = exportlist + type;
-	while (*epp && slen < strlen((*epp)->m_export.e_path))
-		epp = &((*epp)->m_next);
-	exp->m_next = *epp;
-	*epp = exp;
+  } else { /* hash table entry is NOT empty */
+    p_next = p_hen->p_last->m_next;
+    p_hen->p_last->m_next = exp;
+    exp->m_next = p_next;
+    p_hen->p_last = exp;
+  }
 }
 
 nfs_export *
@@ -142,7 +163,7 @@
 	int		i;
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (!export_check(exp, hp, path))
 				continue;
 			if (exp->m_client->m_type == MCL_FQDN)
@@ -161,7 +182,7 @@
 	int		i;
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (!exp->m_mayexport ||
 			    !export_check(exp, hp, path))
 				continue;
@@ -199,18 +220,31 @@
 	return NULL;
 }
 
-nfs_export *
-export_lookup(char *hname, char *path, int canonical)
-{
-	nfs_client	*clp;
-	nfs_export	*exp;
+/*
+* search for export in hash table
+* if it is present, returns pointer to export else returns NULL
+*/  
+nfs_export * export_lookup(char *hname, char*path, int canonical) {
+  nfs_client * clp;
+  nfs_export * exp;
+  hash_entry * p_hen;
 
-	if (!(clp = client_lookup(hname, canonical)))
+  if(!(clp = client_lookup(hname, canonical))) {
 		return NULL;
-	for (exp = exportlist[clp->m_type]; exp; exp = exp->m_next)
-		if (exp->m_client == clp && !strcmp(exp->m_export.e_path, path))
+  }
+  
+  int pos = hashint( strtoint( clp->m_hostname ) );
+  p_hen = &(exportlist[clp->m_type].entries[pos]); /* pointer to hash entry */ 
+  
+  for(exp = p_hen->p_first; exp && (exp != p_hen->p_last->m_next); 
+      exp = exp->m_next) {
+    if (exp->m_client == clp && !strcmp(exp->m_export.e_path, path)) {
 			return exp;
+    }
+  }
+  
 	return NULL;
+
 }
 
 static int
@@ -226,10 +260,10 @@
 export_freeall(void)
 {
 	nfs_export	*exp, *nxt;
-	int		i;
+	int		i, j;
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = nxt) {
+		for (exp = exportlist[i].p_head; exp; exp = nxt) {
 			nxt = exp->m_next;
 			client_release(exp->m_client);
 			if (exp->m_export.e_squids)
@@ -240,7 +274,11 @@
 				free(exp->m_export.e_mountpoint);
 			xfree(exp);
 		}
-		exportlist[i] = NULL;
+      for(j = 0; j < HASH_TABLE_SIZE; j++) {
+        exportlist[i].entries[j].p_first = NULL;
+        exportlist[i].entries[j].p_last = NULL;
+      }
+      exportlist[i].p_head = NULL;
 	}
 	client_freeall();
 }
@@ -256,3 +294,30 @@
 		sizeof (exp->m_export.m_path) - 1);
 	exp->m_export.m_path[sizeof (exp->m_export.m_path) - 1] = '\0';
 }
+
+/*
+* hash table related functions.
+*/
+
+/*
+* compute and returns integers from string
+* Same values can be returned for different strings, but in this case it not important.
+*/
+unsigned int strtoint(char *str){
+  int i = 0;
+  unsigned int n = 0;
+  while ( str[i] != '\0') {
+    n+=((int)str[i])*i;
+    i++;
+  }
+  return n;
+}
+
+/*
+* represents hash function
+*/
+int hashint(unsigned int num){
+  return num % HASH_TABLE_SIZE;
+}
+
+
diff -rbu ../nfs-utils-1.0.7/support/export/xtab.c ./support/export/xtab.c
--- ../nfs-utils-1.0.7/support/export/xtab.c	2003-08-04 06:26:06.000000000 +0200
+++ ./support/export/xtab.c	2005-08-24 15:07:39.000000000 +0200
@@ -92,7 +92,7 @@
 	setexportent(xtabtmp, "w");
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (is_export && !exp->m_xtabent)
 				continue;
 			if (!is_export && ! exp->m_exported)
diff -rbu ../nfs-utils-1.0.7/support/include/exportfs.h ./support/include/exportfs.h
--- ../nfs-utils-1.0.7/support/include/exportfs.h	2004-09-15 03:58:40.000000000 +0200
+++ ./support/include/exportfs.h	2005-08-24 15:10:24.000000000 +0200
@@ -9,6 +9,8 @@
 #ifndef EXPORTFS_H
 #define EXPORTFS_H
 
+#define HASH_TABLE_SIZE 1021
+
 #include <netdb.h>
 #include "nfslib.h"
 
@@ -43,8 +45,18 @@
 				m_changed  : 1; /* options (may) have changed */
 } nfs_export;
 
+typedef struct m_hash_entry {
+  nfs_export * p_first;
+  nfs_export * p_last;
+} hash_entry;
+
+typedef struct m_hash_table {
+  nfs_export * p_head;
+  hash_entry entries[HASH_TABLE_SIZE];
+} hash_table;
+
 extern nfs_client *		clientlist[MCL_MAXTYPES];
-extern nfs_export *		exportlist[MCL_MAXTYPES];
+extern hash_table exportlist[MCL_MAXTYPES];
 
 nfs_client *			client_lookup(char *hname, int canonical);
 nfs_client *			client_find(struct hostent *);
diff -rbu ../nfs-utils-1.0.7/utils/exportfs/exportfs.c ./utils/exportfs/exportfs.c
--- ../nfs-utils-1.0.7/utils/exportfs/exportfs.c	2004-09-15 03:58:41.000000000 +0200
+++ ./utils/exportfs/exportfs.c	2005-08-24 15:11:48.000000000 +0200
@@ -189,10 +189,10 @@
 {
 	nfs_export 	*exp;
 
-	for (exp = exportlist[MCL_FQDN]; exp; exp=exp->m_next) {
+	for (exp = exportlist[MCL_FQDN].p_head; exp; exp=exp->m_next) {
 		exports_update_one(exp, verbose);
 	}
-	for (exp = exportlist[MCL_GSS]; exp; exp=exp->m_next) {
+	for (exp = exportlist[MCL_GSS].p_head; exp; exp=exp->m_next) {
 		exports_update_one(exp, verbose);
 	}
 }
@@ -208,7 +208,7 @@
 	int		i;
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (verbose)
 				printf("exporting %s:%s\n",
 				       exp->m_client->m_hostname, 
@@ -300,7 +300,7 @@
 		}
 	}
 
-	for (exp = exportlist[htype]; exp; exp = exp->m_next) {
+	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
 		if (path && strcmp(path, exp->m_export.e_path))
 			continue;
 		if (htype != exp->m_client->m_type)
@@ -357,7 +357,7 @@
 	char		*hname, c;
 
 	for (htype = 0; htype < MCL_MAXTYPES; htype++) {
-		for (exp = exportlist[htype]; exp; exp = exp->m_next) {
+		for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
 			ep = &exp->m_export;
 			if (!exp->m_xtabent)
 			    continue; /* neilb */
diff -rbu ../nfs-utils-1.0.7/utils/mountd/auth.c ./utils/mountd/auth.c
--- ../nfs-utils-1.0.7/utils/mountd/auth.c	2004-12-06 01:46:40.000000000 +0100
+++ ./utils/mountd/auth.c	2005-08-24 13:00:18.000000000 +0200
@@ -93,7 +93,7 @@
 
 		exp = NULL;
 		for (i = 0; !exp && i < MCL_MAXTYPES; i++) 
-			for (exp = exportlist[i]; exp; exp = exp->m_next) {
+			for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 				if (!client_member(my_client.m_hostname, exp->m_client->m_hostname))
 					continue;
 				if (strcmp(path, exp->m_export.e_path))
diff -rbu ../nfs-utils-1.0.7/utils/mountd/cache.c ./utils/mountd/cache.c
--- ../nfs-utils-1.0.7/utils/mountd/cache.c	2004-08-31 08:37:21.000000000 +0200
+++ ./utils/mountd/cache.c	2005-08-24 13:00:18.000000000 +0200
@@ -144,7 +144,7 @@
 
 	/* Now determine export point for this fsid/domain */
 	for (i=0 ; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (!client_member(dom, exp->m_client->m_hostname))
 				continue;
 			if (fsidtype == 1 &&
@@ -244,7 +244,7 @@
 
 	/* now find flags for this export point in this domain */
 	for (i=0 ; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			if (!client_member(dom, exp->m_client->m_hostname))
 				continue;
 			if (strcmp(path, exp->m_export.e_path))
diff -rbu ../nfs-utils-1.0.7/utils/mountd/mountd.c ./utils/mountd/mountd.c
--- ../nfs-utils-1.0.7/utils/mountd/mountd.c	2005-07-05 15:02:09.000000000 +0200
+++ ./utils/mountd/mountd.c	2005-08-24 13:00:18.000000000 +0200
@@ -375,7 +375,7 @@
 	elist = NULL;
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
-		for (exp = exportlist[i]; exp; exp = exp->m_next) {
+		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
 			for (e = elist; e != NULL; e = e->ex_next) {
 				if (!strcmp(exp->m_export.m_path, e->ex_dir))
 					break;

