ocfs2/cluster: Fix output in file elapsed_time_in_ms

The o2hb debugfs file, elapsed_time_in_ms, should return values only after the
timer is armed atleast once.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
This commit is contained in:
Sunil Mushran 2011-07-24 10:31:54 -07:00
parent a2c0cc1579
commit bb570a5d9e
1 changed files with 6 additions and 3 deletions

View File

@ -1198,6 +1198,7 @@ static int o2hb_debug_open(struct inode *inode, struct file *file)
struct o2hb_debug_buf *db = inode->i_private; struct o2hb_debug_buf *db = inode->i_private;
struct o2hb_region *reg; struct o2hb_region *reg;
unsigned long map[BITS_TO_LONGS(O2NM_MAX_NODES)]; unsigned long map[BITS_TO_LONGS(O2NM_MAX_NODES)];
unsigned long lts;
char *buf = NULL; char *buf = NULL;
int i = -1; int i = -1;
int out = 0; int out = 0;
@ -1234,9 +1235,11 @@ static int o2hb_debug_open(struct inode *inode, struct file *file)
case O2HB_DB_TYPE_REGION_ELAPSED_TIME: case O2HB_DB_TYPE_REGION_ELAPSED_TIME:
reg = (struct o2hb_region *)db->db_data; reg = (struct o2hb_region *)db->db_data;
out += snprintf(buf + out, PAGE_SIZE - out, "%u\n", lts = reg->hr_last_timeout_start;
jiffies_to_msecs(jiffies - /* If 0, it has never been set before */
reg->hr_last_timeout_start)); if (lts)
lts = jiffies_to_msecs(jiffies - lts);
out += snprintf(buf + out, PAGE_SIZE - out, "%lu\n", lts);
goto done; goto done;
case O2HB_DB_TYPE_REGION_PINNED: case O2HB_DB_TYPE_REGION_PINNED: