WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xenconsoled: Discard guest console data i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenconsoled: Discard guest console data in bigger chunks
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 May 2010 01:45:16 -0700
Delivery-date: Thu, 27 May 2010 01:46:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1274944884 -3600
# Node ID 83a3f9556a055fbb8e5484d823e0715573e24f9e
# Parent  5be2d2a7f445bab61617b09627ca7f6a8ec90a69
xenconsoled: Discard guest console data in bigger chunks

Discard guest console data in bigger chunks so that there are fewer
discontinuities in the console data.  Also avoid discarding data if
space is available at the front of the buffer by reclaiming that
space.

Patch from: Christian Limpach <Christian.Limpach@xxxxxxxxxx>
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
 tools/console/daemon/io.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff -r 5be2d2a7f445 -r 83a3f9556a05 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Thu May 27 08:20:26 2010 +0100
+++ b/tools/console/daemon/io.c Thu May 27 08:21:24 2010 +0100
@@ -202,18 +202,25 @@ static void buffer_append(struct domain 
        }
 
        if (discard_overflowed_data && buffer->max_capacity &&
-           buffer->size > buffer->max_capacity) {
-               /* Discard the middle of the data. */
-
-               size_t over = buffer->size - buffer->max_capacity;
-               char *maxpos = buffer->data + buffer->max_capacity;
-
-               memmove(maxpos - over, maxpos, over);
-               buffer->data = realloc(buffer->data, buffer->max_capacity);
-               buffer->size = buffer->capacity = buffer->max_capacity;
-
-               if (buffer->consumed > buffer->max_capacity - over)
-                       buffer->consumed = buffer->max_capacity - over;
+           buffer->size > 5 * buffer->max_capacity / 4) {
+               if (buffer->consumed > buffer->max_capacity / 4) {
+                       /* Move data up in buffer, since beginning has
+                        * been output.  Only needed because buffer is
+                        * not a ring buffer *sigh* */
+                       memmove(buffer->data,
+                               buffer->data + buffer->consumed,
+                               buffer->size - buffer->consumed);
+                       buffer->size -= buffer->consumed;
+                       buffer->consumed = 0;
+               } else {
+                       /* Discard the middle of the data. */
+                       size_t over = buffer->size - buffer->max_capacity;
+
+                       memmove(buffer->data + buffer->max_capacity / 2,
+                               buffer->data + buffer->max_capacity,
+                               over);
+                       buffer->size = buffer->max_capacity / 2 + over;
+               }
        }
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xenconsoled: Discard guest console data in bigger chunks, Xen patchbot-unstable <=