linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Does balance implicitly defrag?
@ 2013-07-02 13:28 Paul Richards
  2013-07-08 21:12 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Richards @ 2013-07-02 13:28 UTC (permalink / raw)
  To: linux-btrfs

When I run "btrfs filesystem balance", does this implicitly
defragment the filesystem?  (Assuming there is plenty free space)

--
Paul Richards
@pauldoo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does balance implicitly defrag?
  2013-07-02 13:28 Does balance implicitly defrag? Paul Richards
@ 2013-07-08 21:12 ` David Sterba
  2013-07-08 21:30   ` Paul Richards
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2013-07-08 21:12 UTC (permalink / raw)
  To: Paul Richards; +Cc: linux-btrfs

On Tue, Jul 02, 2013 at 02:28:25PM +0100, Paul Richards wrote:
> When I run "btrfs filesystem balance", does this implicitly
> defragment the filesystem?  (Assuming there is plenty free space)

In some sense it defragments the filesystem. The blockgroups are moved
around based on the balance filter. Here a blockgroup consists of
various and unrelated file extents. Extents representing a single file
are not made contiguous, this is done by 'btrfs file defrag'.

I think that the final layout of the 1G-chunks is not necessarily
contiguous, ie. it depends on the chunk-allocator, the time of the
allocation request and there's nothing like "preallocate 30G for whole
balance and put all data together because the space is available".

david

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does balance implicitly defrag?
  2013-07-08 21:12 ` David Sterba
@ 2013-07-08 21:30   ` Paul Richards
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Richards @ 2013-07-08 21:30 UTC (permalink / raw)
  To: dsterba, Paul Richards, linux-btrfs

On 8 July 2013 22:12, David Sterba <dsterba@suse.cz> wrote:
> On Tue, Jul 02, 2013 at 02:28:25PM +0100, Paul Richards wrote:
>> When I run "btrfs filesystem balance", does this implicitly
>> defragment the filesystem?  (Assuming there is plenty free space)
>
> In some sense it defragments the filesystem. The blockgroups are moved
> around based on the balance filter. Here a blockgroup consists of
> various and unrelated file extents. Extents representing a single file
> are not made contiguous, this is done by 'btrfs file defrag'.
>
> I think that the final layout of the 1G-chunks is not necessarily
> contiguous, ie. it depends on the chunk-allocator, the time of the
> allocation request and there's nothing like "preallocate 30G for whole
> balance and put all data together because the space is available".
>

Okay, I think I understand.  It sounds like balance will fix external
fragmentation (within the block groups, up to the 1G-chunk
granularity), and will not fix any internal fragmentation.

Thanks. :)




--
Paul Richards
@pauldoo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-08 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 13:28 Does balance implicitly defrag? Paul Richards
2013-07-08 21:12 ` David Sterba
2013-07-08 21:30   ` Paul Richards

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).