linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Paul Komkoff <i@stingr.net>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs defrag: how does it work?
Date: Wed, 19 Jan 2011 16:25:12 -0500	[thread overview]
Message-ID: <1295471646-sup-7764@think> (raw)
In-Reply-To: <AANLkTintJmDE7VVa5eTiepew68gztjh1j8Li1Fgq2iS6@mail.gmail.com>

Excerpts from Paul Komkoff's message of 2011-01-19 14:58:28 -0500:
> Hello.
> 
> [root@botva incoming]# btrfs fi defrag file-350mb
> [root@botva incoming]# filefrag file-350mb
> file-350mb: 132 extents found

The defrag code doesn't actually defrag.  It opens up the file and
recows all the extents and then the delayed allocation code jumps in and
makes the biggest possible extent that it can.

The reason why you're still seeing extents after running the defrag
command is because the file hasn't been written yet, so the delayed
allocation code hasn't kicked in.

If you use btrfs fi defrag -f it'll trigger writeback on the file and
you should see the results of the defrag sooner.

-chris

  reply	other threads:[~2011-01-19 21:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 19:58 btrfs defrag: how does it work? Paul Komkoff
2011-01-19 21:25 ` Chris Mason [this message]
2011-01-19 22:31   ` Paul Komkoff
2011-01-19 22:49     ` Mitch Harder
2011-01-20 21:38     ` Chris Mason
2011-01-22 13:38       ` Paul Komkoff

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=1295471646-sup-7764@think \
    --to=chris.mason@oracle.com \
    --cc=i@stingr.net \
    --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).