Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: proj/portage:master commit in: man/, pym/portage/dbapi/, pym/portage/, cnf/
Date: Thu, 25 Oct 2012 12:03:49
Message-Id: 50890A45.5070209@gentoo.org
In Reply to: [gentoo-portage-dev] Re: proj/portage:master commit in: man/, pym/portage/dbapi/, pym/portage/, cnf/ by Fabian Groffen
1 On 10/25/2012 02:34 AM, Fabian Groffen wrote:
2 > On 25-10-2012 08:45:36 +0000, Zac Medico wrote:
3 >> URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=10b6d012
4 >>
5 >> Add FEATURES=merge-sync, for bug #439584.
6 >
7 >> + if not self._device_path_map or \
8 >> + "merge-sync" not in self.settings.features:
9 >> + return
10 >> +
11 >> + syncfs = self._get_syncfs()
12 >> + if syncfs is None:
13 >> + try:
14 >> + proc = subprocess.Popen(["sync"])
15 >> + except EnvironmentError:
16 >> + pass
17 >> + else:
18 >> + proc.wait()
19 >> + else:
20 >> + for path in self._device_path_map.values():
21 >> + try:
22 >> + fd = os.open(path, os.O_RDONLY)
23 >> + except OSError:
24 >> + pass
25 >> + else:
26 >> + try:
27 >> + syncfs(fd)
28 >
29 > can't you use os.fdatasync() or os.fsync() instead?
30
31 os.fdatasync() or os.fsync() only work for single files, right? We don't
32 want to sync them individually, since that wastes disk bandwidth. It's
33 much more efficient to sync the whole filesystem at once, like syncfs does.
34 --
35 Thanks,
36 Zac

Replies