[systemd-devel] [RFC][PATCH] Add option to enable COW for journal file

Lennart Poettering lennart at poettering.net
Fri Mar 6 04:31:57 PST 2015


On Thu, 05.03.15 21:39, Goffredo Baroncelli (kreijack at libero.it) wrote:

> 
> Hi All,
> the enclosed patches add an option to the journald.conf file to allow
> a COW behavior for the journal files.
> 
> The commit 11689d2a force the NOCOW flag of the journal files. This was 
> needed because systemd-journald has very poor performance when the
> filesytem is BTRFS due to its the COW behavior.
> 
> However removing the COW behavior, the journal file also lost  the
> btrfs checksum protection, and this disables the BTRFS capability to rebuild a
> corrupted file [1] in a RAID filesystem. So this limits one of the biggest
> benefit of BTRFS.
>     
> This patch adds the option "CowJournal" to the journald.conf to disable/enable
> the NOCOW flag for the journal file, allowing to revert to the old behavior.
> 
> These patches are tagged as RFC, because I am not sure about the
> naming of the option (now "CowJournal"). I ask some feedback.

I am pretty strongly against adding an explicit option for this. I
consider this all a temporary stopgap, until btrfs's autodefrag makes
the problem go away, and I am very conservative with adding new config
options where it is already clear that they will eventually be
useless.

What I'd be open to is:

a) beef up the tmpfiles logic to be able to do the equivalent of
   /usr/bin/chattr on files. (By adding a new line type, make "h" or
   so).

b) remove all code that sets NOCOW explicitly on journal files from
   journald.

c) instead ship a tmpfiles snippet making use of a) that sets the
   NOCOW flag for /var/lib/journal, which results in the flag being
   inherited by journal files that are created within it.

If people then want to opt-out of NOCOW, they can simply override the
tmpfiles snippet and all is good. That way we have a way to configure
the bit, without actually introducing a high-level config option for
this.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list