Re: [PATCH 3/3] Avoid doing extra 'lstat()'s for d_type if we have?an up-to-date cache entry

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

 



On Fri, Jul 10, 2009 at 03:30:24AM +0400, Dmitry Potapov wrote:
> 
> But we still use readdir() from Cygwin and that may be source of extra
> syscalls that I observe...

opendir gives an extra 'stat' before opening directory
readdir produces one more extra 'stat' on the parent directory before
        returning '..'
open(.gitignore) does one extra 'stat' on the directory where it tries
        to open .gitignore (it did not exist in my tests)

So, the number of 'stat' on each directory is 2 plus the number of
subidectories that it has. Thus, the total number of 'stat' for all
directories is 3 multiple the number of directories in your repo. All
those 'stat' are artifacts of Cygwin. Also, you have 2 open per each
directory and one of them are redundant (at least, for Git purposes).
Overall (including syscalls for .gitignore), you have the following
number of syscalls for each directory in your repo:
  5 - QueryOpen (stat)
  3 - CreateFile (open)
  2 - CloseFile (close)
  1 - QueryFileInternalInformationFile

Here is the detail listing of testing of read_directory_recursive:
=====
opendir(.)
	QueryOpen,E:\dpotapov\repo
	CreateFile,E:\dpotapov\repo
first readdir call
	QueryDirectory,E:\dpotapov\repo
second readdir call that returns '..'
	QueryOpen,E:\dpotapov
	CreateFile,E:\dpotapov
	QueryFileInternalInformationFile,E:\dpotapov
	CloseFile,E:\dpotapov
open(.gitignore) -- .gitignore does not exist
	QueryOpen,E:\dpotapov\repo\.gitignore
	QueryOpen,E:\dpotapov\repo\.gitignore.lnk
	QueryOpen,E:\dpotapov\repo
	CreateFile,E:\dpotapov\repo\.gitignore
stat for untracked file
	QueryOpen,E:\dpotapov\repo\bar
opendir(dir1)
	QueryOpen,E:\dpotapov\repo\dir1
	CreateFile,E:\dpotapov\repo\dir1
first readdir call
	QueryDirectory,E:\dpotapov\repo\dir1
second readdir call that returns '..'
	QueryOpen,E:\dpotapov\repo
	CreateFile,E:\dpotapov\repo
	QueryFileInternalInformationFile,E:\dpotapov\repo
	CloseFile,E:\dpotapov\repo
open(.gitignore) -- .gitignore does not exist
	QueryOpen,E:\dpotapov\repo\dir1\.gitignore
	QueryOpen,E:\dpotapov\repo\dir1\.gitignore.lnk
	QueryOpen,E:\dpotapov\repo\dir1
	CreateFile,E:\dpotapov\repo\dir1\.gitignore
last readdir call that returns NULL
	QueryDirectory,E:\dpotapov\repo\dir1
closedir
	CloseFile,E:\dpotapov\repo\dir1
stat for some modified file
	QueryOpen,E:\dpotapov\repo\foo
last readdir call that returns NULL
	QueryDirectory,E:\dpotapov\repo
closedir
	CloseFile,E:\dpotapov\repo
=====

Dmitry
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]