[CRIU] [PATCH 2/7] files: Add fill_fdlink helper

Pavel Emelyanov xemul at parallels.com
Thu May 9 15:15:51 EDT 2013


On 05/09/2013 10:49 PM, Cyrill Gorcunov wrote:
> On Thu, May 09, 2013 at 09:51:51PM +0400, Pavel Emelyanov wrote:
>>>  
>>> -	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode))
>>> +	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode)) {
>>> +		char path[PATH_MAX + 1];
>>> +
>>> +		p.nmlink = path;
>>> +		p.nmsize = sizeof(path);
>>> +
>>> +		if (fill_fdlink(lfd, &p)) {
>>> +			pr_err("Can't fill fdlink params\n");
>>> +			return -1;
>>> +		}
>>> +
>>>  		return dump_reg_file(&p, lfd, fdinfo);
>>
>> dump_reg_file will end up calling dump_one_reg_file, which in turn, will
>> call read_fd_link, so why calling one here via a wrapper?
> 
> This read_fd_link will be called in dump_one_reg_file only if the caller
> is not here (we call dump_one_reg_file for mm_exe and other special files).
> So to not call read_fd_link twice this optimisation is done.

Why not call it _only_ in the deepest function, i.e. dump_one_reg_file?

> .
> 




More information about the CRIU mailing list