diff options
Diffstat (limited to 'fs/gfs2/recovery.c')
-rw-r--r-- | fs/gfs2/recovery.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index e5f2b284fa54..2df450e2f433 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -12,9 +12,12 @@ | |||
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/gfs2_ondisk.h> | ||
15 | #include <asm/semaphore.h> | 16 | #include <asm/semaphore.h> |
16 | 17 | ||
17 | #include "gfs2.h" | 18 | #include "gfs2.h" |
19 | #include "lm_interface.h" | ||
20 | #include "incore.h" | ||
18 | #include "bmap.h" | 21 | #include "bmap.h" |
19 | #include "glock.h" | 22 | #include "glock.h" |
20 | #include "glops.h" | 23 | #include "glops.h" |
@@ -23,22 +26,24 @@ | |||
23 | #include "meta_io.h" | 26 | #include "meta_io.h" |
24 | #include "recovery.h" | 27 | #include "recovery.h" |
25 | #include "super.h" | 28 | #include "super.h" |
29 | #include "util.h" | ||
26 | 30 | ||
27 | int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, | 31 | int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, |
28 | struct buffer_head **bh) | 32 | struct buffer_head **bh) |
29 | { | 33 | { |
30 | struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; | 34 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
35 | struct gfs2_glock *gl = ip->i_gl; | ||
31 | int new = 0; | 36 | int new = 0; |
32 | uint64_t dblock; | 37 | uint64_t dblock; |
33 | uint32_t extlen; | 38 | uint32_t extlen; |
34 | int error; | 39 | int error; |
35 | 40 | ||
36 | error = gfs2_block_map(get_v2ip(jd->jd_inode), blk, &new, &dblock, | 41 | error = gfs2_block_map(ip, blk, &new, &dblock, |
37 | &extlen); | 42 | &extlen); |
38 | if (error) | 43 | if (error) |
39 | return error; | 44 | return error; |
40 | if (!dblock) { | 45 | if (!dblock) { |
41 | gfs2_consist_inode(get_v2ip(jd->jd_inode)); | 46 | gfs2_consist_inode(ip); |
42 | return -EIO; | 47 | return -EIO; |
43 | } | 48 | } |
44 | 49 | ||
@@ -185,7 +190,7 @@ static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, | |||
185 | *blk = 0; | 190 | *blk = 0; |
186 | 191 | ||
187 | if (*blk == orig_blk) { | 192 | if (*blk == orig_blk) { |
188 | gfs2_consist_inode(get_v2ip(jd->jd_inode)); | 193 | gfs2_consist_inode(jd->jd_inode->u.generic_ip); |
189 | return -EIO; | 194 | return -EIO; |
190 | } | 195 | } |
191 | } | 196 | } |
@@ -219,7 +224,7 @@ static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | |||
219 | continue; | 224 | continue; |
220 | 225 | ||
221 | if (lh.lh_sequence == head->lh_sequence) { | 226 | if (lh.lh_sequence == head->lh_sequence) { |
222 | gfs2_consist_inode(get_v2ip(jd->jd_inode)); | 227 | gfs2_consist_inode(jd->jd_inode->u.generic_ip); |
223 | return -EIO; | 228 | return -EIO; |
224 | } | 229 | } |
225 | if (lh.lh_sequence < head->lh_sequence) | 230 | if (lh.lh_sequence < head->lh_sequence) |
@@ -295,7 +300,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | |||
295 | static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, | 300 | static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, |
296 | unsigned int end, int pass) | 301 | unsigned int end, int pass) |
297 | { | 302 | { |
298 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 303 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
304 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
299 | struct buffer_head *bh; | 305 | struct buffer_head *bh; |
300 | struct gfs2_log_descriptor *ld; | 306 | struct gfs2_log_descriptor *ld; |
301 | int error = 0; | 307 | int error = 0; |
@@ -324,7 +330,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, | |||
324 | continue; | 330 | continue; |
325 | } | 331 | } |
326 | if (error == 1) { | 332 | if (error == 1) { |
327 | gfs2_consist_inode(get_v2ip(jd->jd_inode)); | 333 | gfs2_consist_inode(jd->jd_inode->u.generic_ip); |
328 | error = -EIO; | 334 | error = -EIO; |
329 | } | 335 | } |
330 | brelse(bh); | 336 | brelse(bh); |
@@ -361,7 +367,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, | |||
361 | 367 | ||
362 | static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | 368 | static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) |
363 | { | 369 | { |
364 | struct gfs2_inode *ip = get_v2ip(jd->jd_inode); | 370 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
365 | struct gfs2_sbd *sdp = ip->i_sbd; | 371 | struct gfs2_sbd *sdp = ip->i_sbd; |
366 | unsigned int lblock; | 372 | unsigned int lblock; |
367 | int new = 0; | 373 | int new = 0; |
@@ -420,7 +426,8 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | |||
420 | 426 | ||
421 | int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait) | 427 | int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait) |
422 | { | 428 | { |
423 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 429 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
430 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
424 | struct gfs2_log_header head; | 431 | struct gfs2_log_header head; |
425 | struct gfs2_holder j_gh, ji_gh, t_gh; | 432 | struct gfs2_holder j_gh, ji_gh, t_gh; |
426 | unsigned long t; | 433 | unsigned long t; |
@@ -450,7 +457,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait) | |||
450 | goto fail; | 457 | goto fail; |
451 | }; | 458 | }; |
452 | 459 | ||
453 | error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl, LM_ST_SHARED, | 460 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, |
454 | LM_FLAG_NOEXP, &ji_gh); | 461 | LM_FLAG_NOEXP, &ji_gh); |
455 | if (error) | 462 | if (error) |
456 | goto fail_gunlock_j; | 463 | goto fail_gunlock_j; |
@@ -516,7 +523,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait) | |||
516 | 523 | ||
517 | gfs2_glock_dq_uninit(&t_gh); | 524 | gfs2_glock_dq_uninit(&t_gh); |
518 | 525 | ||
519 | t = DIV_RU(jiffies - t, HZ); | 526 | t = DIV_ROUND_UP(jiffies - t, HZ); |
520 | 527 | ||
521 | fs_info(sdp, "jid=%u: Journal replayed in %lus\n", | 528 | fs_info(sdp, "jid=%u: Journal replayed in %lus\n", |
522 | jd->jd_jid, t); | 529 | jd->jd_jid, t); |