From 9b1d74f9a9d606f1e483690afae0a4a8207c76db Mon Sep 17 00:00:00 2001
From: David Smith <dsmith@redhat.com>
Date: Fri, 7 Feb 2014 10:27:14 -0600
Subject: [PATCH] Remove the transport's unused "dropped" file.
* runtime/transport/relay_v2.c: Unless _STP_USE_DROPPED_FILE is defined,
don't bother creating the unused "dropped" file.
---
runtime/transport/relay_v2.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/runtime/transport/relay_v2.c b/runtime/transport/relay_v2.c
index 6c9815d..97e02f9 100644
--- a/runtime/transport/relay_v2.c
+++ b/runtime/transport/relay_v2.c
@@ -43,8 +43,10 @@
struct _stp_relay_data_type {
struct rchan *rchan;
atomic_t /* enum _stp_transport_state */ transport_state;
+#ifdef _STP_USE_DROPPED_FILE
struct dentry *dropped_file;
atomic_t dropped;
+#endif
atomic_t wakeup;
struct timer_list timer;
int overwrite_flag;
@@ -160,6 +162,7 @@ static void _stp_transport_data_fs_overwrite(int overwrite)
_stp_relay_data.overwrite_flag = overwrite;
}
+#ifdef _STP_USE_DROPPED_FILE
static int __stp_relay_dropped_open(struct inode *inode, struct file *filp)
{
return 0;
@@ -181,6 +184,7 @@ static struct file_operations __stp_relay_dropped_fops = {
.open = __stp_relay_dropped_open,
.read = __stp_relay_dropped_read,
};
+#endif
/*
* Keep track of how many times we encountered a full subbuffer, to aid
@@ -193,7 +197,9 @@ static int __stp_relay_subbuf_start_callback(struct rchan_buf *buf,
if (_stp_relay_data.overwrite_flag || !relay_buf_full(buf))
return 1;
+#ifdef _STP_USE_DROPPED_FILE
atomic_inc(&_stp_relay_data.dropped);
+#endif
return 0;
}
@@ -270,8 +276,10 @@ static void _stp_transport_data_fs_stop(void)
static void _stp_transport_data_fs_close(void)
{
_stp_transport_data_fs_stop();
+#ifdef _STP_USE_DROPPED_FILE
if (_stp_relay_data.dropped_file)
debugfs_remove(_stp_relay_data.dropped_file);
+#endif
if (_stp_relay_data.rchan) {
relay_close(_stp_relay_data.rchan);
_stp_relay_data.rchan = NULL;
@@ -286,9 +294,11 @@ static int _stp_transport_data_fs_init(void)
atomic_set(&_stp_relay_data.transport_state, STP_TRANSPORT_STOPPED);
_stp_relay_data.overwrite_flag = 0;
+ _stp_relay_data.rchan = NULL;
+
+#ifdef _STP_USE_DROPPED_FILE
atomic_set(&_stp_relay_data.dropped, 0);
_stp_relay_data.dropped_file = NULL;
- _stp_relay_data.rchan = NULL;
/* Create "dropped" file. */
_stp_relay_data.dropped_file
@@ -306,6 +316,7 @@ static int _stp_transport_data_fs_init(void)
_stp_relay_data.dropped_file->d_inode->i_uid = KUIDT_INIT(_stp_uid);
_stp_relay_data.dropped_file->d_inode->i_gid = KGIDT_INIT(_stp_gid);
+#endif
/* Create "trace" file. */
npages = _stp_subbuf_size * _stp_nsubbufs;
--
1.8.3.1