[Libguestfs] [PATCH 3/3] builder: pxzcat: Remove ineffective POSIX_FADV_WILLNEED.

Richard W.M. Jones rjones at redhat.com
Thu Apr 14 15:20:22 UTC 2016


On Linux this will load the whole file into the page cache.  However
the output file is empty and zero sized just after it is opened, so
this has no effect.  Note that the advice is not persistent, so this
really does nothing.

I considered adding the call back after the file has been written,
just before the close, but:

 - If we do a virt-resize next then we will open and read the file mostly
   sequentially, so readahead will deal with any missing pages.

 - If we do a virt-customize next then we will only access a small
   part of the disk image, so loading it all into the page cache adds
   extra work.

 - In any case, since we have just written the file it's likely to
   still be in the page cache.
---
 builder/pxzcat-c.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c
index ce0516c..fa9f6bf 100644
--- a/builder/pxzcat-c.c
+++ b/builder/pxzcat-c.c
@@ -194,7 +194,6 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
   }
 
   guestfs_int_fadvise_random (ofd);
-  guestfs_int_fadvise_willneed (ofd);
 
   if (ftruncate (ofd, 1) == -1) {
     int err = errno;
-- 
2.7.4




More information about the Libguestfs mailing list