[fedora-virt] libguestfs tests running much slower

Richard W.M. Jones rjones at redhat.com
Thu Jul 2 14:27:32 UTC 2009


On Thu, Jul 02, 2009 at 03:17:10PM +0100, Richard W.M. Jones wrote:
> Dan pointed me to this bug which looks relevant:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=504376

However it's not sparseness which is the problem.  Even with
non-sparse backing files (see attached patch) I still see a slowdown.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
-------------- next part --------------
diff --git a/src/generator.ml b/src/generator.ml
index f41413e..3387136 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4405,7 +4405,6 @@ static void no_test_warnings (void)
   pr "\
 int main (int argc, char *argv[])
 {
-  char c = 0;
   int failed = 0;
   const char *filename;
   int fd;
@@ -4431,14 +4430,8 @@ int main (int argc, char *argv[])
     perror (filename);
     exit (1);
   }
-  if (lseek (fd, %d, SEEK_SET) == -1) {
-    perror (\"lseek\");
-    close (fd);
-    unlink (filename);
-    exit (1);
-  }
-  if (write (fd, &c, 1) == -1) {
-    perror (\"write\");
+  if (posix_fallocate (fd, 0, %d) == -1) {
+    perror (\"fallocate\");
     close (fd);
     unlink (filename);
     exit (1);
@@ -4459,14 +4452,8 @@ int main (int argc, char *argv[])
     perror (filename);
     exit (1);
   }
-  if (lseek (fd, %d, SEEK_SET) == -1) {
-    perror (\"lseek\");
-    close (fd);
-    unlink (filename);
-    exit (1);
-  }
-  if (write (fd, &c, 1) == -1) {
-    perror (\"write\");
+  if (posix_fallocate (fd, 0, %d) == -1) {
+    perror (\"fallocate\");
     close (fd);
     unlink (filename);
     exit (1);
@@ -4487,14 +4474,8 @@ int main (int argc, char *argv[])
     perror (filename);
     exit (1);
   }
-  if (lseek (fd, %d, SEEK_SET) == -1) {
-    perror (\"lseek\");
-    close (fd);
-    unlink (filename);
-    exit (1);
-  }
-  if (write (fd, &c, 1) == -1) {
-    perror (\"write\");
+  if (posix_fallocate (fd, 0, %d) == -1) {
+    perror (\"fallocate\");
     close (fd);
     unlink (filename);
     exit (1);


More information about the Fedora-virt mailing list