From: David Sterba <dsterba@suse.cz>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: skip compression property for anything other than files and dirs
Date: Thu, 21 Apr 2022 19:02:27 +0200 [thread overview]
Message-ID: <20220421170227.GF18596@twin.jikos.cz> (raw)
In-Reply-To: <bbb363e71d966670d8938898803dac2b8a581c7c.1650535137.git.fdmanana@suse.com>
On Thu, Apr 21, 2022 at 11:01:22AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The compression property only has effect on regular files and directories
> (so that it's propagated to files and subdirectories created inside a
> directory). For any other inode type (symlink, fifo, device, socket),
> it's pointless to set the compression property because it does nothing
> and ends up unnecessarily wasting leaf space due to the pointless xattr
> (75 or 76 bytes, depending on the compression value). Symlinks in
> particular are very common (for example, I have almost 10k symlinks under
> /etc, /usr and /var alone) and therefore it's worth to avoid wasting
> leaf space with the compression xattr.
>
> For example, the compression property can end up on a symlink or character
> device implicitly, through inheritance from a parent directory
>
> $ mkdir /mnt/testdir
> $ btrfs property set /mnt/testdir compression lzo
>
> $ ln -s yadayada /mnt/testdir/lnk
> $ mknod /mnt/testdir/dev c 0 0
>
> Or explicitly like this:
>
> $ ln -s yadayda /mnt/lnk
> $ setfattr -h -n btrfs.compression -v lzo /mnt/lnk
>
> So skip the compression property on inodes that are neither a regular
> file nor a directory.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Added to misc-next, thanks.
prev parent reply other threads:[~2022-04-21 17:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 10:01 [PATCH] btrfs: skip compression property for anything other than files and dirs fdmanana
2022-04-21 13:41 ` Anand Jain
2022-04-21 13:51 ` Filipe Manana
2022-04-25 15:42 ` Anand Jain
2022-04-21 17:02 ` David Sterba [this message]
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=20220421170227.GF18596@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.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