Blame SOURCES/0172-v2v-Add-o-discard-option-when-fstrimming.patch

e76f14
From 2e9687c784cd19f6ac1c426d7578de65e55025c9 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Fri, 12 Aug 2016 10:34:54 +0100
e76f14
Subject: [PATCH] v2v: Add -o discard option when fstrimming.
e76f14
e76f14
This *may* be required by some filesystems in order for fstrim to
e76f14
work.  I'm not actually sure if this is true, but it's what
e76f14
virt-sparsify --in-place does, and that utility has been tested a lot
e76f14
more in regards to trimming.
e76f14
e76f14
(cherry picked from commit dd22e376c4ec8fd7c78c78f94c60bb763ddcf08f)
e76f14
---
e76f14
 v2v/v2v.ml | 5 ++++-
e76f14
 1 file changed, 4 insertions(+), 1 deletion(-)
e76f14
e76f14
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
e76f14
index 21f8d77..561317c 100644
e76f14
--- a/v2v/v2v.ml
e76f14
+++ b/v2v/v2v.ml
e76f14
@@ -421,7 +421,10 @@ and do_fstrim g no_trim inspect =
e76f14
   List.iter (
e76f14
     fun dev ->
e76f14
       g#umount_all ();
e76f14
-      let mounted = try g#mount dev "/"; true with G.Error _ -> false in
e76f14
+      let mounted =
e76f14
+        try g#mount_options "discard" dev "/"; true
e76f14
+        with G.Error _ -> false in
e76f14
+
e76f14
       if mounted then (
e76f14
         try g#fstrim "/"
e76f14
         with G.Error msg ->
e76f14
-- 
aa0300
2.7.4
e76f14