gfs2: Get rid of duplicate log head lookup
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 16 May 2025 02:33:49 +0000 (04:33 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 22 May 2025 07:12:27 +0000 (09:12 +0200)
commit93bd5edbd6480e3466320ecf97a105f51249c474
tree031cbca51d485fa7e74b2d917e776219f1654091
parent2ebb94ab93c3e4052f1d76275534d0ff46fc9b91
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 <agruenba@redhat.com>
fs/gfs2/recovery.c
fs/gfs2/super.c