Skip to content

Commit

Permalink
v2v: Add -o discard option when fstrimming.
Browse files Browse the repository at this point in the history
This *may* be required by some filesystems in order for fstrim to
work.  I'm not actually sure if this is true, but it's what
virt-sparsify --in-place does, and that utility has been tested a lot
more in regards to trimming.

(cherry picked from commit dd22e37)
  • Loading branch information
rwmjones committed Aug 18, 2016
1 parent 91db4de commit 2e9687c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion v2v/v2v.ml
Expand Up @@ -421,7 +421,10 @@ and do_fstrim g no_trim inspect =
List.iter (
fun dev ->
g#umount_all ();
let mounted = try g#mount dev "/"; true with G.Error _ -> false in
let mounted =
try g#mount_options "discard" dev "/"; true
with G.Error _ -> false in

if mounted then (
try g#fstrim "/"
with G.Error msg ->
Expand Down

0 comments on commit 2e9687c

Please sign in to comment.