*/
enum cfs_alloc_flags {
/* allocation is not allowed to block */
- CFS_ALLOC_ATOMIC = (1 << 0),
+ CFS_ALLOC_ATOMIC = 0x1,
/* allocation is allowed to block */
- CFS_ALLOC_WAIT = (1 << 1),
+ CFS_ALLOC_WAIT = 0x2,
/* allocation should return zeroed memory */
- CFS_ALLOC_ZERO = (1 << 2),
+ CFS_ALLOC_ZERO = 0x4,
/* allocation is allowed to call file-system code to free/clean
* memory */
- CFS_ALLOC_FS = (1 << 3),
+ CFS_ALLOC_FS = 0x8,
/* allocation is allowed to do io to free/clean memory */
- CFS_ALLOC_IO = (1 << 4),
+ CFS_ALLOC_IO = 0x10,
/* don't report allocation failure to the console */
- CFS_ALLOC_NOWARN = (1 << 5),
+ CFS_ALLOC_NOWARN = 0x20,
/* standard allocator flag combination */
CFS_ALLOC_STD = CFS_ALLOC_FS | CFS_ALLOC_IO,
CFS_ALLOC_USER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO,
enum cfs_alloc_page_flags {
/* allow to return page beyond KVM. It has to be mapped into KVM by
* cfs_page_map(); */
- CFS_ALLOC_HIGH = (1 << 5),
+ CFS_ALLOC_HIGH = 0x40,
CFS_ALLOC_HIGHUSER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO | CFS_ALLOC_HIGH,
};
#define CFS_PAGE_SHIFT PAGE_CACHE_SHIFT
#define CFS_PAGE_MASK (~((__u64)CFS_PAGE_SIZE-1))
-cfs_page_t *cfs_alloc_page(unsigned int flags);
-#define cfs_free_page(p) __free_pages(p, 0)
-
static inline void *cfs_page_address(cfs_page_t *page)
{
/*
extern void *cfs_alloc_large(size_t nr_bytes);
extern void cfs_free_large(void *addr);
+extern cfs_page_t *cfs_alloc_pages(unsigned int flags, unsigned int order);
+extern void __cfs_free_pages(cfs_page_t *page, unsigned int order);
+
+#define cfs_alloc_page(flags) cfs_alloc_pages(flags, 0)
+#define __cfs_free_page(page) __cfs_free_pages(page, 0)
+#define cfs_free_page(p) __free_pages(p, 0)
+
/*
* In Linux there is no way to determine whether current execution context is
* blockable.
#endif
if (flags & CFS_ALLOC_FS)
mflags |= __GFP_FS;
+ if (flags & CFS_ALLOC_HIGH)
+ mflags |= __GFP_HIGH;
return mflags;
}
vfree(addr);
}
-cfs_page_t *cfs_alloc_page(unsigned int flags)
+cfs_page_t *cfs_alloc_pages(unsigned int flags, unsigned int order)
{
/*
* XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
* from here: this will lead to infinite recursion.
*/
- return alloc_pages(cfs_alloc_flags_to_gfp(flags), 0);
+ return alloc_pages(cfs_alloc_flags_to_gfp(flags), order);
+}
+
+void __cfs_free_pages(cfs_page_t *page, unsigned int order)
+{
+ __free_pages(page, order);
}
cfs_mem_cache_t *
EXPORT_SYMBOL(cfs_free);
EXPORT_SYMBOL(cfs_alloc_large);
EXPORT_SYMBOL(cfs_free_large);
-EXPORT_SYMBOL(cfs_alloc_page);
+EXPORT_SYMBOL(cfs_alloc_pages);
+EXPORT_SYMBOL(__cfs_free_pages);
EXPORT_SYMBOL(cfs_mem_cache_create);
EXPORT_SYMBOL(cfs_mem_cache_destroy);
EXPORT_SYMBOL(cfs_mem_cache_alloc);