Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, jltobler@gmail.com
Subject: Re: [PATCH v2 3/4] reftable/stack: move list lock to `struct reftable_stack`
Date: Tue, 25 Aug 2026 12:30:02 +0200	[thread overview]
Message-ID: <ao1uqpCxFHlOyTV-@pks.im> (raw)
In-Reply-To: <20260824-740-optimize-reloading-the-reftable-stack-v2-3-9c9de2eb0af7@gmail.com>

On Mon, Aug 24, 2026 at 11:31:01AM +0200, Karthik Nayak wrote:
> diff --git a/reftable/stack.c b/reftable/stack.c
> index 703548417c..c3d4deff29 100644
> --- a/reftable/stack.c
> +++ b/reftable/stack.c
> @@ -628,10 +630,16 @@ int reftable_stack_reload(struct reftable_stack *st)
>  }
>  
>  struct reftable_addition {
> -	struct reftable_flock tables_list_lock;
>  	struct reftable_stack *stack;
>  	struct reftable_write_options opts;
>  
> +	/*
> +	 * While the list lock is acquired on the stack, we need to distinguish
> +	 * which 'reftable_addition' is responsible for the lock. This avoids
> +	 * clearing the lock of another 'reftable_addition'.
> +	 */
> +	unsigned int locked : 1;
> +
>  	char **new_tables;
>  	size_t new_tables_len, new_tables_cap;
>  	uint64_t next_update_index;

This feels somewhat fragile, as tracking state via a bit is very easy to
get wrong. I would have preferred a solution where we didn't have to
have this field and instead a more direct proxy. But there's not that
many spots where we have to do this, so this may be okay-ish.

Other than that this series looks good to me, thanks!

Patrick

  reply	other threads:[~2026-08-25 10:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 13:19 [PATCH 0/3] reftable/stack: avoid reloading the stack when locked Karthik Nayak
2026-08-19 13:19 ` [PATCH 1/3] reftable/stack: remove `REFTABLE_STACK_NEW_ADDITION_RELOAD` Karthik Nayak
2026-08-19 16:28   ` Justin Tobler
2026-08-20 21:15     ` Karthik Nayak
2026-08-20  5:51   ` Patrick Steinhardt
2026-08-20 21:20     ` Karthik Nayak
2026-08-20 21:23     ` Karthik Nayak
2026-08-19 13:19 ` [PATCH 2/3] reftable/stack: move list lock to `struct reftable_stack` Karthik Nayak
2026-08-19 16:39   ` Justin Tobler
2026-08-19 17:17   ` Junio C Hamano
2026-08-23 15:28     ` Karthik Nayak
2026-08-19 13:19 ` [PATCH 3/3] reftable/stack: avoid reloading the stack when already locked Karthik Nayak
2026-08-19 16:49   ` Justin Tobler
2026-08-23 15:39     ` Karthik Nayak
2026-08-20  7:53   ` Jeff King
2026-08-23 17:39     ` Karthik Nayak
2026-08-24  4:59       ` Jeff King
2026-08-24  9:30 ` [PATCH v2 0/4] reftable/stack: avoid reloading the stack when locked Karthik Nayak
2026-08-24  9:30   ` [PATCH v2 1/4] reftable/stack: remove `REFTABLE_STACK_NEW_ADDITION_RELOAD` Karthik Nayak
2026-08-24  9:31   ` [PATCH v2 2/4] reftable/stack: rename reftable_stack_new_addition() Karthik Nayak
2026-08-24  9:31   ` [PATCH v2 3/4] reftable/stack: move list lock to `struct reftable_stack` Karthik Nayak
2026-08-25 10:30     ` Patrick Steinhardt [this message]
2026-08-24  9:31   ` [PATCH v2 4/4] reftable/stack: avoid reloading the stack when already locked Karthik Nayak
2026-08-24 22:52     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ao1uqpCxFHlOyTV-@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox