1 /* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 #ifndef __SPACE_ALLOCATOR_H__
4 #define __SPACE_ALLOCATOR_H__
6 #include "../../forward.h"
8 /* NIKITA-FIXME-HANS: surely this could use a comment. Something about how bitmap is the only space allocator for now,
10 #define DEF_SPACE_ALLOCATOR(allocator) \
12 static inline int sa_init_allocator (reiser4_space_allocator * al, struct super_block *s, void * opaque) \
14 return reiser4_init_allocator_##allocator (al, s, opaque); \
17 static inline void sa_destroy_allocator (reiser4_space_allocator *al, struct super_block *s) \
19 reiser4_destroy_allocator_##allocator (al, s); \
22 static inline int sa_alloc_blocks (reiser4_space_allocator *al, reiser4_blocknr_hint * hint, \
23 int needed, reiser4_block_nr * start, reiser4_block_nr * len) \
25 return reiser4_alloc_blocks_##allocator (al, hint, needed, start, len); \
27 static inline void sa_dealloc_blocks (reiser4_space_allocator * al, reiser4_block_nr start, reiser4_block_nr len) \
29 reiser4_dealloc_blocks_##allocator (al, start, len); \
32 static inline void sa_check_blocks (const reiser4_block_nr * start, const reiser4_block_nr * end, int desired) \
34 reiser4_check_blocks_##allocator (start, end, desired); \
37 static inline void sa_pre_commit_hook (void) \
39 reiser4_pre_commit_hook_##allocator (); \
42 static inline void sa_post_commit_hook (void) \
44 reiser4_post_commit_hook_##allocator (); \
47 static inline void sa_post_write_back_hook (void) \
49 reiser4_post_write_back_hook_##allocator(); \
52 static inline void sa_print_info(const char * prefix, reiser4_space_allocator * al) \
54 reiser4_print_info_##allocator (prefix, al); \
57 DEF_SPACE_ALLOCATOR(bitmap
)
59 /* this object is part of reiser4 private in-core super block */
60 struct reiser4_space_allocator
{
62 /* space allocators might use this pointer to reference their
68 /* __SPACE_ALLOCATOR_H__ */
73 c-indentation-style: "K&R"