On Mon, Dec 21, 2015 at 09:28:37AM +0000, Filipe Manana wrote:
> On Mon, Dec 21, 2015 at 8:14 AM, Hugo Mills <h...@carfax.org.uk> wrote:
> > On Sun, Dec 20, 2015 at 07:26:07PM -0600, Donald Pearson wrote:
> >> I read an implication in a different thread that defrag and autodefrag
> >> behave differently in that autodefrag is more snapshot friendly for
> >> COW data.
> >>
> >> Did I understand that correctly?  I have not been doing defrag on my
> >> virtual machine image directory because I do use a snapshot schedule
> >> and the way I understood things, a defrag would basically decouple the
> >> live data from the snapshots and greatly increase utilization.
> >>
> >> It sounded like autodefrag does not have this problem?
> >
> >    Correct.
> 
> Hum?
> How is that so? Snapshot-aware defrag was disabled almost 2 years ago,
> and that piece of code is used both by a "manual" defrag (ioctl) and
> by automatic defrag.

   A couple of days ago (it's been a busy week) I started writing a
rebuttal of this based on the behaviour of filesystems with autodefrag
set on. Then I realised that actually, we're both right. :)

   If autodefrag behaves as you say (and I'm sure it does, since you
know the code), then when you write data to a file, a piece of the
file around the write(s) can be copied and written elsewhere by
autodefrag. That's going to be the same as the manual defrag. However,
it's a relatively small separation effect that's likely lost in the
noise. If you rewrite the whole file, then it'll separate the file
completely -- which is what manual defrag does -- but then, you'd
expect that behaviour without autodefrag, too.

   So, ultimately, autodefrag *does* separate reflink copies, but only
near where writes are made to the file, so the overall effect is very
similar to the effect you'd have from writing to the file without
autodefrag.

   And I am now better informed than I was before. :)

   Hugo.

> >> If that's true, is there any case where it would not be best practice
> >> to mount with autodefrag enabled?
> >
> >    When you are already tight on I/O bandwidth for your application.
> > autodefrag increases the amount of I/O the disks do (because it's
> > rewriting parts of the file near each write, as well as just the piece
> > that's being written by userspace).
> >
> >    Hugo.
> >

-- 
Hugo Mills             | If the first-ever performance is the première, is
hugo@... carfax.org.uk | the last-ever performance the derrière?
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

Attachment: signature.asc
Description: Digital signature

Reply via email to