diff options
Diffstat (limited to 'fs/gfs2/recovery.c')
-rw-r--r-- | fs/gfs2/recovery.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 62cd223819b7..d0c806b85c86 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -132,10 +132,11 @@ void gfs2_revoke_clean(struct gfs2_sbd *sdp) | |||
132 | */ | 132 | */ |
133 | 133 | ||
134 | static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, | 134 | static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, |
135 | struct gfs2_log_header *head) | 135 | struct gfs2_log_header_host *head) |
136 | { | 136 | { |
137 | struct buffer_head *bh; | 137 | struct buffer_head *bh; |
138 | struct gfs2_log_header lh; | 138 | struct gfs2_log_header_host lh; |
139 | const u32 nothing = 0; | ||
139 | u32 hash; | 140 | u32 hash; |
140 | int error; | 141 | int error; |
141 | 142 | ||
@@ -143,11 +144,11 @@ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, | |||
143 | if (error) | 144 | if (error) |
144 | return error; | 145 | return error; |
145 | 146 | ||
146 | memcpy(&lh, bh->b_data, sizeof(struct gfs2_log_header)); | 147 | hash = crc32_le((u32)~0, bh->b_data, sizeof(struct gfs2_log_header) - |
147 | lh.lh_hash = 0; | 148 | sizeof(u32)); |
148 | hash = gfs2_disk_hash((char *)&lh, sizeof(struct gfs2_log_header)); | 149 | hash = crc32_le(hash, (unsigned char const *)¬hing, sizeof(nothing)); |
150 | hash ^= (u32)~0; | ||
149 | gfs2_log_header_in(&lh, bh->b_data); | 151 | gfs2_log_header_in(&lh, bh->b_data); |
150 | |||
151 | brelse(bh); | 152 | brelse(bh); |
152 | 153 | ||
153 | if (lh.lh_header.mh_magic != GFS2_MAGIC || | 154 | if (lh.lh_header.mh_magic != GFS2_MAGIC || |
@@ -174,7 +175,7 @@ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, | |||
174 | */ | 175 | */ |
175 | 176 | ||
176 | static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, | 177 | static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, |
177 | struct gfs2_log_header *head) | 178 | struct gfs2_log_header_host *head) |
178 | { | 179 | { |
179 | unsigned int orig_blk = *blk; | 180 | unsigned int orig_blk = *blk; |
180 | int error; | 181 | int error; |
@@ -205,10 +206,10 @@ static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, | |||
205 | * Returns: errno | 206 | * Returns: errno |
206 | */ | 207 | */ |
207 | 208 | ||
208 | static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | 209 | static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) |
209 | { | 210 | { |
210 | unsigned int blk = head->lh_blkno; | 211 | unsigned int blk = head->lh_blkno; |
211 | struct gfs2_log_header lh; | 212 | struct gfs2_log_header_host lh; |
212 | int error; | 213 | int error; |
213 | 214 | ||
214 | for (;;) { | 215 | for (;;) { |
@@ -245,9 +246,9 @@ static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | |||
245 | * Returns: errno | 246 | * Returns: errno |
246 | */ | 247 | */ |
247 | 248 | ||
248 | int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | 249 | int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) |
249 | { | 250 | { |
250 | struct gfs2_log_header lh_1, lh_m; | 251 | struct gfs2_log_header_host lh_1, lh_m; |
251 | u32 blk_1, blk_2, blk_m; | 252 | u32 blk_1, blk_2, blk_m; |
252 | int error; | 253 | int error; |
253 | 254 | ||
@@ -320,7 +321,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, | |||
320 | length = be32_to_cpu(ld->ld_length); | 321 | length = be32_to_cpu(ld->ld_length); |
321 | 322 | ||
322 | if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) { | 323 | if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) { |
323 | struct gfs2_log_header lh; | 324 | struct gfs2_log_header_host lh; |
324 | error = get_log_header(jd, start, &lh); | 325 | error = get_log_header(jd, start, &lh); |
325 | if (!error) { | 326 | if (!error) { |
326 | gfs2_replay_incr_blk(sdp, &start); | 327 | gfs2_replay_incr_blk(sdp, &start); |
@@ -363,7 +364,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, | |||
363 | * Returns: errno | 364 | * Returns: errno |
364 | */ | 365 | */ |
365 | 366 | ||
366 | static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | 367 | static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) |
367 | { | 368 | { |
368 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); | 369 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); |
369 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | 370 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); |
@@ -425,7 +426,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) | |||
425 | { | 426 | { |
426 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); | 427 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); |
427 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | 428 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); |
428 | struct gfs2_log_header head; | 429 | struct gfs2_log_header_host head; |
429 | struct gfs2_holder j_gh, ji_gh, t_gh; | 430 | struct gfs2_holder j_gh, ji_gh, t_gh; |
430 | unsigned long t; | 431 | unsigned long t; |
431 | int ro = 0; | 432 | int ro = 0; |