From: Johannes Schindelin Date: Mon, 02 Jun 2008 18:22:01 GMT Subject: Re: [PATCH] Adding a cache of commit to patch-id pairs to speed up git-cherry Message-ID: In-Reply-To: <7f9d599f0806021023r64affb36ne491792a962d455c@mail.gmail.com> Hi, On Mon, 2 Jun 2008, Geoffrey Irving wrote: > On Mon, Jun 2, 2008 at 7:50 AM, Geoffrey Irving wrote: > > I'll switch to mmapping. > > The git_mmap function in compat/mmap.c dies if NO_MMAP is defined and > the map isn't MAP_PRIVATE. If I want to write an entry, will the memory > be automatically updated if I write directly to the file descriptor (I > haven't used mmap before)? I think that you should only mmap() with MAP_PRIVATE, because you can corrupt the data easily when a write failure is not handled properly. So I'd suggest mmap() for reading, and writing to a locked file (I think you did that already). Ciao, Dscho