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. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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
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. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html