SHA256
1
0
forked from pool/systemd
systemd/0043-journal-simplify-pre-allocation-logic.patch
Stephan Kulow d24108b9c9 Accepting request 222383 from Base:System
- Add several upstream bugfix patches which are missed:
  * 0018-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch
  * 0026-udevadm.xml-document-resolve-names-option-for-test.patch
  * 0030-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch
  * 0032-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch
  * 0031-man-document-the-b-special-boot-option.patch
  * 0033-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch
  * 0034-systemd-python-fix-booted-and-add-two-functions-to-d.patch
  * 0035-activate-mention-E-in-the-help-text.patch
  * 0036-activate-fix-crash-when-s-is-passed.patch
  * 0037-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch
  * 0038-core-socket-fix-SO_REUSEPORT.patch
  * 0039-journal-when-appending-to-journal-file-allocate-larg.patch
  * 0040-journal-optimize-bisection-logic-a-bit-by-caching-th.patch
  * 0041-journal-fix-iteration-when-we-go-backwards-from-the-.patch
  * 0042-journal-allow-journal_file_copy_entry-to-work-on-non.patch
  * 0043-journal-simplify-pre-allocation-logic.patch
  * 0044-journald-mention-how-long-we-needed-to-flush-to-var-.patch
  * 0046-util.c-check-if-return-value-from-ttyname_r-is-0-ins.patch
  * 0047-docs-remove-unneeded-the-s-in-gudev-docs.patch
  * 0048-man-explicitly-say-when-multiple-units-can-be-specif.patch
  * 0049-systemd-treat-reload-failure-as-failure.patch
- Add patch 0001-Don-t-snprintf-a-potentially-NULL-pointer.patch
  to avoid potential NULL pointer
- Reorder patches to reflect udev/systemd usage

- don't build bash-completions for bootstrap package

- add more requires to this-is-only-for-build-envs to avoid 
  problems in kiwi configs

OBS-URL: https://build.opensuse.org/request/show/222383
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=176
2014-02-15 16:19:18 +00:00

62 lines
2.3 KiB
Diff

From eda4b58b50509dc8ad0428a46e20f6c5cf516d58 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 27 Nov 2013 01:44:52 +0100
Subject: [PATCH] journal: simplify pre-allocation logic
let's just do a single fallocate() as far as possible, and don't
distuingish between allocated space and file size.
This way we can save a syscall for each append, which makes quite some
benefits.
---
src/journal/journal-file.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 14eae8f..4009b29 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -315,7 +315,7 @@ static int journal_file_verify_header(JournalFile *f) {
}
static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
- uint64_t old_size, new_size, file_size;
+ uint64_t old_size, new_size;
int r;
assert(f);
@@ -356,6 +356,11 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
}
}
+ /* Increase by larger blocks at once */
+ new_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
+ if (f->metrics.max_size > 0 && new_size > f->metrics.max_size)
+ new_size = f->metrics.max_size;
+
/* Note that the glibc fallocate() fallback is very
inefficient, hence we try to minimize the allocation area
as we can. */
@@ -363,16 +368,8 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
if (r != 0)
return -r;
- /* Increase the file size a bit further than this, so that we
- * we can create larger memory maps to cache */
- file_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
- if (file_size > (uint64_t) f->last_stat.st_size) {
- if (file_size > new_size)
- ftruncate(f->fd, file_size);
-
- if (fstat(f->fd, &f->last_stat) < 0)
- return -errno;
- }
+ if (fstat(f->fd, &f->last_stat) < 0)
+ return -errno;
f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
--
1.7.9.2