On Mon, May 10, 2010 at 10:22:47PM +0800, Peng Tao wrote: > What about letting fsync() on dir recursively fsync() all > files/sub-dirs in the dir? > Then apps can unpack package in a temp dir, fsync(), and rename. There are programs to do who execute fsync() on a directory, and they do not expect a recursive fsync() on all files/subdirectories in a directory. At least for Linux, sync() is synchronous and will do what you want. There is unfortunately not a portable way to do what you want short of fsync'ing all of the files after they are written. This case is mostly optimized under ext3/4 (we could do a bit better for ext4, but the performance shouldn't be disastrous --- certainly much better than write a file, fsync, rename a file, repeat). - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html