On 10/25/2012 02:34 AM, Fabian Groffen wrote: > On 25-10-2012 08:45:36 +0000, Zac Medico wrote: >> URL: >> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=10b6d012 >> >> Add FEATURES=merge-sync, for bug #439584. > >> + if not self._device_path_map or \ >> + "merge-sync" not in self.settings.features: >> + return >> + >> + syncfs = self._get_syncfs() >> + if syncfs is None: >> + try: >> + proc = subprocess.Popen(["sync"]) >> + except EnvironmentError: >> + pass >> + else: >> + proc.wait() >> + else: >> + for path in self._device_path_map.values(): >> + try: >> + fd = os.open(path, os.O_RDONLY) >> + except OSError: >> + pass >> + else: >> + try: >> + syncfs(fd) > > can't you use os.fdatasync() or os.fsync() instead?
os.fdatasync() or os.fsync() only work for single files, right? We don't want to sync them individually, since that wastes disk bandwidth. It's much more efficient to sync the whole filesystem at once, like syncfs does. -- Thanks, Zac
