revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / fs / reiser4 / plugin / node / node40.h
blob8ae375b583dbc3ecc635a3e8637f3a8628986368
1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 #if !defined( __REISER4_NODE40_H__ )
4 #define __REISER4_NODE40_H__
6 #include "../../forward.h"
7 #include "../../dformat.h"
8 #include "node.h"
10 #include <linux/types.h>
12 /* format of node header for 40 node layouts. Keep bloat out of this struct. */
13 typedef struct node40_header {
14 /* identifier of node plugin. Must be located at the very beginning
15 of a node. */
16 common_node_header common_header; /* this is 16 bits */
17 /* number of items. Should be first element in the node header,
18 because we haven't yet finally decided whether it shouldn't go into
19 common_header.
21 /* NIKITA-FIXME-HANS: Create a macro such that if there is only one
22 * node format at compile time, and it is this one, accesses do not function dereference when
23 * accessing these fields (and otherwise they do). Probably 80% of users will only have one node format at a time throughout the life of reiser4. */
24 d16 nr_items;
25 /* free space in node measured in bytes */
26 d16 free_space;
27 /* offset to start of free space in node */
28 d16 free_space_start;
29 /* for reiser4_fsck. When information about what is a free
30 block is corrupted, and we try to recover everything even
31 if marked as freed, then old versions of data may
32 duplicate newer versions, and this field allows us to
33 restore the newer version. Also useful for when users
34 who don't have the new trashcan installed on their linux distro
35 delete the wrong files and send us desperate emails
36 offering $25 for them back. */
38 /* magic field we need to tell formatted nodes NIKITA-FIXME-HANS: improve this comment */
39 d32 magic;
40 /* flushstamp is made of mk_id and write_counter. mk_id is an
41 id generated randomly at mkreiserfs time. So we can just
42 skip all nodes with different mk_id. write_counter is d64
43 incrementing counter of writes on disk. It is used for
44 choosing the newest data at fsck time. NIKITA-FIXME-HANS: why was field name changed but not comment? */
46 d32 mkfs_id;
47 d64 flush_id;
48 /* node flags to be used by fsck (reiser4ck or reiser4fsck?)
49 and repacker NIKITA-FIXME-HANS: say more or reference elsewhere that says more */
50 d16 flags;
52 /* 1 is leaf level, 2 is twig level, root is the numerically
53 largest level */
54 d8 level;
56 d8 pad;
57 } PACKED node40_header;
59 /* item headers are not standard across all node layouts, pass
60 pos_in_node to functions instead */
61 typedef struct item_header40 {
62 /* key of item */
63 /* 0 */ reiser4_key key;
64 /* offset from start of a node measured in 8-byte chunks */
65 /* 24 */ d16 offset;
66 /* 26 */ d16 flags;
67 /* 28 */ d16 plugin_id;
68 } PACKED item_header40;
70 size_t item_overhead_node40(const znode * node, flow_t * aflow);
71 size_t free_space_node40(znode * node);
72 node_search_result lookup_node40(znode * node, const reiser4_key * key,
73 lookup_bias bias, coord_t * coord);
74 int num_of_items_node40(const znode * node);
75 char *item_by_coord_node40(const coord_t * coord);
76 int length_by_coord_node40(const coord_t * coord);
77 item_plugin *plugin_by_coord_node40(const coord_t * coord);
78 reiser4_key *key_at_node40(const coord_t * coord, reiser4_key * key);
79 size_t estimate_node40(znode * node);
80 int check_node40(const znode * node, __u32 flags, const char **error);
81 int parse_node40(znode * node);
82 int init_node40(znode * node);
83 #ifdef GUESS_EXISTS
84 int guess_node40(const znode * node);
85 #endif
86 void change_item_size_node40(coord_t * coord, int by);
87 int create_item_node40(coord_t * target, const reiser4_key * key,
88 reiser4_item_data * data, carry_plugin_info * info);
89 void update_item_key_node40(coord_t * target, const reiser4_key * key,
90 carry_plugin_info * info);
91 int kill_node40(struct carry_kill_data *, carry_plugin_info *);
92 int cut_node40(struct carry_cut_data *, carry_plugin_info *);
93 int shift_node40(coord_t * from, znode * to, shift_direction pend,
94 /* if @from->node becomes
95 empty - it will be deleted from
96 the tree if this is set to 1
98 int delete_child, int including_stop_coord,
99 carry_plugin_info * info);
101 int fast_insert_node40(const coord_t * coord);
102 int fast_paste_node40(const coord_t * coord);
103 int fast_cut_node40(const coord_t * coord);
104 int max_item_size_node40(void);
105 int prepare_removal_node40(znode * empty, carry_plugin_info * info);
106 int set_item_plugin_node40(coord_t * coord, item_id id);
107 int shrink_item_node40(coord_t * coord, int delta);
109 #if REISER4_DEBUG
110 void *shift_check_prepare(const znode *left, const znode *right);
111 void shift_check(void *vp, const znode *left, const znode *right);
112 #endif
114 /* __REISER4_NODE40_H__ */
115 #endif
117 Local variables:
118 c-indentation-style: "K&R"
119 mode-name: "LC"
120 c-basic-offset: 8
121 tab-width: 8
122 fill-column: 120
123 scroll-step: 1
124 End: