Commit e7a4aa05 authored by Nathan Scott's avatar Nathan Scott Committed by Christoph Hellwig

[XFS] Use kmalloc/kfree for all xattr memory allocations.

SGI Modid: 2.5.x-xfs:slinx:133355a
parent cd9e854d
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/xattr.h> #include <linux/xattr.h>
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
/* /*
* Extended attribute memory allocation wrappers, originally * Extended attribute memory allocation wrappers, originally
* based on the Intermezzo PRESTO_ALLOC/PRESTO_FREE macros. * based on the Intermezzo PRESTO_ALLOC/PRESTO_FREE macros.
* The vmalloc use here is very uncommon - extended attributes * Values larger than a page are uncommon - extended attributes
* are supposed to be small chunks of metadata, and it is quite * are supposed to be small chunks of metadata, and it is quite
* unusual to have very many extended attributes, so lists tend * unusual to have very many extended attributes, so lists tend
* to be quite short as well. The 64K upper limit is derived * to be quite short as well. The 64K upper limit is derived
...@@ -35,10 +34,8 @@ xattr_alloc(size_t size, size_t limit) ...@@ -35,10 +34,8 @@ xattr_alloc(size_t size, size_t limit)
if (!size) /* size request, no buffer is needed */ if (!size) /* size request, no buffer is needed */
return NULL; return NULL;
else if (size <= PAGE_SIZE)
ptr = kmalloc((unsigned long) size, GFP_KERNEL); ptr = kmalloc((unsigned long) size, GFP_KERNEL);
else
ptr = vmalloc((unsigned long) size);
if (!ptr) if (!ptr)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
return ptr; return ptr;
...@@ -47,12 +44,8 @@ xattr_alloc(size_t size, size_t limit) ...@@ -47,12 +44,8 @@ xattr_alloc(size_t size, size_t limit)
static void static void
xattr_free(void *ptr, size_t size) xattr_free(void *ptr, size_t size)
{ {
if (!size) /* size request, no buffer was needed */ if (size) /* for a size request, no buffer was needed */
return;
else if (size <= PAGE_SIZE)
kfree(ptr); kfree(ptr);
else
vfree(ptr);
} }
/* /*
......
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