summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-08 01:22:29 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-08 01:22:29 +0100
commit11689d2a021d95a8447d938180e0962cd9439763 (patch)
tree83e4e1a10a219bd6344e995f445b4fe95ed54acb /src/journal/journalctl.c
parent3c4230a5afb27faec2176d4642c0e2e145971b5c (diff)
journald: turn off COW for journal files on btrfs
btrfs' COW logic results in heavily fragment journal files, which is detrimental for perfomance. Hence, turn off COW for journal files as we create them. Turning off COW comes at the cost of data integrity guarantees, but this should be acceptable, given that we do our own checksumming, and generally have a pretty conservative write pattern. Also see discussion on linux-btrfs: http://www.spinics.net/lists/linux-btrfs/msg41001.html
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 386e3505c0..62931f14c9 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1294,7 +1294,7 @@ static int setup_keys(void) {
size_t mpk_size, seed_size, state_size, i;
uint8_t *mpk, *seed, *state;
ssize_t l;
- int fd = -1, r, attr = 0;
+ int fd = -1, r;
sd_id128_t machine, boot;
char *p = NULL, *k = NULL;
struct FSSHeader h;
@@ -1389,13 +1389,9 @@ static int setup_keys(void) {
/* Enable secure remove, exclusion from dump, synchronous
* writing and in-place updating */
- if (ioctl(fd, FS_IOC_GETFLAGS, &attr) < 0)
- log_warning_errno(errno, "FS_IOC_GETFLAGS failed: %m");
-
- attr |= FS_SECRM_FL|FS_NODUMP_FL|FS_SYNC_FL|FS_NOCOW_FL;
-
- if (ioctl(fd, FS_IOC_SETFLAGS, &attr) < 0)
- log_warning_errno(errno, "FS_IOC_SETFLAGS failed: %m");
+ r = chattr_fd(fd, true, FS_SECRM_FL|FS_NODUMP_FL|FS_SYNC_FL|FS_NOCOW_FL);
+ if (r < 0)
+ log_warning_errno(errno, "Failed to set file attributes: %m");
zero(h);
memcpy(h.signature, "KSHHRHLP", 8);