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__
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
;
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 */
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
45 /* number of used OIDs and maximal used OID are logged separately from
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
];
61 /* total number of wander records in current transaction */
64 /* this block number in transaction */
67 /* number of previous block in commit */
71 /* The first wander record (transaction head) of written transaction has the
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
];
81 /* total number of records (including this first tx head) in the
85 /* align next field to 8-byte boundary; this field always is zero */
88 /* block number of previous transaction head */
91 /* next wander record location */
94 /* committed versions of free blocks counter */
97 /* number of used OIDs (nr_files) and maximal used OID are logged
98 separately from super block */
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
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__ */
128 c-indentation-style: "K&R"