systemd/0014-journald-with-journaling-FS.patch
Dominique Leuenberger 70c63e98f9 Accepting request 286653 from Base:System
- mark more subpackages as !bootstrap for systemd-mini usage.

- spec : remove --with-firmware-path, firmware loader was removed in v217
- spec: remove --disable-multi-seat-x, gone.(fixed in xorg)
- spec: Do not enable systemd-readahead-collect.service and
systemd-readahead-replay.service as these do not exist anymore.
- spec: drop timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch
  Yast was fixed to write all timezone changes exactly how timedated expects
  things to be done.
- spec: remove handle-etc-HOSTNAME.patch, since late 2014 the netcfg
  package handles the migration from /etc/HOSTNAME to /etc/hostname
  and owns both files.
-spec: remove boot.udev and systemd-journald.init as they currently
  serve no purpose.
- suse-sysv-bootd-support.diff: Remove HAVE_SYSVINIT conditions, we
   are in sysvcompat-only codepath, also remove the code targetting other
   distributions, never compiled as the TARGET_$DISTRO macros are never defined.
- systemd-powerd-initctl-support.patch guard with HAVE_SYSV_COMPAT
- set-and-use-default-logconsole.patch: fix HAVE_SYSV_COMPAT guards
- insserv-generator.patch: Only build when sysvcompat is enabled
- vhangup-on-all-consoles.patch add a comment indicating this is a workaround
  for a kernel bug.
- spec: Add option to allow disabling sysvinit compat at build time.
- spec: Add option to enable resolved at build time.
- spec: Remove all %ifs for !factory products, current systemd releases can
  neither be built nor installed in older products without upgrading
  several components of the base system. 
  (removed: 1008-add-msft-compability-rules.patch was only for =< 13.1)
- spec: remove all dummy "aliases" to /etc/init.d, that made sense only when
  those init scripts still existed. (dummy localfs.service source: gone)

OBS-URL: https://build.opensuse.org/request/show/286653
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=215
2015-03-01 13:49:19 +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/src/journal/journald-server.c
===================================================================
--- systemd.orig/src/journal/journald-server.c
+++ systemd/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>
@@ -917,6 +918,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;
@@ -946,6 +979,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);