diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/journal-when-appending-to-journal-file-allocate-larg.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/journal-when-appending-to-journal-file-allocate-larg.patch | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/meta/recipes-core/systemd/systemd/journal-when-appending-to-journal-file-allocate-larg.patch b/meta/recipes-core/systemd/systemd/journal-when-appending-to-journal-file-allocate-larg.patch deleted file mode 100644 index 89573bbaf9..0000000000 --- a/meta/recipes-core/systemd/systemd/journal-when-appending-to-journal-file-allocate-larg.patch +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | From c0658e1948c301177b1527227be0c18932cd7cce Mon Sep 17 00:00:00 2001 | ||
2 | From: Lennart Poettering <lennart@poettering.net> | ||
3 | Date: Tue, 26 Nov 2013 18:39:42 +0100 | ||
4 | Subject: [PATCH] journal: when appending to journal file, allocate larger | ||
5 | blocks at once | ||
6 | |||
7 | (cherry picked from commit a676e66535e12458ea6d366a653f8dd60f982504) | ||
8 | |||
9 | Conflicts: | ||
10 | src/journal/journal-file.c | ||
11 | --- | ||
12 | src/journal/journal-file.c | 26 +++++++++++++++++--------- | ||
13 | 1 file changed, 17 insertions(+), 9 deletions(-) | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | |||
17 | Index: systemd-208/src/journal/journal-file.c | ||
18 | =================================================================== | ||
19 | --- systemd-208.orig/src/journal/journal-file.c 2014-02-07 22:37:06.013722798 -0800 | ||
20 | +++ systemd-208/src/journal/journal-file.c 2014-02-07 22:44:51.563341090 -0800 | ||
21 | @@ -68,6 +68,9 @@ | ||
22 | /* How many entries to keep in the entry array chain cache at max */ | ||
23 | #define CHAIN_CACHE_MAX 20 | ||
24 | |||
25 | +/* How much to increase the journal file size at once each time we allocate something new. */ | ||
26 | +#define FILE_SIZE_INCREASE (8ULL*1024ULL*1024ULL) /* 8MB */ | ||
27 | + | ||
28 | int journal_file_set_online(JournalFile *f) { | ||
29 | assert(f); | ||
30 | |||
31 | @@ -218,8 +221,7 @@ | ||
32 | journal_file_set_online(f); | ||
33 | |||
34 | /* Sync the online state to disk */ | ||
35 | - msync(f->header, PAGE_ALIGN(sizeof(Header)), MS_SYNC); | ||
36 | - fdatasync(f->fd); | ||
37 | + fsync(f->fd); | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | @@ -313,7 +315,7 @@ | ||
42 | } | ||
43 | |||
44 | static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { | ||
45 | - uint64_t old_size, new_size; | ||
46 | + uint64_t old_size, new_size, file_size; | ||
47 | int r; | ||
48 | |||
49 | assert(f); | ||
50 | @@ -333,12 +335,10 @@ | ||
51 | if (new_size <= old_size) | ||
52 | return 0; | ||
53 | |||
54 | - if (f->metrics.max_size > 0 && | ||
55 | - new_size > f->metrics.max_size) | ||
56 | + if (f->metrics.max_size > 0 && new_size > f->metrics.max_size) | ||
57 | return -E2BIG; | ||
58 | |||
59 | - if (new_size > f->metrics.min_size && | ||
60 | - f->metrics.keep_free > 0) { | ||
61 | + if (new_size > f->metrics.min_size && f->metrics.keep_free > 0) { | ||
62 | struct statvfs svfs; | ||
63 | |||
64 | if (fstatvfs(f->fd, &svfs) >= 0) { | ||
65 | @@ -363,8 +363,16 @@ | ||
66 | if (r != 0) | ||
67 | return -r; | ||
68 | |||
69 | - if (fstat(f->fd, &f->last_stat) < 0) | ||
70 | - return -errno; | ||
71 | + /* Increase the file size a bit further than this, so that we | ||
72 | + * we can create larger memory maps to cache */ | ||
73 | + file_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE; | ||
74 | + if (file_size > (uint64_t) f->last_stat.st_size) { | ||
75 | + if (file_size > new_size) | ||
76 | + ftruncate(f->fd, file_size); | ||
77 | + | ||
78 | + if (fstat(f->fd, &f->last_stat) < 0) | ||
79 | + return -errno; | ||
80 | + } | ||
81 | |||
82 | f->header->arena_size = htole64(new_size - le64toh(f->header->header_size)); | ||
83 | |||