From df8174c0e0bd668fb45ef772c586455647826845 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 3 Oct 2005 19:31:27 +0000 Subject: [PATCH] b=3289 r=adilger report recovery time remaining in /proc/.../recovery --- lustre/ldlm/ldlm_lib.c | 6 ++++-- lustre/mds/mds_fs.c | 3 +++ lustre/obdclass/lprocfs_status.c | 4 ++++ lustre/obdfilter/filter.c | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 82a7244..873dbff 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -906,10 +906,12 @@ static void reset_recovery_timer(struct obd_device *obd) spin_unlock_bh(&obd->obd_processing_task_lock); return; } - CDEBUG(D_HA, "%s: timer will expire in %u seconds\n", obd->obd_name, - (int)(OBD_RECOVERY_TIMEOUT / HZ)); mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT); spin_unlock_bh(&obd->obd_processing_task_lock); + CDEBUG(D_HA, "%s: timer will expire in %u seconds\n", obd->obd_name, + (int)(OBD_RECOVERY_TIMEOUT / HZ)); + /* Only used for lprocfs_status */ + obd->obd_recovery_end = CURRENT_SECONDS + OBD_RECOVERY_TIMEOUT/HZ; } diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 9ca7e5e..3ff10d1 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -380,6 +380,9 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) obd->obd_next_recovery_transno = obd->obd_last_committed + 1; obd->obd_recovering = 1; obd->obd_recovery_start = CURRENT_SECONDS; + /* Only used for lprocfs_status */ + obd->obd_recovery_end = obd->obd_recovery_start + + OBD_RECOVERY_TIMEOUT / HZ; } mds->mds_mount_count = mount_count + 1; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 0a8ebb4..9e10b18 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -863,6 +863,10 @@ int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off, n = snprintf(page, count, "recovery_start: %lu\n", obd->obd_recovery_start); page += n; len += n; count -= n; + n = snprintf(page, count, "time remaining: %lu\n", + CURRENT_SECONDS >= obd->obd_recovery_end ? 0 : + obd->obd_recovery_end - CURRENT_SECONDS); + page += n; len += n; count -= n; n = snprintf(page, count, "connected_clients: %d/%d\n", connected, max_recoverable); page += n; len += n; count -= n; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 3cd6690..dc8adf1 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -521,6 +521,9 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) obd->obd_next_recovery_transno = obd->obd_last_committed + 1; obd->obd_recovering = 1; obd->obd_recovery_start = CURRENT_SECONDS; + /* Only used for lprocfs_status */ + obd->obd_recovery_end = obd->obd_recovery_start + + OBD_RECOVERY_TIMEOUT / HZ; } out: -- 1.8.3.1