浏览代码

ocfs2 patch to track delayed orphan scan timer statistics

Patch to track delayed orphan scan timer statistics.

Modifies ocfs2_osb_dump to print the following:
  Orphan Scan=> Local: 10  Global: 21  Last Scan: 67 seconds ago

Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Srinivas Eeda 16 年之前
父节点
当前提交
15633a220f
共有 3 个文件被更改,包括 15 次插入1 次删除
  1. 4 0
      fs/ocfs2/journal.c
  2. 3 1
      fs/ocfs2/ocfs2.h
  3. 8 0
      fs/ocfs2/super.c

+ 4 - 0
fs/ocfs2/journal.c

@@ -1900,6 +1900,8 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 	 * number and update LVB so other node will skip the scan for a while
 	 * number and update LVB so other node will skip the scan for a while
 	 */
 	 */
 	seqno++;
 	seqno++;
+	os->os_count++;
+	os->os_scantime = CURRENT_TIME;
 unlock:
 unlock:
 	ocfs2_orphan_scan_unlock(osb, seqno, DLM_LOCK_EX);
 	ocfs2_orphan_scan_unlock(osb, seqno, DLM_LOCK_EX);
 out:
 out:
@@ -1939,6 +1941,8 @@ int ocfs2_orphan_scan_init(struct ocfs2_super *osb)
 
 
 	os = &osb->osb_orphan_scan;
 	os = &osb->osb_orphan_scan;
 	os->os_osb = osb;
 	os->os_osb = osb;
+	os->os_count = 0;
+	os->os_scantime = CURRENT_TIME;
 	mutex_init(&os->os_lock);
 	mutex_init(&os->os_lock);
 
 
 	INIT_DELAYED_WORK(&os->os_orphan_scan_work,
 	INIT_DELAYED_WORK(&os->os_orphan_scan_work,

+ 3 - 1
fs/ocfs2/ocfs2.h

@@ -156,7 +156,9 @@ struct ocfs2_orphan_scan {
 	struct ocfs2_super 	*os_osb;
 	struct ocfs2_super 	*os_osb;
 	struct ocfs2_lock_res 	os_lockres;     /* lock to synchronize scans */
 	struct ocfs2_lock_res 	os_lockres;     /* lock to synchronize scans */
 	struct delayed_work 	os_orphan_scan_work;
 	struct delayed_work 	os_orphan_scan_work;
-	u32  			os_seqno;       /* incremented on every scan */
+	struct timespec		os_scantime;  /* time this node ran the scan */
+	u32			os_count;      /* tracks node specific scans */
+	u32  			os_seqno;       /* tracks cluster wide scans */
 };
 };
 
 
 struct ocfs2_dlm_debug {
 struct ocfs2_dlm_debug {

+ 8 - 0
fs/ocfs2/super.c

@@ -208,6 +208,7 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
 	int i;
 	int i;
 	struct ocfs2_cluster_connection *cconn = osb->cconn;
 	struct ocfs2_cluster_connection *cconn = osb->cconn;
 	struct ocfs2_recovery_map *rm = osb->recovery_map;
 	struct ocfs2_recovery_map *rm = osb->recovery_map;
+	struct ocfs2_orphan_scan *os;
 
 
 	out += snprintf(buf + out, len - out,
 	out += snprintf(buf + out, len - out,
 			"%10s => Id: %-s  Uuid: %-s  Gen: 0x%X  Label: %-s\n",
 			"%10s => Id: %-s  Uuid: %-s  Gen: 0x%X  Label: %-s\n",
@@ -309,6 +310,13 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
 				i, osb->slot_recovery_generations[i]);
 				i, osb->slot_recovery_generations[i]);
 	}
 	}
 
 
+	os = &osb->osb_orphan_scan;
+	out += snprintf(buf + out, len - out, "Orphan Scan=> ");
+	out += snprintf(buf + out, len - out, "Local: %u  Global: %u ",
+			os->os_count, os->os_seqno);
+	out += snprintf(buf + out, len - out, " Last Scan: %lu seconds ago\n",
+			(get_seconds() - os->os_scantime.tv_sec));
+
 	return out;
 	return out;
 }
 }