Re: [PATCH v5] Verify index file before we opportunistically update it
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 10, 2014, 16:57 UTC
- Message-ID
- <xmqqob09xgua.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CACsJy8D9dsxOA6xVmhxa7N20OxEQ1a63rQm6QCtwq9ThG6E3RA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 5 quoted lines
> verify_hdr() is a bit expensive because you need to digest the whole > index file (could big as big as 14MB on webkit). Could we get away > without it? I mean, is it enough that we pick the last 20 bytes and > compare it with istate->sha1? If we only need 20 bytes, pread() may be > better than mmap().
True.
I do not think we offer xread() equivalent for pread() to help coders to avoid the common mistake of failing to resume interrupted system calls, though.
The only callsite of pread() we currently have is in index-pack.c, which just does
n = pread(pack_fd, inbuf, n, from);
if (n < 0)
die_errno(_("cannot pread pack file"));without paying attention to EAGAIN/EINTR, that seems wrong and may want to be fixed, before we introduce another call site of pread().
Thanks.