#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/sysincludes.h"
#include "afsincludes.h"
-#include "h/mm.h"
-#include "h/slab.h"
+#include <linux/mm.h>
+#include <linux/slab.h>
#include "afs_atomlist.h"
#include "afs_lhash.h"
struct afs_lhash_stat afs_linux_lsb; /* hash table statistics */
unsigned int afs_linux_hash_bucket_dist[MAX_BUCKET_LEN]; /* bucket population distribution in our hash table */
-#if defined(AFS_LINUX24_ENV)
-#include "h/vmalloc.h"
-#else
-/* externs : can we do this in a better way. Including vmalloc.h causes other
- * problems.*/
-extern void vfree(void *addr);
-extern void *vmalloc(unsigned long size);
-#endif
+#include <linux/vmalloc.h>
/* Allocator support functions (static) */
/* if we can use kmalloc use it to allocate the required memory. */
while (!new && max_retry) {
if (asize <= MAX_KMALLOC_SIZE) {
- new = (void *)(unsigned long)kmalloc(asize,
-#ifdef GFP_NOFS
- GFP_NOFS
-#else
- GFP_KERNEL
-#endif
- );
+ new = (void *)(unsigned long)kmalloc(asize, GFP_NOFS);
if (new) /* piggy back alloc type */
new = (void *)(KM_TYPE | (unsigned long)new);
} else {
+ osi_Assert(drop_glock || !haveGlock);
+ if (drop_glock && haveGlock)
+ AFS_GUNLOCK();
new = (void *)vmalloc(asize);
+ if (drop_glock && haveGlock)
+ AFS_GLOCK();
if (new) /* piggy back alloc type */
new = (void *)(VM_TYPE | (unsigned long)new);
}
* 1 - success
*/
static int
-linux_alloc_init()
+linux_alloc_init(void)
{
/* initiate our pool of osi_linux_mem structs */
al_mem_pool =
/* get_hash_stats() : get hash table statistics */
static void
-get_hash_stats()
+get_hash_stats(void)
{
int i;
/************** Linux memory allocator interface functions **********/
-#if defined(AFS_LINUX24_ENV)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-DEFINE_MUTEX(afs_linux_alloc_sem);
-#else
DECLARE_MUTEX(afs_linux_alloc_sem);
-#endif
-#else
-struct semaphore afs_linux_alloc_sem = MUTEX;
-#endif
void *
osi_linux_alloc(unsigned int asize, int drop_glock)
afs_atomlist_put(al_mem_pool, lmp); /* return osi_linux_mem struct to pool */
afs_linux_cur_allocs--;
} else {
+ BUG();
printf("osi_linux_free: failed to remove chunk from hashtable\n");
}