On Mon, Sep 4, 2017 at 11:31 AM, Marat Khalili <m...@rqc.ru> wrote: > Hello list, > good time of the day, > > More than once I see mentioned in this list that autodefrag option solves > problems with no apparent drawbacks, but it's not the default. Can you > recommend to just switch it on indiscriminately on all installations?
Of course it has drawbacks, it depends on the use-cases on the filesystem what your trade-off is. If the filesystem is created log time ago and has 4k leafes the on HDD over time you get exessive fragmentation and scattered 4k blocks all over the disk for a file with a lot random writes (standard CoW for whole fs), like a 50G vm image, easily 500k extents. With autodefrag on from the beginning of fs creation, most extent/blocksizes will be 128k or 256k in that order and then amount of extents for the same vm image is roughly 50k. So statistically, the average blocksize is not 4k but 128k, which is at least less free space fragmentation (I use SSD caching of HDD otherwise also those 50k extents result in totally unacceptable performance). But also for newer standard 16k leafes, it is more or less the same story. The drawbacks for me are: 1. I use nightly differential snapshotting for backup/replication over a metered mobile network link, and this autodefrag causes a certain amount of unnessccesaty fake content difference due to send|receive based on CoW. But the amount of extra datavolume it causes is still acceptable. If I would let the guest OS defragment its fs inside the vm image for example, then the datavolume per day becomes unacceptable. 2. It causes extra HDD activity, so noise, powerconsumption etc, which might be unacceptable for some use-cases. > I'm currently on kernel 4.4, can switch to 4.10 if necessary (it's Ubuntu > that gives us this strange choice, no idea why it's not 4.9). Only spinning > rust here, no SSDs. Kernel 4.4 is new enough w.r.t. autodefrag, but if you can switch to 4.8 or newer, I would do so. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html