Skip to content

Commit 93bd5ed

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of duplicate log head lookup
Currently at mount time, the recovery code looks up the current log head and, if necessary, replays the log and writes a recovery header to indicate that the log is clean. It does that for each log that may need recovery. We also know that our own log will always be checked as part of that process. Then, the mount code looks up the log head of our own log again. The double log head lookup can be costly, but more importantly, it is unnecessary because we can trivially compute the position of the log head after recovery; all we need to do for that is bump the position and lh_sequence by one when writing a recovery header. With that in mind, move the call to gfs2_log_pointers_init() into gfs2_recover_func() and get rid of the double lookup in gfs2_make_fs_rw(). Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 2ebb94a commit 93bd5ed

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

fs/gfs2/recovery.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ void gfs2_recover_func(struct work_struct *work)
530530
ktime_ms_delta(t_rep, t_tlck));
531531
}
532532

533+
if (jd->jd_jid == sdp->sd_lockstruct.ls_jid)
534+
gfs2_log_pointers_init(sdp, &head);
535+
533536
gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS);
534537

535538
if (jlocked) {

fs/gfs2/super.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,27 +134,18 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
134134
{
135135
struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
136136
struct gfs2_glock *j_gl = ip->i_gl;
137-
struct gfs2_log_header_host head;
138137
int error;
139138

140139
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
141140
if (gfs2_withdrawing_or_withdrawn(sdp))
142141
return -EIO;
143142

144-
error = gfs2_find_jhead(sdp->sd_jdesc, &head, false);
145-
if (error) {
146-
gfs2_consist(sdp);
147-
return error;
148-
}
149-
150-
if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
151-
gfs2_consist(sdp);
143+
if (sdp->sd_log_sequence == 0) {
144+
fs_err(sdp, "unknown status of our own journal jid %d",
145+
sdp->sd_lockstruct.ls_jid);
152146
return -EIO;
153147
}
154148

155-
/* Initialize some head of the log stuff */
156-
gfs2_log_pointers_init(sdp, &head);
157-
158149
error = gfs2_quota_init(sdp);
159150
if (!error && gfs2_withdrawing_or_withdrawn(sdp))
160151
error = -EIO;

0 commit comments

Comments
 (0)