Blame SOURCES/0168-sparsify-Warn-instead-of-error-if-a-filesystem-canno.patch

e76f14
From 27194a339768ec34de52f4e00d3fca36f7e65058 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Fri, 5 Aug 2016 12:20:00 +0100
e76f14
Subject: [PATCH] sparsify: Warn instead of error if a filesystem cannot be
e76f14
 fstrimmed (RHBZ#1364347).
e76f14
e76f14
Thanks:  Xianghua Chen
e76f14
(cherry picked from commit 4d5335a56d709fdd4357ab9ae04ba0a758b12fe9)
e76f14
---
e76f14
 sparsify/in_place.ml | 9 ++++++++-
e76f14
 1 file changed, 8 insertions(+), 1 deletion(-)
e76f14
e76f14
diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml
e76f14
index 5cd03ef..e2ee9d9 100644
e76f14
--- a/sparsify/in_place.ml
e76f14
+++ b/sparsify/in_place.ml
e76f14
@@ -89,7 +89,14 @@ let run disk format ignores machine_readable zeroes =
e76f14
             if mounted then (
e76f14
               message (f_"Trimming %s") fs;
e76f14
 
e76f14
-              g#fstrim "/"
e76f14
+              try g#fstrim "/"
e76f14
+              with G.Error msg as exn ->
e76f14
+                if g#last_errno () = G.Errno.errno_ENOTSUP then (
e76f14
+                  let vfs_type = try g#vfs_type fs with _ -> "unknown" in
e76f14
+                  warning (f_"fstrim operation is not supported on %s (%s).  Suppress this warning using '--ignore %s', or use copying mode instead.")
e76f14
+                          fs vfs_type fs
e76f14
+                )
e76f14
+                else raise exn
e76f14
             ) else (
e76f14
               let is_linux_x86_swap =
e76f14
                 (* Look for the signature for Linux swap on i386.
e76f14
-- 
aa0300
2.7.4
e76f14