[systemd-commits] 2 commits - src/journal

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 16 07:15:00 PDT 2012


 src/journal/mmap-cache.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit a2ab7ee6122a5006cafc45d7b81f726656fb65cc
Author: Colin Guthrie <colin at mageia.org>
Date:   Tue Oct 16 12:03:37 2012 +0100

    journal: Set the last_unused pointer correctly when attaching an unused window
    
    It seems the previous code was copy/pasted from context_detach_window()
    but not updated.

diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 7813f03..251aefe 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -205,8 +205,8 @@ static void context_attach_window(Context *c, Window *w) {
         if (w->in_unused) {
                 /* Used again? */
                 LIST_REMOVE(Window, unused, c->cache->unused, w);
-                if (!c->cache->last_unused)
-                        c->cache->last_unused = w;
+                if (c->cache->last_unused == w)
+                        c->cache->last_unused = w->unused_prev;
 
                 w->in_unused = false;
         }

commit 89de694724f376a6852e879fe987e7e531327654
Author: Colin Guthrie <colin at mageia.org>
Date:   Tue Oct 16 12:03:36 2012 +0100

    journal: Properly track the number of allocated windows.
    
    Checks were already in place to make sure that the number of
    windows was limited to 64, but the count was never incremented
    or decremented.

diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 88fe523..7813f03 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -130,6 +130,7 @@ static void window_free(Window *w) {
         assert(w);
 
         window_unlink(w);
+        w->cache->n_windows--;
         free(w);
 }
 
@@ -157,6 +158,7 @@ static Window *window_add(MMapCache *m) {
                 w = new0(Window, 1);
                 if (!w)
                         return NULL;
+                m->n_windows++;
         } else {
 
                 /* Reuse an existing one */



More information about the systemd-commits mailing list