Re: [PATCH v2] read_directory: avoid invoking exclude machinery on tracked files

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

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> If path_handled is returned, contents goes up. And if check_only is
> true, the loop could be broken early. These will not happen when
> treat_one_path (and its wrapper treat_path) returns
> path_ignored. dir_add_name internally does a cache_name_exists() check
> so it makes no difference.
>
> To avoid this behavior change, treat_one_path is instructed to skip
> the optimization when check_only or contents is used.

OK, that makes more understandable why this is safe.

> @@ -1242,9 +1246,23 @@ enum path_treatment {
>  static enum path_treatment treat_one_path(struct dir_struct *dir,
>  					  struct strbuf *path,
>  					  const struct path_simplify *simplify,
> -					  int dtype, struct dirent *de)
> +					  int dtype, struct dirent *de,
> +					  int exclude_shortcut_ok)
>  {
> ... 
> @@ -1331,18 +1347,29 @@ static int read_directory_recursive(struct dir_struct *dir,
>  		goto out;
>  
>  	while ((de = readdir(fdir)) != NULL) {
> -		switch (treat_path(dir, de, &path, baselen, simplify)) {
> +		switch (treat_path(dir, de, &path, baselen,
> +				   simplify,
> +				   !check_only && !contents)) {
> ...

Between these two places we may want to say what kind of short-cut
we are talking about, but there only is one kind of short-cut at
this moment, so let's leave that to other people who want to further
optimize things in this codepath by adding other short-cuts.

Thanks; will queue.
--
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]