]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #6355 from vcaputo/journal_avoid_mmap_cache_get_calls
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Jul 2017 08:03:52 +0000 (10:03 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Jul 2017 08:03:52 +0000 (10:03 +0200)
journal: avoid unnecessary mmap_cache_get() calls

1  2 
src/journal/mmap-cache.c

index 3e076f8fea31ed2d0191271b13ded0aa09062b0e,546710cdc9f16e98c4fe97cf802a47e4ec884544..6e60d24dcf34a41476f56d5804b73e06bae542ef
@@@ -510,9 -512,14 +519,12 @@@ static int add_mmap
          if (!w)
                  goto outofmem;
  
 -        context_detach_window(c);
 -        c->window = w;
 -        LIST_PREPEND(by_window, w->contexts, c);
 +        context_attach_window(c, w);
  
          *ret = (uint8_t*) w->ptr + (offset - w->offset);
+         if (ret_size)
+                 *ret_size = w->size - (offset - w->offset);
          return 1;
  
  outofmem: