All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jayesh Daga via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Jayesh Daga <jayeshdaga99@gmail.com>,
	Jayesh Daga <jayeshdaga99@gmail.com>
Subject: [PATCH v3 2/2] read-cache: use istate->repo for trace2 logging
Date: Mon, 30 Mar 2026 17:27:47 +0000	[thread overview]
Message-ID: <9bb6d0fa01d083daf0570c0c33a5610f51796497.1774891667.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2253.v3.git.git.1774891667.gitgitgadget@gmail.com>

From: Jayesh Daga <jayeshdaga99@gmail.com>

trace2 calls in read-cache.c use the global 'the_repository',
even though the relevant index_state provides an explicit
repository pointer via 'istate->repo'.

Using the global repository can result in incorrect trace2
output when multiple repository instances are in use, as
events may be attributed to the wrong repository.

Use 'istate->repo' instead to ensure correct repository
attribution.

Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>
---
 read-cache.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 5049f9baca..b1074fbf06 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2309,13 +2309,9 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
 	}
 	munmap((void *)mmap, mmap_size);
 
-	/*
-	 * TODO trace2: replace "the_repository" with the actual repo instance
-	 * that is associated with the given "istate".
-	 */
-	trace2_data_intmax("index", the_repository, "read/version",
+	trace2_data_intmax("index", istate->repo, "read/version",
 			   istate->version);
-	trace2_data_intmax("index", the_repository, "read/cache_nr",
+	trace2_data_intmax("index", istate->repo, "read/cache_nr",
 			   istate->cache_nr);
 
 	/*
@@ -2360,16 +2356,12 @@ int read_index_from(struct index_state *istate, const char *path,
 	if (istate->initialized)
 		return istate->cache_nr;
 
-	/*
-	 * TODO trace2: replace "the_repository" with the actual repo instance
-	 * that is associated with the given "istate".
-	 */
-	trace2_region_enter_printf("index", "do_read_index", the_repository,
+	trace2_region_enter_printf("index", "do_read_index", istate->repo,
 				   "%s", path);
 	trace_performance_enter();
 	ret = do_read_index(istate, path, 0);
 	trace_performance_leave("read cache %s", path);
-	trace2_region_leave_printf("index", "do_read_index", the_repository,
+	trace2_region_leave_printf("index", "do_read_index", istate->repo,
 				   "%s", path);
 
 	split_index = istate->split_index;
@@ -3096,13 +3088,9 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
 	istate->timestamp.nsec = ST_MTIME_NSEC(st);
 	trace_performance_since(start, "write index, changed mask = %x", istate->cache_changed);
 
-	/*
-	 * TODO trace2: replace "the_repository" with the actual repo instance
-	 * that is associated with the given "istate".
-	 */
-	trace2_data_intmax("index", the_repository, "write/version",
+	trace2_data_intmax("index", istate->repo, "write/version",
 			   istate->version);
-	trace2_data_intmax("index", the_repository, "write/cache_nr",
+	trace2_data_intmax("index", istate->repo, "write/cache_nr",
 			   istate->cache_nr);
 
 	ret = 0;
@@ -3144,14 +3132,10 @@ static int do_write_locked_index(struct index_state *istate,
 		return ret;
 	}
 
-	/*
-	 * TODO trace2: replace "the_repository" with the actual repo instance
-	 * that is associated with the given "istate".
-	 */
-	trace2_region_enter_printf("index", "do_write_index", the_repository,
+	trace2_region_enter_printf("index", "do_write_index", istate->repo,
 				   "%s", get_lock_file_path(lock));
 	ret = do_write_index(istate, lock->tempfile, write_extensions, flags);
-	trace2_region_leave_printf("index", "do_write_index", the_repository,
+	trace2_region_leave_printf("index", "do_write_index", istate->repo,
 				   "%s", get_lock_file_path(lock));
 
 	if (was_full)
-- 
gitgitgadget

  parent reply	other threads:[~2026-03-30 17:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 10:08 [PATCH] read-cache: use index state repository for trace2 logging Jayesh Daga via GitGitGadget
2026-03-27 13:48 ` Derrick Stolee
2026-03-27 16:28   ` Junio C Hamano
2026-03-28  5:25     ` jayesh0104
2026-03-28  7:14 ` [PATCH v2] read-cache: use istate->repo " Jayesh Daga via GitGitGadget
2026-03-28 18:36   ` Junio C Hamano
2026-03-29 14:57     ` Derrick Stolee
2026-03-30 17:27   ` [PATCH v3 0/2] [GSoC] read-cache: use index state repository " Jayesh Daga via GitGitGadget
2026-03-30 17:27     ` [PATCH v3 1/2] repo: add paths.git_dir repo info key jayesh0104 via GitGitGadget
2026-03-30 17:27     ` Jayesh Daga via GitGitGadget [this message]
2026-03-30 18:38     ` [PATCH v4] read-cache: use istate->repo for trace2 logging Jayesh Daga via GitGitGadget
2026-03-30 20:04       ` Junio C Hamano
2026-04-02 14:26         ` Derrick Stolee
2026-04-02 15:25           ` [PATCH] " Jayesh Daga

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=9bb6d0fa01d083daf0570c0c33a5610f51796497.1774891667.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jayeshdaga99@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.