aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhi Das <adas@redhat.com>2018-03-29 13:41:27 -0400
committerBob Peterson <rpeterso@redhat.com>2018-03-29 13:41:27 -0400
commit5e86d9d122d0d6fae00d9dff41c22d6f4d09f566 (patch)
treef1c04c72d8d03d4ceeb02ab7f0ebecc0926ae475
parentfffb64127adc3eea6a19ceefdc88d171f68b9d34 (diff)
gfs2: time journal recovery steps accurately
This patch spits out the time taken by the various steps in the journal recover process. Previously, the journal recovery time didn't account for finding the journal head in the log which takes up a significant portion of time. Signed-off-by: Abhi Das <adas@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r--fs/gfs2/recovery.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index b6b258998bcd..d8b622c375ab 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -15,6 +15,7 @@
15#include <linux/gfs2_ondisk.h> 15#include <linux/gfs2_ondisk.h>
16#include <linux/crc32.h> 16#include <linux/crc32.h>
17#include <linux/crc32c.h> 17#include <linux/crc32c.h>
18#include <linux/ktime.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
20#include "incore.h" 21#include "incore.h"
@@ -409,12 +410,13 @@ void gfs2_recover_func(struct work_struct *work)
409 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); 410 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
410 struct gfs2_log_header_host head; 411 struct gfs2_log_header_host head;
411 struct gfs2_holder j_gh, ji_gh, thaw_gh; 412 struct gfs2_holder j_gh, ji_gh, thaw_gh;
412 unsigned long t; 413 ktime_t t_start, t_jlck, t_jhd, t_tlck, t_rep;
413 int ro = 0; 414 int ro = 0;
414 unsigned int pass; 415 unsigned int pass;
415 int error; 416 int error;
416 int jlocked = 0; 417 int jlocked = 0;
417 418
419 t_start = ktime_get();
418 if (sdp->sd_args.ar_spectator || 420 if (sdp->sd_args.ar_spectator ||
419 (jd->jd_jid != sdp->sd_lockstruct.ls_jid)) { 421 (jd->jd_jid != sdp->sd_lockstruct.ls_jid)) {
420 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", 422 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n",
@@ -446,6 +448,7 @@ void gfs2_recover_func(struct work_struct *work)
446 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid); 448 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid);
447 } 449 }
448 450
451 t_jlck = ktime_get();
449 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid); 452 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid);
450 453
451 error = gfs2_jdesc_check(jd); 454 error = gfs2_jdesc_check(jd);
@@ -455,13 +458,12 @@ void gfs2_recover_func(struct work_struct *work)
455 error = gfs2_find_jhead(jd, &head); 458 error = gfs2_find_jhead(jd, &head);
456 if (error) 459 if (error)
457 goto fail_gunlock_ji; 460 goto fail_gunlock_ji;
461 t_jhd = ktime_get();
458 462
459 if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) { 463 if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
460 fs_info(sdp, "jid=%u: Acquiring the transaction lock...\n", 464 fs_info(sdp, "jid=%u: Acquiring the transaction lock...\n",
461 jd->jd_jid); 465 jd->jd_jid);
462 466
463 t = jiffies;
464
465 /* Acquire a shared hold on the freeze lock */ 467 /* Acquire a shared hold on the freeze lock */
466 468
467 error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 469 error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED,
@@ -495,6 +497,7 @@ void gfs2_recover_func(struct work_struct *work)
495 goto fail_gunlock_thaw; 497 goto fail_gunlock_thaw;
496 } 498 }
497 499
500 t_tlck = ktime_get();
498 fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid); 501 fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid);
499 502
500 for (pass = 0; pass < 2; pass++) { 503 for (pass = 0; pass < 2; pass++) {
@@ -509,9 +512,14 @@ void gfs2_recover_func(struct work_struct *work)
509 clean_journal(jd, &head); 512 clean_journal(jd, &head);
510 513
511 gfs2_glock_dq_uninit(&thaw_gh); 514 gfs2_glock_dq_uninit(&thaw_gh);
512 t = DIV_ROUND_UP(jiffies - t, HZ); 515 t_rep = ktime_get();
513 fs_info(sdp, "jid=%u: Journal replayed in %lus\n", 516 fs_info(sdp, "jid=%u: Journal replayed in %lldms [jlck:%lldms, "
514 jd->jd_jid, t); 517 "jhead:%lldms, tlck:%lldms, replay:%lldms]\n",
518 jd->jd_jid, ktime_ms_delta(t_rep, t_start),
519 ktime_ms_delta(t_jlck, t_start),
520 ktime_ms_delta(t_jhd, t_jlck),
521 ktime_ms_delta(t_tlck, t_jhd),
522 ktime_ms_delta(t_rep, t_tlck));
515 } 523 }
516 524
517 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS); 525 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS);