1 /* PR rtl-optimization/45593 */
2 /* Testcase by Arnaud Lacombe <lacombar@gmail.com> */
4 typedef unsigned int __u32
;
6 static inline __attribute__((always_inline
)) int __attribute__((__cold__
)) printk(const char *s
, ...) { return 0; }
7 typedef struct journal_s journal_t
;
8 typedef struct journal_header_s
14 typedef struct journal_superblock_s
16 journal_header_t s_header
;
19 } journal_superblock_t
;
22 struct buffer_head
*j_sb_buffer
;
23 journal_superblock_t
*j_superblock
;
26 unsigned int j_maxlen
;
28 static void journal_fail_superblock (journal_t
*journal
)
30 journal
->j_sb_buffer
= ((void *)0);
32 static int journal_get_superblock(journal_t
*journal
)
34 struct buffer_head
*bh
;
35 journal_superblock_t
*sb
;
37 bh
= journal
->j_sb_buffer
;
38 if (!buffer_uptodate(bh
)) {
39 if (!buffer_uptodate(bh
)) {
40 printk ("JBD: IO error reading journal superblock\n");
45 if (sb
->s_header
.h_magic
!= (( __be32
)(__u32
)(0)) ||
46 sb
->s_blocksize
!= (( __be32
)(__u32
)(journal
->j_blocksize
))) {
47 printk("JBD: no valid journal superblock found\n");
50 switch((( __u32
)(__be32
)(sb
->s_header
.h_blocktype
))) {
57 if ((( __u32
)(__be32
)(sb
->s_maxlen
)) < journal
->j_maxlen
)
58 journal
->j_maxlen
= (( __u32
)(__be32
)(sb
->s_maxlen
));
59 else if ((( __u32
)(__be32
)(sb
->s_maxlen
)) > journal
->j_maxlen
) {
60 printk ("JBD: journal file too short\n");
65 journal_fail_superblock(journal
);
68 static int load_superblock(journal_t
*journal
)
70 journal_get_superblock(journal
);
73 int jbd2_journal_update_format (journal_t
*journal
)
75 journal_get_superblock(journal
);
78 int jbd2_journal_wipe(journal_t
*journal
, int write
)
80 load_superblock(journal
);