ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
* [Ocfs2-devel] backports to 1.4 from mainline
@ 2010-11-02 20:17 Srinivas Eeda
  2010-11-02 20:17 ` [Ocfs2-devel] [PATCH 1/2] ocfs2/cluster: Create debugfs dir for heartbeat regions Srinivas Eeda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Srinivas Eeda @ 2010-11-02 20:17 UTC (permalink / raw)
  To: ocfs2-devel

The following two patches are backports from mainline to 1.4. These patches
create debugfs entry for heartbeat regions and to show elapsed time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/2] ocfs2/cluster: Create debugfs dir for heartbeat regions
  2010-11-02 20:17 [Ocfs2-devel] backports to 1.4 from mainline Srinivas Eeda
@ 2010-11-02 20:17 ` Srinivas Eeda
  2010-11-02 20:18 ` [Ocfs2-devel] [PATCH 2/2] ocfs2/cluster: Add per-region debugfs file to show the elapsed time Srinivas Eeda
  2010-11-02 20:25 ` [Ocfs2-devel] backports to 1.4 from mainline Joel Becker
  2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Eeda @ 2010-11-02 20:17 UTC (permalink / raw)
  To: ocfs2-devel

From: Sunil Mushran <sunil.mushran@oracle.com>

Mainline 0841ed580fe8a3e51ba9dbb133dafc787cce428f
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 fs/ocfs2/cluster/heartbeat.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 55e8718..8580e66 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -134,6 +134,8 @@ struct o2hb_region {
 	struct block_device	*hr_bdev;
 	struct o2hb_disk_slot	*hr_slots;
 
+	struct dentry		*hr_debug_dir;
+
 	/* let the person setting up hb wait for it to return until it
 	 * has reached a 'steady' state.  This will be fixed when we have
 	 * a more complete api that doesn't lead to this sort of fragility. */
@@ -1085,6 +1087,8 @@ static void o2hb_region_release(struct config_item *item)
 	if (reg->hr_slots)
 		kfree(reg->hr_slots);
 
+	debugfs_remove(reg->hr_debug_dir);
+
 	spin_lock(&o2hb_live_lock);
 	list_del(&reg->hr_all_item);
 	spin_unlock(&o2hb_live_lock);
@@ -1597,24 +1601,31 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 							  const char *name)
 {
 	struct o2hb_region *reg = NULL;
-	struct config_item *ret = NULL;
 
 	reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL);
-	if (reg == NULL)
-		goto out; /* ENOMEM */
+	if (reg == NULL) {
+		mlog_errno(-ENOMEM);
+		goto out;
+	}
 
 	config_item_init_type_name(&reg->hr_item, name, &o2hb_region_type);
 
-	ret = &reg->hr_item;
+	reg->hr_debug_dir =
+		debugfs_create_dir(config_item_name(&reg->hr_item), o2hb_debug_dir);
+	if (!reg->hr_debug_dir) {
+		mlog_errno(-ENOMEM);
+		goto out;
+	}
 
 	spin_lock(&o2hb_live_lock);
 	list_add_tail(&reg->hr_all_item, &o2hb_all_regions);
 	spin_unlock(&o2hb_live_lock);
-out:
-	if (ret == NULL)
-		kfree(reg);
 
-	return ret;
+	return &reg->hr_item;
+
+out:
+	kfree(reg);
+	return NULL;
 }
 
 static void o2hb_heartbeat_group_drop_item(struct config_group *group,
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 2/2] ocfs2/cluster: Add per-region debugfs file to show the elapsed time
  2010-11-02 20:17 [Ocfs2-devel] backports to 1.4 from mainline Srinivas Eeda
  2010-11-02 20:17 ` [Ocfs2-devel] [PATCH 1/2] ocfs2/cluster: Create debugfs dir for heartbeat regions Srinivas Eeda
@ 2010-11-02 20:18 ` Srinivas Eeda
  2010-11-02 20:25 ` [Ocfs2-devel] backports to 1.4 from mainline Joel Becker
  2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Eeda @ 2010-11-02 20:18 UTC (permalink / raw)
  To: ocfs2-devel

From: Sunil Mushran <sunil.mushran@oracle.com>

Mainline fa16655a622e7c0fda76ca5155db6efc86968c65
A per-region debugfs file, elapsed_time_in_ms, shows the time since the
heartbeat timer was last armed.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 fs/ocfs2/cluster/heartbeat.c |   46 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 8580e66..0ae0dea 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -63,6 +63,7 @@ static DECLARE_WAIT_QUEUE_HEAD(o2hb_steady_queue);
 
 #define O2HB_DEBUG_DIR			"o2hb"
 #define O2HB_DEBUG_LIVENODES		"livenodes"
+#define O2HB_DEBUG_REGION_ELAPSED_TIME	"elapsed_time_in_ms"
 static struct dentry *o2hb_debug_dir;
 static struct dentry *o2hb_debug_livenodes;
 
@@ -135,6 +136,7 @@ struct o2hb_region {
 	struct o2hb_disk_slot	*hr_slots;
 
 	struct dentry		*hr_debug_dir;
+	struct dentry		*hr_debug_elapsed_time;
 
 	/* let the person setting up hb wait for it to return until it
 	 * has reached a 'steady' state.  This will be fixed when we have
@@ -950,6 +952,29 @@ bail:
 	return -ENOMEM;
 }
 
+static int o2hb_region_debug_open(struct inode *inode, struct file *file)
+{
+	struct o2hb_region *reg = inode->i_private;
+	char *buf = NULL;
+	int out = 0;
+
+	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	if (!buf)
+		goto bail;
+
+	out += snprintf(buf + out, PAGE_SIZE - out, "%u\n",
+			jiffies_to_msecs(jiffies -
+					 reg->hr_last_timeout_start));
+
+	i_size_write(inode, out);
+
+	file->private_data = buf;
+
+	return 0;
+bail:
+	return -ENOMEM;
+}
+
 static int o2hb_debug_release(struct inode *inode, struct file *file)
 {
 	kfree(file->private_data);
@@ -985,6 +1010,13 @@ static struct file_operations o2hb_debug_fops = {
 	.llseek =	generic_file_llseek,
 };
 
+static struct file_operations o2hb_region_debug_fops = {
+	.open =		o2hb_region_debug_open,
+	.release =	o2hb_debug_release,
+	.read =		o2hb_debug_read,
+	.llseek =	generic_file_llseek,
+};
+
 void o2hb_exit(void)
 {
 	if (o2hb_debug_livenodes)
@@ -1087,6 +1119,7 @@ static void o2hb_region_release(struct config_item *item)
 	if (reg->hr_slots)
 		kfree(reg->hr_slots);
 
+	debugfs_remove(reg->hr_debug_elapsed_time);
 	debugfs_remove(reg->hr_debug_dir);
 
 	spin_lock(&o2hb_live_lock);
@@ -1617,6 +1650,17 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 		goto out;
 	}
 
+	reg->hr_debug_elapsed_time =
+		debugfs_create_file(O2HB_DEBUG_REGION_ELAPSED_TIME,
+				    S_IFREG|S_IRUSR,
+				    reg->hr_debug_dir,
+				    reg,
+				    &o2hb_region_debug_fops);
+	if (!reg->hr_debug_elapsed_time) {
+		mlog_errno(-ENOMEM);
+		goto out;
+	}
+
 	spin_lock(&o2hb_live_lock);
 	list_add_tail(&reg->hr_all_item, &o2hb_all_regions);
 	spin_unlock(&o2hb_live_lock);
@@ -1624,6 +1668,8 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 	return &reg->hr_item;
 
 out:
+	if (reg && reg->hr_debug_dir)
+		debugfs_remove(reg->hr_debug_dir);
 	kfree(reg);
 	return NULL;
 }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] backports to 1.4 from mainline
  2010-11-02 20:17 [Ocfs2-devel] backports to 1.4 from mainline Srinivas Eeda
  2010-11-02 20:17 ` [Ocfs2-devel] [PATCH 1/2] ocfs2/cluster: Create debugfs dir for heartbeat regions Srinivas Eeda
  2010-11-02 20:18 ` [Ocfs2-devel] [PATCH 2/2] ocfs2/cluster: Add per-region debugfs file to show the elapsed time Srinivas Eeda
@ 2010-11-02 20:25 ` Joel Becker
  2 siblings, 0 replies; 4+ messages in thread
From: Joel Becker @ 2010-11-02 20:25 UTC (permalink / raw)
  To: ocfs2-devel

On Tue, Nov 02, 2010 at 01:17:58PM -0700, Srinivas Eeda wrote:
> The following two patches are backports from mainline to 1.4. These patches
> create debugfs entry for heartbeat regions and to show elapsed time.

	Works for me.

Joel

-- 

"Drake!  We're LEAVING!"

Joel Becker
Senior Development Manager
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-02 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02 20:17 [Ocfs2-devel] backports to 1.4 from mainline Srinivas Eeda
2010-11-02 20:17 ` [Ocfs2-devel] [PATCH 1/2] ocfs2/cluster: Create debugfs dir for heartbeat regions Srinivas Eeda
2010-11-02 20:18 ` [Ocfs2-devel] [PATCH 2/2] ocfs2/cluster: Add per-region debugfs file to show the elapsed time Srinivas Eeda
2010-11-02 20:25 ` [Ocfs2-devel] backports to 1.4 from mainline Joel Becker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).