daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From 3740b7a6d246a5860c8f1d96504bbf00692447e0 Mon Sep 17 00:00:00 2001
923a60
From: Goffredo Baroncelli <kreijack@inwind.it>
923a60
Date: Sun, 12 Apr 2015 20:30:28 +0200
923a60
Subject: [PATCH] tmpfiles: Add +C attrib to the journal files directories
923a60
923a60
Add the +C file attribute (NOCOW) to the journal directories, so that
923a60
the flag is inherited automatically for new journal files created in
923a60
them. The journal write pattern is problematic on btrfs file systems as
923a60
it results in badly fragmented files when copy-on-write (COW) is used:
923a60
the performances decreases substantially over time.
923a60
923a60
To avoid this issue, this tmpfile.d snippet sets the NOCOW attribute to
923a60
the journal files directories, so newly created journal files inherit
923a60
the NCOOW attribute that disables copy-on-write.
923a60
923a60
Be aware that the NOCOW file attribute also disables btrfs checksumming
923a60
for these files, and thus prevents btrfs from rebuilding corrupted files
923a60
on a RAID filesystem.
923a60
923a60
In a single disk filesystems (or filesystems without redundancy) it is
923a60
safe to use the NOCOW flags without drawbacks, since the journal files
923a60
contain their own checksumming.
923a60
923a60
(cherry picked from commit 3a92e4ba470611ceec6693640b05eb248d62e32d)
923a60
923a60
Related: #1299714
923a60
---
923a60
 tmpfiles.d/journal-nocow.conf | 27 +++++++++++++++++++++++++++
923a60
 1 file changed, 27 insertions(+)
923a60
 create mode 100644 tmpfiles.d/journal-nocow.conf
923a60
923a60
diff --git a/tmpfiles.d/journal-nocow.conf b/tmpfiles.d/journal-nocow.conf
923a60
new file mode 100644
923a60
index 0000000000..e7938c8911
923a60
--- /dev/null
923a60
+++ b/tmpfiles.d/journal-nocow.conf
923a60
@@ -0,0 +1,27 @@
923a60
+#  This file is part of systemd.
923a60
+#
923a60
+#  systemd is free software; you can redistribute it and/or modify it
923a60
+#  under the terms of the GNU Lesser General Public License as published by
923a60
+#  the Free Software Foundation; either version 2.1 of the License, or
923a60
+#  (at your option) any later version.
923a60
+
923a60
+# See tmpfiles.d(5) for details
923a60
+
923a60
+# Set the NOCOW attribute for directories of journal files. This flag
923a60
+# is inheredited by their new files and sub-directories. Matters only
923a60
+# for btrfs filesystems.
923a60
+#
923a60
+# WARNING: Enabling the NOCOW attribute improves journal performance
923a60
+#     substantially, but also disables the btrfs checksum logic. In
923a60
+#     btrfs RAID filesystems the checksums are needed for rebuilding
923a60
+#     corrupted files. Without checksums such rebuilds are not
923a60
+#     possible.
923a60
+#
923a60
+# In a single-disk filesystem (or a filesystem without redundancy)
923a60
+# enabling the NOCOW attribute for journal files is safe, because
923a60
+# they have their own checksums and a rebuilding wouldn't be possible
923a60
+# in any case.
923a60
+
923a60
+h /var/log/journal - - - - +C
923a60
+h /var/log/journal/%m - - - - +C
923a60
+h /var/log/journal/remote - - - - +C