Subject: Re: [PATCH v3 00/10] upload-pack: reduce lock contention when writing packfile data

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 11 Mar 2026 07:27:55 +0100

On Tue, Mar 10, 2026 at 09:56:14PM +0100, Johannes Sixt wrote:
> Am 10.03.26 um 14:24 schrieb Patrick Steinhardt:
> >       compat/posix: introduce writev(3p) wrapper
> >       wrapper: introduce writev(3p) wrappers
> 
> I looked at these two patches.
> 
> At first, I was thrown off by the early exits when bytes_written == 0.
> But I convinced myself that it makes sense:
> 
> - In the emulation, if the underlying write(2) does return 0, it makes
> sense to signal a partial successful write to the caller of writev. It's
> the best we can do when earlier blocks have already been written. A
> return value of 0 is strange and may be an indication of future
> problems, so let's just stop the work we are doing and let the upper
> layers deal with the problem.
> 
> - In writev_in_full we need to treat the case specially in order to
> guarantee forward progress.  Treating it as ENOSPC is plucked out of
> thin air, I guess, but not unreasonable.

This part is basically copied from `write_in_full()`, which does the
same.

> In conclusion, these patches look good.

Thanks!

Patrick