svn commit: r265685 - user/marcel/mkimg

Marcel Moolenaar marcel at FreeBSD.org
Thu May 8 15:33:53 UTC 2014


Author: marcel
Date: Thu May  8 15:33:52 2014
New Revision: 265685
URL: http://svnweb.freebsd.org/changeset/base/265685

Log:
  Have image_write() call sparse_write() so that we can use SEEK_HOLE
  and SEEK_DATA to "quickly" find occupied sectors. This is all short-
  lived, because the image should not be kept in a file, but in memory.
  To be precise: the image API should be both efficient and scalable
  and using a file is not efficient -- it works, which is what I need
  right now.

Modified:
  user/marcel/mkimg/image.c

Modified: user/marcel/mkimg/image.c
==============================================================================
--- user/marcel/mkimg/image.c	Thu May  8 15:24:51 2014	(r265684)
+++ user/marcel/mkimg/image.c	Thu May  8 15:33:52 2014	(r265685)
@@ -140,7 +140,7 @@ image_write(lba_t blk, void *buf, ssize_
 	if (lseek(image_fd, blk, SEEK_SET) != blk)
 		return (errno);
 	len *= secsz;
-	if (write(image_fd, buf, len) != len)
+	if (sparse_write(image_fd, buf, len) != len)
 		return (errno);
 	return (0);
 }


More information about the svn-src-user mailing list