On Mon, Dec 02, 2019 at 05:34:18PM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@xxxxxx>
>
> Snapshot-aware defrag has been disabled since commit 8101c8dbf624
> ("Btrfs: disable snapshot aware defrag for now") almost 6 years ago.
> Let's remove the dead code. If someone is up to the task of bringing it
> back, they can dig it up from git.
While I usually stand against code deletionists, in this case I will not
and apply the patch. This is a good example how not to implement
features or do post-merge stabilization. There were runtime problems
with defrag on heavily referenced extents (many snapshots) so this was
the main reason to disable it. There's a patchset from Josef from 2014
bitrotting in some of his trees that was supposed to fix it but this
hasn't happen.
Defrag has been known to break reflinks, from what I've heared some
users want that behaviour while others not. So this would be good to
make selectable on the defrag ioctl level. This is a broader task and
from brief look I haven't seen an easy way how to wire that to the
current ioctl. Which means a deeper analysis and design needs to happen
first.