[Libguestfs] [PATCH v2 00/18] Add discard support.

Richard W.M. Jones rjones at redhat.com
Wed Mar 12 13:44:22 UTC 2014


On Wed, Mar 12, 2014 at 10:53:06AM +0100, Pino Toscano wrote:
> On Tuesday 11 March 2014 23:13:43 Richard W.M. Jones wrote:
> > This still isn't working at the moment.  See:
> > http://marc.info/?t=139457409300003&r=1&w=2
> > 
> > This set of patches:
> > 
> >  - Adds new APIs to support discard in libguestfs.
> > 
> >  - Adds discard support to virt-format.
> > 
> >  - Adds discard support to virt-sysprep.
> > 
> >  - Implements virt-sparsify --in-place.
> 
> Do you plan to wait to solve the issues (wrt the linux-ext4 discussion) 
> before pushing the series?

I just fixed it.  There is a stupid mistake in daemon/fstrim.c:

>From edee98c2e44838bf4cd997886fbabd308d5e379f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Wed, 12 Mar 2014 13:41:39 +0000
Subject: [PATCH] daemon: fstrim: Fix fstrim so it trims the correct
 filesystem.

We didn't call sysroot_path, so it was trimming the appliance instead
of the guest filesystem.
---
 daemon/fstrim.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/daemon/fstrim.c b/daemon/fstrim.c
index bf9dad8..2aad155 100644
--- a/daemon/fstrim.c
+++ b/daemon/fstrim.c
@@ -46,6 +46,7 @@ do_fstrim (const char *path,
   const char *argv[MAX_ARGS];
   size_t i = 0;
   char offset_s[64], length_s[64], mfe_s[64];
+  CLEANUP_FREE char *buf = NULL;
   CLEANUP_FREE char *out = NULL, *err = NULL;
   int r;
 
@@ -88,7 +89,13 @@ do_fstrim (const char *path,
   if (verbose)
     ADD_ARG (argv, i, "-v");
 
-  ADD_ARG (argv, i, path);
+  buf = sysroot_path (path);
+  if (!buf) {
+    reply_with_error ("malloc");
+    return -1;
+  }
+
+  ADD_ARG (argv, i, buf);
   ADD_ARG (argv, i, NULL);
 
   r = commandv (&out, &err, argv);
-- 
1.8.5.3

> There are few commits (01, 02, 11, 12, 13, 14, 15, 16) which IMHO could 
> go even right now (so I ACK them).

I'm going to read your other comments, and I'll post a v3 of this series.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)




More information about the Libguestfs mailing list