mm-only debug patch...
[mmotm.git] / fs / reiser4 / wander.h
blob8746710b66be63f1db7017eabf6cff0f37644429
1 /* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 #if !defined (__FS_REISER4_WANDER_H__)
4 #define __FS_REISER4_WANDER_H__
6 #include "dformat.h"
8 #include <linux/fs.h> /* for struct super_block */
10 /* REISER4 JOURNAL ON-DISK DATA STRUCTURES */
12 #define TX_HEADER_MAGIC "TxMagic4"
13 #define WANDER_RECORD_MAGIC "LogMagc4"
15 #define TX_HEADER_MAGIC_SIZE (8)
16 #define WANDER_RECORD_MAGIC_SIZE (8)
18 /* journal header block format */
19 struct journal_header {
20 /* last written transaction head location */
21 d64 last_committed_tx;
24 typedef struct journal_location {
25 reiser4_block_nr footer;
26 reiser4_block_nr header;
27 } journal_location;
29 /* The wander.c head comment describes usage and semantic of all these structures */
30 /* journal footer block format */
31 struct journal_footer {
32 /* last flushed transaction location. */
33 /* This block number is no more valid after the transaction it points
34 to gets flushed, this number is used only at journal replaying time
35 for detection of the end of on-disk list of committed transactions
36 which were not flushed completely */
37 d64 last_flushed_tx;
39 /* free block counter is written in journal footer at transaction
40 flushing , not in super block because free blocks counter is logged
41 by another way than super block fields (root pointer, for
42 example). */
43 d64 free_blocks;
45 /* number of used OIDs and maximal used OID are logged separately from
46 super block */
47 d64 nr_files;
48 d64 next_oid;
51 /* Each wander record (except the first one) has unified format with wander
52 record header followed by an array of log entries */
53 struct wander_record_header {
54 /* when there is no predefined location for wander records, this magic
55 string should help reiser4fsck. */
56 char magic[WANDER_RECORD_MAGIC_SIZE];
58 /* transaction id */
59 d64 id;
61 /* total number of wander records in current transaction */
62 d32 total;
64 /* this block number in transaction */
65 d32 serial;
67 /* number of previous block in commit */
68 d64 next_block;
71 /* The first wander record (transaction head) of written transaction has the
72 special format */
73 struct tx_header {
74 /* magic string makes first block in transaction different from other
75 logged blocks, it should help fsck. */
76 char magic[TX_HEADER_MAGIC_SIZE];
78 /* transaction id */
79 d64 id;
81 /* total number of records (including this first tx head) in the
82 transaction */
83 d32 total;
85 /* align next field to 8-byte boundary; this field always is zero */
86 d32 padding;
88 /* block number of previous transaction head */
89 d64 prev_tx;
91 /* next wander record location */
92 d64 next_block;
94 /* committed versions of free blocks counter */
95 d64 free_blocks;
97 /* number of used OIDs (nr_files) and maximal used OID are logged
98 separately from super block */
99 d64 nr_files;
100 d64 next_oid;
103 /* A transaction gets written to disk as a set of wander records (each wander
104 record size is fs block) */
106 /* As it was told above a wander The rest of wander record is filled by these log entries, unused space filled
107 by zeroes */
108 struct wander_entry {
109 d64 original; /* block original location */
110 d64 wandered; /* block wandered location */
113 /* REISER4 JOURNAL WRITER FUNCTIONS */
115 extern int reiser4_write_logs(long *);
116 extern int reiser4_journal_replay(struct super_block *);
117 extern int reiser4_journal_recover_sb_data(struct super_block *);
119 extern int reiser4_init_journal_info(struct super_block *);
120 extern void reiser4_done_journal_info(struct super_block *);
122 extern int write_jnode_list(struct list_head *, flush_queue_t *, long *, int);
124 #endif /* __FS_REISER4_WANDER_H__ */
126 /* Make Linus happy.
127 Local variables:
128 c-indentation-style: "K&R"
129 mode-name: "LC"
130 c-basic-offset: 8
131 tab-width: 8
132 fill-column: 80
133 scroll-step: 1
134 End: