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()
83 int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) in gfs2_revoke_check() argument
88 list_for_each_entry(iter, &jd->jd_revoke_list, rr_list) { in gfs2_revoke_check()
98 wrap = (rr->rr_where < jd->jd_replay_tail); in gfs2_revoke_check()
99 a = (jd->jd_replay_tail < where); in gfs2_revoke_check()
106 void gfs2_revoke_clean(struct gfs2_jdesc *jd) in gfs2_revoke_clean() argument
108 struct list_head *head = &jd->jd_revoke_list; in gfs2_revoke_clean()
165 static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, in get_log_header() argument
168 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in get_log_header()
172 error = gfs2_replay_read_block(jd, blk, &bh); in get_log_header()
196 static int foreach_descriptor(struct gfs2_jdesc *jd, u32 start, in foreach_descriptor() argument
199 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in foreach_descriptor()
210 error = gfs2_replay_read_block(jd, start, &bh); in foreach_descriptor()
222 error = get_log_header(jd, start, &lh); in foreach_descriptor()
224 gfs2_replay_incr_blk(jd, &start); in foreach_descriptor()
229 gfs2_consist_inode(GFS2_I(jd->jd_inode)); in foreach_descriptor()
239 error = lops_scan_elements(jd, start, ld, ptr, pass); in foreach_descriptor()
246 gfs2_replay_incr_blk(jd, &start); in foreach_descriptor()
262 static void clean_journal(struct gfs2_jdesc *jd, in clean_journal() argument
265 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in clean_journal()
268 gfs2_replay_incr_blk(jd, &lblock); in clean_journal()
269 gfs2_write_log_header(sdp, jd, head->lh_sequence + 1, 0, lblock, in clean_journal()
272 if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) { in clean_journal()
307 static int update_statfs_inode(struct gfs2_jdesc *jd, in update_statfs_inode() argument
311 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in update_statfs_inode()
335 "[%+lld,%+lld,%+lld]\n", jd->jd_jid, sc.sc_total, in update_statfs_inode()
342 if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) { in update_statfs_inode()
376 static void recover_local_statfs(struct gfs2_jdesc *jd, in recover_local_statfs() argument
380 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in recover_local_statfs()
388 error = update_statfs_inode(jd, head, sdp->sd_statfs_inode); in recover_local_statfs()
395 error = update_statfs_inode(jd, NULL, in recover_local_statfs()
396 find_local_statfs_inode(sdp, jd->jd_jid)); in recover_local_statfs()
403 struct gfs2_jdesc *jd = container_of(work, struct gfs2_jdesc, jd_work); in gfs2_recover_func() local
404 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); in gfs2_recover_func()
405 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); in gfs2_recover_func()
416 jd->jd_jid); in gfs2_recover_func()
422 if (jd->jd_jid != sdp->sd_lockstruct.ls_jid) { in gfs2_recover_func()
424 jd->jd_jid); in gfs2_recover_func()
428 error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops, in gfs2_recover_func()
437 fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid); in gfs2_recover_func()
450 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid); in gfs2_recover_func()
454 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid); in gfs2_recover_func()
456 error = gfs2_jdesc_check(jd); in gfs2_recover_func()
460 error = gfs2_find_jhead(jd, &head, true); in gfs2_recover_func()
464 fs_info(sdp, "jid=%u: Journal head lookup took %lldms\n", jd->jd_jid, in gfs2_recover_func()
473 "is frozen\n", jd->jd_jid); in gfs2_recover_func()
497 "device\n", jd->jd_jid); in gfs2_recover_func()
504 jd->jd_jid, head.lh_tail, head.lh_blkno); in gfs2_recover_func()
511 lops_before_scan(jd, &head, pass); in gfs2_recover_func()
512 error = foreach_descriptor(jd, head.lh_tail, in gfs2_recover_func()
514 lops_after_scan(jd, error, pass); in gfs2_recover_func()
521 recover_local_statfs(jd, &head); in gfs2_recover_func()
522 clean_journal(jd, &head); in gfs2_recover_func()
529 jd->jd_jid, ktime_ms_delta(t_rep, t_start), in gfs2_recover_func()
536 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS); in gfs2_recover_func()
543 fs_info(sdp, "jid=%u: Done\n", jd->jd_jid); in gfs2_recover_func()
555 fs_info(sdp, "jid=%u: %s\n", jd->jd_jid, (error) ? "Failed" : "Done"); in gfs2_recover_func()
557 jd->jd_recover_error = error; in gfs2_recover_func()
558 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); in gfs2_recover_func()
560 clear_bit(JDF_RECOVERY, &jd->jd_flags); in gfs2_recover_func()
562 wake_up_bit(&jd->jd_flags, JDF_RECOVERY); in gfs2_recover_func()
565 int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait) in gfs2_recover_journal() argument
569 if (test_and_set_bit(JDF_RECOVERY, &jd->jd_flags)) in gfs2_recover_journal()
573 rv = queue_work(gfs2_recovery_wq, &jd->jd_work); in gfs2_recover_journal()
577 wait_on_bit(&jd->jd_flags, JDF_RECOVERY, in gfs2_recover_journal()
580 return wait ? jd->jd_recover_error : 0; in gfs2_recover_journal()