Re: [PATCH v6 04/12] fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for taking the time to review/provide feedback!

On 9/15/2017 5:35 PM, David Turner wrote:
-----Original Message-----
From: Ben Peart [mailto:benpeart@xxxxxxxxxxxxx]
Sent: Friday, September 15, 2017 3:21 PM
To: benpeart@xxxxxxxxxxxxx
Cc: David Turner <David.Turner@xxxxxxxxxxxx>; avarab@xxxxxxxxx;
christian.couder@xxxxxxxxx; git@xxxxxxxxxxxxxxx; gitster@xxxxxxxxx;
johannes.schindelin@xxxxxx; pclouds@xxxxxxxxx; peff@xxxxxxxx
Subject: [PATCH v6 04/12] fsmonitor: teach git to optionally utilize a file system
monitor to speed up detecting new or changed files.
+int git_config_get_fsmonitor(void)
+{
+	if (git_config_get_pathname("core.fsmonitor", &core_fsmonitor))
+		core_fsmonitor = getenv("GIT_FSMONITOR_TEST");
+
+	if (core_fsmonitor && !*core_fsmonitor)
+		core_fsmonitor = NULL;
+
+	if (core_fsmonitor)
+		return 1;
+
+	return 0;
+}

This functions return values are backwards relative to the rest of the git_config_* functions.

I'm confused. If core.fsmonitor is configured, it returns 1. If it is not configured, it returns 0. I don't make use of the -1 /* default value */ option as I didn't see any use/value in this case. What is backwards?


[snip]

+>	/*
+>	 * With fsmonitor, we can trust the untracked cache's valid field.
+>	 */


Did you intend to make a comment here?

[snip]

+int read_fsmonitor_extension(struct index_state *istate, const void *data,
+	unsigned long sz)
+{

If git_config_get_fsmonitor returns 0, fsmonitor_dirty will leak.


Good catch!  Thank you.

[snip]

+	/* a fsmonitor process can return '*' to indicate all entries are invalid */

That's not documented in your documentation.  Also, I'm not sure I like it: what
if I have a file whose name starts with '*'?  Yeah, that would be silly, but this indicates the need
for the protocol to have some sort of signaling mechanism that's out-of-band  Maybe
have some key\0value\0 pairs and then \0\0 and then the list of files?  Or, if you want to keep
it really simple, allow an entry of '/' (which is an invalid filename) to mean 'all'.


Yea, this was an optimization I added late in the game to get around an issue in Watchman where it returns the name of every file the first time you query it (rather than the set of files that have actually changed since the requested time).

I didn't realize the wild card '*' was a valid character for a filename. I'll switch to '/' as you suggest as I don't want to complicate things unnecessarily to handle this relatively rare optimization. I'll also get it documented properly. Thanks!

+void add_fsmonitor(struct index_state *istate) {
+	int i;
+
+	if (!istate->fsmonitor_last_update) {
[snip]
+		/* reset the untracked cache */

Is this really necessary?  Shouldn't the untracked cache be in a correct state already?


When fsmonitor is not turned on, I'm not explicitly invalidating untracked cache directory entries as git makes changes to files. While I doubt the sequence happens of 1) git making changes to files, *then* 2) turning on fsmonitor - I thought it better safe than sorry to assume that pattern won't ever happen in the future. Especially since turning on the extension is rare and the cost is low.

+/*
+ * Clear the given cache entries CE_FSMONITOR_VALID bit and invalidate

Nit: "s/entries/entry's/".



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux