2013-12-06 15:15:24 +01:00
|
|
|
--- systemd-208/src/journal/journald-server.c
|
2013-12-19 14:03:46 +01:00
|
|
|
+++ systemd-208/src/journal/journald-server.c 2013-12-10 16:31:50.770235717 +0000
|
2013-12-06 15:15:24 +01:00
|
|
|
@@ -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>
|
|
|
|
@@ -878,7 +879,7 @@ finish:
|
|
|
|
|
|
|
|
|
|
|
|
static int system_journal_open(Server *s) {
|
|
|
|
- int r;
|
|
|
|
+ int r, fd;
|
|
|
|
char *fn;
|
|
|
|
sd_id128_t machine;
|
|
|
|
char ids[33];
|
2013-12-19 14:03:46 +01:00
|
|
|
@@ -905,7 +906,31 @@ static int system_journal_open(Server *s
|
2013-12-06 15:15:24 +01:00
|
|
|
(void) mkdir("/var/log/journal/", 0755);
|
|
|
|
|
|
|
|
fn = strappenda("/var/log/journal/", ids);
|
|
|
|
- (void) mkdir(fn, 0755);
|
2013-12-19 14:03:46 +01:00
|
|
|
+ (void)mkdir(fn, 0755);
|
2013-12-06 15:15:24 +01:00
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 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 one unkown flag (like BtrFS does).
|
|
|
|
+ */
|
2013-12-19 14:03:46 +01:00
|
|
|
+ if ((fd = open(fn, O_DIRECTORY)) >= 0) {
|
2013-12-06 15:15:24 +01:00
|
|
|
+ long flags;
|
|
|
|
+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) {
|
2013-12-19 14:03:46 +01:00
|
|
|
+ int old = flags;
|
|
|
|
+ if (!(flags&FS_NOATIME_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOATIME_FL) == 0)
|
2013-12-06 15:15:24 +01:00
|
|
|
+ flags |= FS_NOATIME_FL;
|
2013-12-19 14:03:46 +01:00
|
|
|
+ if (!(flags&FS_NOCOW_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOCOW_FL) == 0)
|
2013-12-06 15:15:24 +01:00
|
|
|
+ flags |= FS_NOCOW_FL;
|
2013-12-19 14:03:46 +01:00
|
|
|
+ if (!(flags&FS_NOCOMP_FL) && s->compress) {
|
2013-12-06 15:15:24 +01:00
|
|
|
+ flags &= ~FS_COMPR_FL;
|
|
|
|
+ flags |= FS_NOCOMP_FL;
|
|
|
|
+ }
|
2013-12-19 14:03:46 +01:00
|
|
|
+ if (old != flags)
|
|
|
|
+ ioctl(fd, FS_IOC_SETFLAGS, flags);
|
2013-12-06 15:15:24 +01:00
|
|
|
+ }
|
|
|
|
+ close(fd);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
fn = strappenda(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);
|