linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Erik Logtenberg <erik@logtenberg.eu>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: What do the arguments of btrfs filesystem defragment do?
Date: Wed, 15 Dec 2010 14:57:01 -0500	[thread overview]
Message-ID: <1292441925-sup-1105@think> (raw)
In-Reply-To: <4D091679.80706@logtenberg.eu>

Excerpts from Erik Logtenberg's message of 2010-12-15 14:26:49 -0500:
> >> Is there a decent way to have btrfs compress already existing files
> >> (that were written before compression was enabled) without hurting any
> >> of the internal structures such as snapshots?
> > 
> > I'm afraid not yet.  There is code for this in the btrfs balance
> > routines, but we haven't yet adapted it to the defragment command.
> 
> Okay, just to be 100% sure, if I add -o compress to the mount options,
> this will cause btrfs to (try to) compress newly written files, right?

Yes

> Is this fully compatible with existing snapshots, or will compressing
> files always (have a chance to) hurt COW relations?

COW references (both via snapshotting and cp --reflink) are broken when
you change the file in either copy.  While the
files are the same, they are shared and the parts that change are
private to each copy.  If you have a reflink copy of a 1TB file and
change only 4K in the middle, the other 1TB-4KB are still shared.

This is true for both the default and with compression on.

> 
> The use case is a filesystem used for backups, which are rsynced
> nightly, after which a new snapshot is made. After something like 45
> days, the old snapshots are removed. I am assuming that this way, after
> 45 days all files will be compressed naturally, but this is only
> beneficial if snapshots still fully work. If instead it results in
> storing the compressed form of every file 45 times on disk, then it
> won't help much.

Yes, you'll end up with a fully compressed and fully shared setup after
45 days.

-chris

  reply	other threads:[~2010-12-15 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 16:06 What do the arguments of btrfs filesystem defragment do? Erik Logtenberg
2010-12-15 19:08 ` Chris Mason
2010-12-15 19:14   ` Erik Logtenberg
2010-12-15 19:20     ` Chris Mason
2010-12-15 19:26       ` Erik Logtenberg
2010-12-15 19:57         ` Chris Mason [this message]
2010-12-16  8:41           ` Oystein Viggen
2010-12-16 20:48       ` David Nicol
2010-12-15 19:18 ` Goffredo Baroncelli

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=1292441925-sup-1105@think \
    --to=chris.mason@oracle.com \
    --cc=erik@logtenberg.eu \
    --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;
as well as URLs for NNTP newsgroup(s).