From: Jeff King Date: Wed, 20 Sep 2017 18:51:20 GMT Subject: Re: [PATCH v2 13/21] packed_ref_cache: keep the `packed-refs` file mmapped if possible Message-ID: <20170920185119.upnyomtlxobxwvlw@sigill.intra.peff.net> In-Reply-To: <20170920184058.w3tipgsz54ig7dm5@sigill.intra.peff.net> On Wed, Sep 20, 2017 at 02:40:58PM -0400, Jeff King wrote: > > +enum mmap_strategy { > > + /* > > + * Don't use mmap() at all for reading `packed-refs`. > > + */ > > + MMAP_NONE, > > + > > + /* > > + * Can use mmap() for reading `packed-refs`, but the file must > > + * not remain mmapped. This is the usual option on Windows, > > + * where you cannot rename a new version of a file onto a file > > + * that is currently mmapped. > > + */ > > + MMAP_TEMPORARY, > > I suspect you originally distinguished these cases so that NO_MMAP does > not read into a fake-mmap buffer, followed by us copying it into another > buffer. But AFAICT we handle the "NONE" and "TEMPORARY" cases exactly > the same (by just doing a read_in_full() into our own buffer). Do we > actually need separate strategies? In case you are reading these sequentially, I think I talked myself into the utility of this during the next patch. ;) -Peff