All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Alex Mironov via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Derrick Stolee <stolee@gmail.com>,
	 Alex Mironov <alexandrfox@gmail.com>
Subject: Re: [PATCH v3] name-hash: don't add sparse directories in threaded lazy init
Date: Wed, 21 May 2025 14:47:35 -0700	[thread overview]
Message-ID: <xmqqa5758wlk.fsf@gitster.g> (raw)
In-Reply-To: <pull.1970.v3.git.git.1747862971672.gitgitgadget@gmail.com> (Alex Mironov via GitGitGadget's message of "Wed, 21 May 2025 21:29:31 +0000")

"Alex Mironov via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Alex Mironov <alexandrfox@gmail.com>
>
> Ensure that logic added in 5f11669586 (name-hash: don't add directories
> to name_hash, 2021-04-12) also applies in multithreaded hashtable init
> path.
>
> As per the original single-threaded change above: sparse directory entries
> represent a directory that is outside the sparse-checkout definition.
> These are not paths to blobs, so should not be added to the name_hash
> table. Instead, they should be added to the directory hashtable when
> 'ignore_case' is true.
>
> Add a condition to avoid placing sparse directories into the name_hash
> hashtable. This avoids filling the table with extra entries that will
> never be queried.
>
> Signed-off-by: Alex Mironov <alexandrfox@gmail.com>
> ---

Sounds quite sensible and the above reads better.

> diff --git a/name-hash.c b/name-hash.c
> index d66de1cdfd5..b91e2762678 100644
> --- a/name-hash.c
> +++ b/name-hash.c
> @@ -492,8 +492,10 @@ static void *lazy_name_thread_proc(void *_data)
>  	for (k = 0; k < d->istate->cache_nr; k++) {
>  		struct cache_entry *ce_k = d->istate->cache[k];
>  		ce_k->ce_flags |= CE_HASHED;
> -		hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
> -		hashmap_add(&d->istate->name_hash, &ce_k->ent);
> +		if (!S_ISSPARSEDIR(ce_k->ce_mode)) {
> +			hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
> +			hashmap_add(&d->istate->name_hash, &ce_k->ent);
> +		}
>  	}


This unfortunately gives us deeper nesting than your previous round,
but the conditional matches the original commit and easier to see
what is going on by comparing the uni- and multi-threaded variants.

Nicely done.  Will queue.

Thanks.



  reply	other threads:[~2025-05-21 21:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 11:40 [PATCH] name-hash: don't add sparse directories in threaded lazy init Alex Mironov via GitGitGadget
2025-05-21 17:17 ` Derrick Stolee
2025-05-21 18:32   ` Junio C Hamano
2025-05-21 20:07   ` Alex Mironov
2025-05-21 20:16 ` [PATCH v2] " Alex Mironov via GitGitGadget
2025-05-21 20:32   ` Junio C Hamano
2025-05-21 20:37     ` Alex Mironov
2025-05-21 21:12       ` Junio C Hamano
2025-05-21 21:23         ` Junio C Hamano
2025-05-21 21:40           ` Alex Mironov
2025-05-21 21:29   ` [PATCH v3] " Alex Mironov via GitGitGadget
2025-05-21 21:47     ` Junio C Hamano [this message]
2025-05-22  1:48       ` Derrick Stolee

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=xmqqa5758wlk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=alexandrfox@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=stolee@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.