anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0528-tmpfiles-Add-C-attrib-to-the-journal-files-directori.patch

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