On Tuesday 19 April 2005 17:23, Linus Torvalds wrote:
> On Tue, 19 Apr 2005, Chris Mason wrote:
> > Regardless, putting it into the index somehow should be fastest, I'll see
> > what I can do.
> Start by putting it in at "read-tree" time, and adding the code to
> invalidate all parent directory indexes when somebody changes a file in
> the index (ie "update-cache" for anything but a "--refresh").
> That would be needed anyway, since those two are the ones that already
> change the index file.
> Once you're sure that you can correctly invalidate the entries (so that
> you could never use a stale tree entry by mistake), the second stage would
> be to update it at "write-tree" time.
This was much easier then I expected, and it seems to be working here. It
does slow down the write-tree slightly because we have to write out the index
file, but I can get around that with the index file on tmpfs change.
The original write-tree needs .54 seconds to run
write-tree with the index speedup gets that down to .024s (same as my first
patch) when nothing has changed. When it has to rewrite the index file
because something changed, it's .167s.
I'll finish off the patch once you ok the basics below. My current code works
1) read-tree will insert index entries for directories. There is no index
entry for the root.
2) update-cache removes index entries for all parents of the file you're
updating. So, if you update-cache fs/ext3/inode.c, I remove the index of fs
3) If write-tree finds a directory in the index, it uses the sha1 in the cache
entry and skips all files/dirs under that directory.
4) If write-tree detects a subdir with no directory in the index, it calls
write_tree the same way it used to. It then inserts a new cache object with
the calculated sha1.
5) right before exiting, write-tree updates the index if it made any changes.
The downside to this setup is that I've got to change other index users to
deal with directory entries that are there sometimes and missing other times.
The nice part is that I don't have to "invalidate" the directory entry, if it
is present, it is valid.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html