diff options
author | hunt <hunt> | 2005-08-24 04:46:50 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-08-24 04:46:50 +0000 |
commit | cc1681194e8477ee7b253686ffffeff3b282d988 (patch) | |
tree | 7e9fdde1fb9baf1391c7749041281eed8354f1da | |
parent | 856b5264e82294dd8dfe000f22d19d8535aeb754 (diff) | |
download | systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.tar.gz systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.tar.xz systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.zip |
2005-08-23 Martin Hunt <hunt@redhat.com>
* transport.c (_stp_cleanup_and_exit): Remove a 2 second sleep
that should no longer be necessary.
* procfs.c (_stp_write): If the ready queue is not empty
then attempt to grab the last buffer in it and append our data
to it.
-rw-r--r-- | runtime/transport/ChangeLog | 9 | ||||
-rw-r--r-- | runtime/transport/procfs.c | 24 | ||||
-rw-r--r-- | runtime/transport/transport.c | 1 |
3 files changed, 28 insertions, 6 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index ad6933a4..d10a95d8 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,12 @@ +2005-08-23 Martin Hunt <hunt@redhat.com> + + * transport.c (_stp_cleanup_and_exit): Remove a 2 second sleep + that should no longer be necessary. + + * procfs.c (_stp_write): If the ready queue is not empty + then attempt to grab the last buffer in it and append our data + to it. + 2005-08-22 Martin Hunt <hunt@redhat.com> * transport.h: Don't define _stp_transport_write. diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 8af2d018..6406908d 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -115,6 +115,7 @@ static ssize_t _stp_proc_write_cmd (struct file *file, const char __user *buf, struct _stp_buffer { struct list_head list; int len; + int type; char buf[STP_BUFFER_SIZE]; }; @@ -124,6 +125,21 @@ static int _stp_write (int type, void *data, int len) { struct _stp_buffer *bptr; +#define WRITE_AGG +#ifdef WRITE_AGG + spin_lock(&_stp_ready_lock); + if (!list_empty(&_stp_ready_q)) { + bptr = (struct _stp_buffer *)_stp_ready_q.prev; + if (bptr->len + len <= STP_BUFFER_SIZE && bptr->type == type) { + memcpy (bptr->buf + bptr->len - 1, data, len); + bptr->len += len - 1; + spin_unlock(&_stp_ready_lock); + return len; + } + } + spin_unlock(&_stp_ready_lock); +#endif + spin_lock(&_stp_pool_lock); if (list_empty(&_stp_pool_q)) { spin_unlock(&_stp_pool_lock); @@ -135,8 +151,8 @@ static int _stp_write (int type, void *data, int len) list_del_init(&bptr->list); spin_unlock(&_stp_pool_lock); - memcpy (bptr->buf, &type, 4); - memcpy (&bptr->buf[4], data, len); + bptr->type = type; + memcpy (bptr->buf, data, len); bptr->len = len; @@ -151,7 +167,6 @@ static int _stp_write (int type, void *data, int len) return len; } - static ssize_t _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *ppos) { @@ -176,7 +191,7 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p /* write it out */ len = bptr->len + 4; - if (copy_to_user(buf, bptr->buf, len)) { + if (copy_to_user(buf, &bptr->type, len)) { /* now what? We took it off the queue then failed to send it */ /* we can't put it back on the queue because it will likely be out-of-order */ /* fortunately this should never happen */ @@ -193,7 +208,6 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p } - static struct file_operations _stp_proc_fops_cmd = { .owner = THIS_MODULE, .read = _stp_proc_read_cmd, diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index 0272fedd..d3e5ff5e 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -128,7 +128,6 @@ static void _stp_cleanup_and_exit (int closing) } #endif kbug("SENDING STP_EXIT\n"); - ssleep(2); _stp_transport_send(STP_EXIT, &closing, sizeof(int)); } } |