SHA256
1
0
forked from pool/systemd
systemd/0014-journald-with-journaling-FS.patch
Dominique Leuenberger a4023d0c37 Accepting request 333777 from Base:System
- Fix patch tty-ask-password-agent-on-console.patch not to crash
  away but enable it to ask on all devices of /dev/console

- Avoid "file not found /etc/udev/rules.d/70-persistent-net.rules"
  waring occurring in %post

- Add patch let-vconsole-setup-get-properties-only-once-to-copy-them.patch
  to avoid broken virtual console mapping due stressed ioctl API
  for the virtual consoles (boo#904214)

- Fix last change that is use the new name for udev packages in %pretrans. 

- restore usage of LUA in %pretrans.

- Try to generate the systemd users and groups always in same order
  to avoid republish other packages (boo#944660) 

- cleanup specfile by removing commands that were dealing with systemd
  pre-generated files: we're now using systemd tarball generated directly
  from the git repo which doesn't contain any of these files.
- there's no point in using LUA in %pretrans

- Drop 0009-make-xsltproc-use-correct-ROFF-links.patch
This patch was initialy added to workaround bsc#842844. But it
appears that man(1) was fixed (included since 13.2 at least) to
handle manual pages that consist only of a .so directive such as
'.so <page>'.

- Change use-rndaddentropy-ioctl-to-load-random-seed.patch to
  make it work on big endian

OBS-URL: https://build.opensuse.org/request/show/333777
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=223
2015-09-27 12:32:31 +00:00

75 lines
2.7 KiB
Diff

From: werner@suse.de
Upstream: marked as openSUSE-specific fix originally, but may well
worth be to be sent upstream.
Original description:
(none)
Augmented description [jengelh@inai.de]:
Disable COW on journal files, as that is naturally leading to a lot
of unwanted fragmentation on btrfs.
No word on compression…
---
src/journal/journald-server.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
Index: systemd-221/src/journal/journald-server.c
===================================================================
--- systemd-221.orig/src/journal/journald-server.c
+++ systemd-221/src/journal/journald-server.c
@@ -21,6 +21,7 @@
#include <sys/signalfd.h>
#include <sys/ioctl.h>
+#include <linux/fs.h>
#include <linux/sockios.h>
#include <sys/statvfs.h>
#include <sys/mman.h>
@@ -918,6 +919,38 @@ finish:
dispatch_message_real(s, iovec, n, m, ucred, tv, label, label_len, unit_id, priority, object_pid);
}
+/*
+ * On journaling and/or compressing file systems, avoid doubling the efforts
+ * for the system, that is, set NOCOW and NOCOMP inode flags. Check for every
+ * single flag, as otherwise, some of the file systems may return EOPNOTSUPP on
+ * a single unkown flag (like BtrFS does).
+ *
+ * …but src/journal/journal-file.c already sets NOCOW too…⸘
+ */
+static void disable_cow(const char *dir, const Server *serv)
+{
+ unsigned long flags;
+ int fd = open(dir, O_DIRECTORY);
+
+ if (fd < 0)
+ return;
+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) {
+ unsigned long old = flags;
+ if (!(flags & FS_NOATIME_FL) &&
+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOATIME_FL) == 0)
+ flags |= FS_NOATIME_FL;
+ if (!(flags & FS_NOCOW_FL) &&
+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOCOW_FL) == 0)
+ flags |= FS_NOCOW_FL;
+ if (!(flags & FS_NOCOMP_FL) && serv->compress) {
+ flags &= ~FS_COMPR_FL;
+ flags |= FS_NOCOMP_FL;
+ }
+ if (old != flags)
+ ioctl(fd, FS_IOC_SETFLAGS, flags);
+ }
+ close(fd);
+}
static int system_journal_open(Server *s, bool flush_requested) {
int r;
@@ -947,6 +980,7 @@ static int system_journal_open(Server *s
fn = strjoina("/var/log/journal/", ids);
(void) mkdir(fn, 0755);
+ disable_cow(fn, s);
fn = strjoina(fn, "/system.journal");
r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal);