From: "Dr. Werner Fink" <werner@suse.de>
To: "Cristian Rodríguez" <crrodriguez@opensuse.org>
Cc: systemd-devel@lists.freedesktop.org, linux-btrfs@vger.kernel.org
Subject: Re: [systemd-devel] [PATCH 10/11] Avoid doubling the efforts for /var/log/journal
Date: Wed, 18 Jun 2014 11:44:31 +0200 [thread overview]
Message-ID: <20140618094431.GA6795@boole.suse.de> (raw)
In-Reply-To: <539F08D7.1070608@opensuse.org>
[-- Attachment #1: Type: text/plain, Size: 2899 bytes --]
On Mon, Jun 16, 2014 at 11:10:15AM -0400, Cristian Rodríguez wrote:
> El 13/06/14 10:41, Werner Fink escribió:
> > That is: set NOATIME, NOCOW, and NOCOMP for the journal directory
> >
> > ---
> > src/journal/journald-server.c | 29 +++++++++++++++++++++++++++--
> > 1 file changed, 27 insertions(+), 2 deletions(-)
> >
> > diff --git src/journal/journald-server.c src/journal/journald-server.c
> > index eda5dcf..37d6dc3 100644
> > --- src/journal/journald-server.c
> > +++ src/journal/journald-server.c
> > @@ -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>
> > @@ -920,7 +921,7 @@ finish:
> >
> >
> > static int system_journal_open(Server *s) {
> > - int r;
> > + int r, fd;
>
> _cleanup_close_ ...
>
> > + /*
> > + * 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).
> > + */
> > + if ((fd = open(fn, O_DIRECTORY)) >= 0) {
>
> O_CLOEXEC...
>
> > + long flags;
> > + if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) {
> > + int old = flags;
> > + if (!(flags&FS_NOATIME_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOATIME_FL) == 0)
> > + flags |= FS_NOATIME_FL;
> > + if (!(flags&FS_NOCOW_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOCOW_FL) == 0)
> > + flags |= FS_NOCOW_FL;
> > + if (!(flags&FS_NOCOMP_FL) && s->compress) {
> > + flags &= ~FS_COMPR_FL;
> > + flags |= FS_NOCOMP_FL;
> > + }
> > + if (old != flags)
> > + ioctl(fd, FS_IOC_SETFLAGS, flags);
> > + }
> > + close(fd);
> > + }
>
> I agree that this should be done, however I remain unconvinced this is
> the right place to do it..
IMHO this is the correct place as it helps to speed up systemd-journal
on BtrFS. This was the reason for this patch and is tested even if the
patch does not use _cleanup_close_ and O_CLOEXEC ;)
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
parent reply other threads:[~2014-06-18 9:44 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <539F08D7.1070608@opensuse.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140618094431.GA6795@boole.suse.de \
--to=werner@suse.de \
--cc=crrodriguez@opensuse.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=systemd-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).