Lines Matching refs:jd

32 int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,  in gfs2_replay_read_block()  argument
35 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); in gfs2_replay_read_block()
55 int gfs2_revoke_add(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) in gfs2_revoke_add() argument
57 struct list_head *head = &jd->jd_revoke_list; in gfs2_revoke_add()
84 int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) in gfs2_revoke_check() argument
90 list_for_each_entry(rr, &jd->jd_revoke_list, rr_list) { in gfs2_revoke_check()
100 wrap = (rr->rr_where < jd->jd_replay_tail); in gfs2_revoke_check()
101 a = (jd->jd_replay_tail < where); in gfs2_revoke_check()
108 void gfs2_revoke_clean(struct gfs2_jdesc *jd) in gfs2_revoke_clean() argument
110 struct list_head *head = &jd->jd_revoke_list; in gfs2_revoke_clean()
150 static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, in get_log_header() argument
159 error = gfs2_replay_read_block(jd, blk, &bh); in get_log_header()
191 static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, in find_good_lh() argument
198 error = get_log_header(jd, *blk, head); in find_good_lh()
202 if (++*blk == jd->jd_blocks) in find_good_lh()
206 gfs2_consist_inode(GFS2_I(jd->jd_inode)); in find_good_lh()
223 static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) in jhead_scan() argument
230 if (++blk == jd->jd_blocks) in jhead_scan()
233 error = get_log_header(jd, blk, &lh); in jhead_scan()
240 gfs2_consist_inode(GFS2_I(jd->jd_inode)); in jhead_scan()
263 int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) in gfs2_find_jhead() argument
270 blk_2 = jd->jd_blocks - 1; in gfs2_find_jhead()
275 error = find_good_lh(jd, &blk_1, &lh_1); in gfs2_find_jhead()
279 error = find_good_lh(jd, &blk_m, &lh_m); in gfs2_find_jhead()
292 error = jhead_scan(jd, &lh_1); in gfs2_find_jhead()
313 static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, in foreach_descriptor() argument
316 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in foreach_descriptor()
327 error = gfs2_replay_read_block(jd, start, &bh); in foreach_descriptor()
339 error = get_log_header(jd, start, &lh); in foreach_descriptor()
346 gfs2_consist_inode(GFS2_I(jd->jd_inode)); in foreach_descriptor()
356 error = lops_scan_elements(jd, start, ld, ptr, pass); in foreach_descriptor()
381 static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) in clean_journal() argument
383 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); in clean_journal()
384 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in clean_journal()
453 struct gfs2_jdesc *jd = container_of(work, struct gfs2_jdesc, jd_work); in gfs2_recover_func() local
454 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); in gfs2_recover_func()
455 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in gfs2_recover_func()
465 (jd->jd_jid != sdp->sd_lockstruct.ls_jid)) { in gfs2_recover_func()
467 jd->jd_jid); in gfs2_recover_func()
471 error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops, in gfs2_recover_func()
480 fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid); in gfs2_recover_func()
492 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid); in gfs2_recover_func()
495 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid); in gfs2_recover_func()
497 error = gfs2_jdesc_check(jd); in gfs2_recover_func()
501 error = gfs2_find_jhead(jd, &head); in gfs2_recover_func()
507 jd->jd_jid); in gfs2_recover_func()
539 "device\n", jd->jd_jid); in gfs2_recover_func()
544 fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid); in gfs2_recover_func()
547 lops_before_scan(jd, &head, pass); in gfs2_recover_func()
548 error = foreach_descriptor(jd, head.lh_tail, in gfs2_recover_func()
550 lops_after_scan(jd, error, pass); in gfs2_recover_func()
555 error = clean_journal(jd, &head); in gfs2_recover_func()
562 jd->jd_jid, t); in gfs2_recover_func()
565 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS); in gfs2_recover_func()
572 fs_info(sdp, "jid=%u: Done\n", jd->jd_jid); in gfs2_recover_func()
584 fs_info(sdp, "jid=%u: %s\n", jd->jd_jid, (error) ? "Failed" : "Done"); in gfs2_recover_func()
586 jd->jd_recover_error = error; in gfs2_recover_func()
587 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); in gfs2_recover_func()
589 clear_bit(JDF_RECOVERY, &jd->jd_flags); in gfs2_recover_func()
591 wake_up_bit(&jd->jd_flags, JDF_RECOVERY); in gfs2_recover_func()
594 int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait) in gfs2_recover_journal() argument
598 if (test_and_set_bit(JDF_RECOVERY, &jd->jd_flags)) in gfs2_recover_journal()
602 rv = queue_work(gfs_recovery_wq, &jd->jd_work); in gfs2_recover_journal()
606 wait_on_bit(&jd->jd_flags, JDF_RECOVERY, in gfs2_recover_journal()
609 return wait ? jd->jd_recover_error : 0; in gfs2_recover_journal()