Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* defrag makes fragmentation worse
@ 2011-10-08 22:17 Chester
  2011-10-11  6:19 ` Li Zefan
  0 siblings, 1 reply; 9+ messages in thread
From: Chester @ 2011-10-08 22:17 UTC (permalink / raw)
  To: linux-btrfs

Kernel 3.1-rc8
btrfs-progs-0.19
mount options: noatime,autodefrag (space_cache is enabled)
There are snapshots present on the filesystem.

When I do a btrfs fi defrag on a file, the file becomes much more
fragmented. The end result can be a file with 20k times more fragments
than before. Initially I thought the extents were just smaller but
were next to each other, so I checked with both 'filefrag' as well as
'filefrag -v'. Both reported the same number. I don't know if this has
anything to do with having snapshots at all because files that haven't
been snapshotted yet are affected by this. Disk space isn't an issue
since my 1TB disk isn't even halfway filled, and moving the file
around actually gives me fairly contiguous files.

^ permalink raw reply	[flat|nested] 9+ messages in thread
* defrag makes fragmentation worse
@ 2011-06-09 22:48 Johannes Hirte
  2011-06-09 23:53 ` David Sterba
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Hirte @ 2011-06-09 22:48 UTC (permalink / raw)
  To: linux-btrfs

I've observed several times that after a btrfs filesystem defrag a file was way 
more fragmented than before. For example, a file that was recently written, had 
10 extents (output from filefrag). After a defrag filefrag showed more than 1900 
extents. For curiosity, a simple copy of this "defragmented" file reduced the 
number of fragments to 1. With a different file I got 63 extents before and over 
3000 extents after defrag. 
It's no problem if defrag can't reduce the fragmentation. But in this case it 
shouldn't be done at all. 

regards,
  Johannes

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

end of thread, other threads:[~2011-10-12 15:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 22:17 defrag makes fragmentation worse Chester
2011-10-11  6:19 ` Li Zefan
2011-10-11 20:47   ` Chester
     [not found]     ` <CAAE6i0j=7ZoYnXsmNdWewmszSpaq4HLcy+M7--3s2hiy2p4TBA@mail.gmail.com>
2011-10-12  2:37       ` Li Zefan
2011-10-12  4:14         ` Chester
2011-10-12 15:14           ` Chris Mason
  -- strict thread matches above, loose matches on Subject: below --
2011-06-09 22:48 Johannes Hirte
2011-06-09 23:53 ` David Sterba
2011-06-23  0:12   ` Johannes Hirte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox