Commit 4f096985 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] Improved allocator for NTFS

Originally by Anton Altaparmakov.
I think Anton is going to submit his rewritten NTFS soon making this null and void,
but in the interim, it fixes a known problem with NTFS and large allocations.
parent 3cbdf133
......@@ -5,7 +5,7 @@ O_TARGET := ntfs.o
obj-y := fs.o sysctl.o support.o util.o inode.o dir.o super.o attr.o unistr.o
obj-m := $(O_TARGET)
# New version format started 3 February 2001.
EXTRA_CFLAGS = -DNTFS_VERSION=\"1.1.21\" #-DDEBUG
EXTRA_CFLAGS = -DNTFS_VERSION=\"1.1.22\" #-DDEBUG
include $(TOPDIR)/Rules.make
......@@ -32,9 +32,39 @@ void ntfs_debug(int mask, const char *fmt, ...);
#define ntfs_free(ptr) kfree(ptr)
#define ntfs_vmalloc(size) vmalloc_32(size)
#define ntfs_vfree(ptr) vfree(ptr)
/**
* ntfs_vmalloc - allocate memory in multiples of pages
* @size number of bytes to allocate
*
* Allocates @size bytes of memory, rounded up to multiples of PAGE_SIZE and
* returns a pointer to the allocated memory.
*
* If there was insufficient memory to complete the request, return NULL.
*/
static inline void *ntfs_vmalloc(unsigned long size)
{
if (size <= PAGE_SIZE) {
if (size) {
/* kmalloc() has per-CPU caches so if faster for now. */
return kmalloc(PAGE_SIZE, GFP_NOFS);
/* return (void *)__get_free_page(GFP_NOFS |
__GFP_HIGHMEM); */
}
BUG();
}
if (size >> PAGE_SHIFT < num_physpages)
return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
return NULL;
}
static inline void ntfs_vfree(void *addr)
{
if ((unsigned long)addr < VMALLOC_START) {
return kfree(addr);
/* return free_page((unsigned long)addr); */
}
vfree(addr);
}
void ntfs_bzero(void *s, int n);
......
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