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-4.0-testing] xenconsoled: Discard guest console dat

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] xenconsoled: Discard guest console data in bigger chunks
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 04 Jun 2010 03:45:50 -0700
Delivery-date: Fri, 04 Jun 2010 03:49:30 -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 1275644213 -3600
# Node ID 969ba353c8465d5d4abf4147b6fac98281ef6681
# Parent  356a3d30b1b16c0eb4b928fdb7a261b21086dd95
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>
xen-unstable changeset:   21464:83a3f9556a05
xen-unstable date:        Thu May 27 08:21:24 2010 +0100
---
 tools/console/daemon/io.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff -r 356a3d30b1b1 -r 969ba353c846 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Fri Jun 04 10:36:29 2010 +0100
+++ b/tools/console/daemon/io.c Fri Jun 04 10:36:53 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-4.0-testing] xenconsoled: Discard guest console data in bigger chunks, Xen patchbot-4.0-testing <=