* Does defragmenting even work
@ 2013-02-28 14:35 Swâmi Petaramesh
2013-02-28 14:44 ` cwillu
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Swâmi Petaramesh @ 2013-02-28 14:35 UTC (permalink / raw)
To: BTRFS, Linux
BTW...
I'm not even sure that "btrfs filesystem defrag <somefile>" actually
does anything...
If I run "filefrag <somefile>" afterwards, it typically shows the same
number of fragments that it did prior to running defrag...
I'm not sure about how it actually works and what I should expect...
--
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Does defragmenting even work
2013-02-28 14:35 Does defragmenting even work Swâmi Petaramesh
@ 2013-02-28 14:44 ` cwillu
2013-02-28 15:00 ` Calvin Walton
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: cwillu @ 2013-02-28 14:44 UTC (permalink / raw)
To: Swâmi Petaramesh; +Cc: BTRFS, Linux
On Thu, Feb 28, 2013 at 8:35 AM, Swâmi Petaramesh <swami@petaramesh.org> wrote:
> BTW...
>
> I'm not even sure that "btrfs filesystem defrag <somefile>" actually
> does anything...
>
> If I run "filefrag <somefile>" afterwards, it typically shows the same
> number of fragments that it did prior to running defrag...
>
> I'm not sure about how it actually works and what I should expect...
Can't explain something if I can't see the data I'm explaining :p
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Does defragmenting even work
2013-02-28 14:35 Does defragmenting even work Swâmi Petaramesh
2013-02-28 14:44 ` cwillu
@ 2013-02-28 15:00 ` Calvin Walton
2013-02-28 15:00 ` Hugo Mills
2013-02-28 15:35 ` Martin Steigerwald
3 siblings, 0 replies; 6+ messages in thread
From: Calvin Walton @ 2013-02-28 15:00 UTC (permalink / raw)
To: Swâmi Petaramesh; +Cc: BTRFS, Linux
On Thu, 2013-02-28 at 15:35 +0100, Swâmi Petaramesh wrote:
> BTW...
>
> I'm not even sure that "btrfs filesystem defrag <somefile>" actually
> does anything...
>
> If I run "filefrag <somefile>" afterwards, it typically shows the same
> number of fragments that it did prior to running defrag...
If you have compression enabled in your system, the files are split up
into smallish extents for the compression blocks. Merely counting the
number of fragments doesn't really give you any useful information - you
have to check if the fragments are contiguous.
Try running "filefrag -v somefile", and compare the 'physical' and
'expected' values to look for gaps between fragments.
--
Calvin Walton <calvin.walton@kepstin.ca>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Does defragmenting even work
2013-02-28 14:35 Does defragmenting even work Swâmi Petaramesh
2013-02-28 14:44 ` cwillu
2013-02-28 15:00 ` Calvin Walton
@ 2013-02-28 15:00 ` Hugo Mills
2013-02-28 15:16 ` Swâmi Petaramesh
2013-02-28 15:35 ` Martin Steigerwald
3 siblings, 1 reply; 6+ messages in thread
From: Hugo Mills @ 2013-02-28 15:00 UTC (permalink / raw)
To: Swâmi Petaramesh; +Cc: BTRFS, Linux
[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]
On Thu, Feb 28, 2013 at 03:35:28PM +0100, Swâmi Petaramesh wrote:
> BTW...
>
> I'm not even sure that "btrfs filesystem defrag <somefile>" actually
> does anything...
>
> If I run "filefrag <somefile>" afterwards, it typically shows the same
> number of fragments that it did prior to running defrag...
>
> I'm not sure about how it actually works and what I should expect...
If you have a compressed file, each compression block (128k of
compressed data, if I remember rightly) will show up as a separate
fragment, even if it's contiguous with the others -- it's an artefact
of the way that fiemap/filefrag calculates fragments, and the way that
btrfs reports compressed files.
Also, on a full filesystem, complete defragmentation may not be
completely possible.
Similarly, very large files may not be easy or possible to
defragment fully -- a 2GB file with four fragments isn't exactly a
problem, for example.
Hugo.
--
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- I'm all for giving people enough rope to shoot themselves in ---
the foot -- Andreas Dilger
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Does defragmenting even work
2013-02-28 15:00 ` Hugo Mills
@ 2013-02-28 15:16 ` Swâmi Petaramesh
0 siblings, 0 replies; 6+ messages in thread
From: Swâmi Petaramesh @ 2013-02-28 15:16 UTC (permalink / raw)
To: Hugo Mills, BTRFS, Linux; +Cc: Calvin Walton
Thanks Hugo, ans thanks Calvin for your clear explanations.
I actually use compression on all of my FSes, and I have seen that
"filefrag -v" reports different "physical" and "expected" values for
many files, meaning of which I didn't understand at all.
This said, I now assume that my current script approach "check with
filefrag it the file presents any (apparent) fragmentation, if yes run
defrag on it" may be good enough, or would it be more efficient to
directly run defrag on all files without bothering checking it they
(may) be fragmented or not (which boils down to : "which of filefrag or
btrfs defrag runs faster ?") ?
Also, does "btrfs filesystem defrag" does anything smart for
defragmenting free space, or does it only care about defragmenting the
file it was asked to process ?
Anyway I hope to recover "brand new-like" performance after having
removed all snapshots and defragged everything...
Remains the issue of the open files, I'm not sure if it's worth trying
to defragment them with the system running from a live USB stick or so...?
Kind regards.
Le 28/02/2013 16:00, Hugo Mills a écrit :
> If you have a compressed file, each compression block (128k of
> compressed data, if I remember rightly) will show up as a separate
> fragment, even if it's contiguous with the others -- it's an artefact
> of the way that fiemap/filefrag calculates fragments, and the way that
> btrfs reports compressed files. Also, on a full filesystem, complete
> defragmentation may not be completely possible. Similarly, very large
> files may not be easy or possible to defragment fully -- a 2GB file
> with four fragments isn't exactly a problem, for example. Hugo.
--
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Does defragmenting even work
2013-02-28 14:35 Does defragmenting even work Swâmi Petaramesh
` (2 preceding siblings ...)
2013-02-28 15:00 ` Hugo Mills
@ 2013-02-28 15:35 ` Martin Steigerwald
3 siblings, 0 replies; 6+ messages in thread
From: Martin Steigerwald @ 2013-02-28 15:35 UTC (permalink / raw)
To: linux-btrfs; +Cc: Swâmi Petaramesh
Am Donnerstag, 28. Februar 2013 schrieb Swâmi Petaramesh:
> BTW...
>
> I'm not even sure that "btrfs filesystem defrag <somefile>" actually
> does anything...
>
> If I run "filefrag <somefile>" afterwards, it typically shows the same
> number of fragments that it did prior to running defrag...
>
> I'm not sure about how it actually works and what I should expect...
Again:
Make sure that you run "sync" before looking at the extent state with
filefrag -v
btrfs filesystem defrag may not have *immediate* effect.
I explained and demonstrated it in a response to you in the other thread
that has been about this.
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-28 15:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 14:35 Does defragmenting even work Swâmi Petaramesh
2013-02-28 14:44 ` cwillu
2013-02-28 15:00 ` Calvin Walton
2013-02-28 15:00 ` Hugo Mills
2013-02-28 15:16 ` Swâmi Petaramesh
2013-02-28 15:35 ` Martin Steigerwald
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).