Re: [PATCH 05/11] cache-tree: simplify locking logic

2017-10-01 Thread Jeff King
On Sun, Oct 01, 2017 at 04:56:06PM +0200, Martin Ågren wrote: > After we have taken the lock using `LOCK_DIE_ON_ERROR`, we know that > `newfd` is non-negative. So when we check for exactly that property > before calling `write_locked_index()`, the outcome is guaranteed. > > If we write and commit

Re: [PATCH 05/11] cache-tree: simplify locking logic

2017-10-01 Thread Junio C Hamano
Martin Ågren writes: > After we have taken the lock using `LOCK_DIE_ON_ERROR`, we know that > `newfd` is non-negative. So when we check for exactly that property > before calling `write_locked_index()`, the outcome is guaranteed. > > If we write and commit successfully, we set `newfd = -1`, so th

[PATCH 05/11] cache-tree: simplify locking logic

2017-10-01 Thread Martin Ågren
After we have taken the lock using `LOCK_DIE_ON_ERROR`, we know that `newfd` is non-negative. So when we check for exactly that property before calling `write_locked_index()`, the outcome is guaranteed. If we write and commit successfully, we set `newfd = -1`, so that we can later avoid calling `r