revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / fs / reiser4 / plugin / space / space_allocator.h
blob5bfa9a3eb192d05e89a43590a06540655ec46745
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"
7 #include "bitmap.h"
8 /* NIKITA-FIXME-HANS: surely this could use a comment. Something about how bitmap is the only space allocator for now,
9 * but... */
10 #define DEF_SPACE_ALLOCATOR(allocator) \
12 static inline int sa_init_allocator (reiser4_space_allocator * al, struct super_block *s, void * opaque) \
13 { \
14 return reiser4_init_allocator_##allocator (al, s, opaque); \
15 } \
17 static inline void sa_destroy_allocator (reiser4_space_allocator *al, struct super_block *s) \
18 { \
19 reiser4_destroy_allocator_##allocator (al, s); \
20 } \
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) \
24 { \
25 return reiser4_alloc_blocks_##allocator (al, hint, needed, start, len); \
26 } \
27 static inline void sa_dealloc_blocks (reiser4_space_allocator * al, reiser4_block_nr start, reiser4_block_nr len) \
28 { \
29 reiser4_dealloc_blocks_##allocator (al, start, len); \
30 } \
32 static inline void sa_check_blocks (const reiser4_block_nr * start, const reiser4_block_nr * end, int desired) \
33 { \
34 reiser4_check_blocks_##allocator (start, end, desired); \
35 } \
37 static inline void sa_pre_commit_hook (void) \
38 { \
39 reiser4_pre_commit_hook_##allocator (); \
40 } \
42 static inline void sa_post_commit_hook (void) \
43 { \
44 reiser4_post_commit_hook_##allocator (); \
45 } \
47 static inline void sa_post_write_back_hook (void) \
48 { \
49 reiser4_post_write_back_hook_##allocator(); \
50 } \
52 static inline void sa_print_info(const char * prefix, reiser4_space_allocator * al) \
53 { \
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 {
61 union {
62 /* space allocators might use this pointer to reference their
63 * data. */
64 void *generic;
65 } u;
68 /* __SPACE_ALLOCATOR_H__ */
69 #endif
71 /* Make Linus happy.
72 Local variables:
73 c-indentation-style: "K&R"
74 mode-name: "LC"
75 c-basic-offset: 8
76 tab-width: 8
77 fill-column: 120
78 scroll-step: 1
79 End: