This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Avoid reading file for stat calls
AbandonedPublic

Authored by jansvoboda11 on Dec 2 2021, 9:38 AM.

Details

Summary

The minimizing FS defensively reads files even for stat calls. This is necessary to report consistent file sizes for stat calls and for read calls that may minimize the file, thus changing its size.

This patch avoids reading files that are not to be minimized. This is more efficient in scenarios a non-minimized file is only stat-ed during dependency scan and never open-ed.

Depends on D114966.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Dec 2 2021, 9:38 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2021, 9:38 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 edited the summary of this revision. (Show Details)Dec 2 2021, 10:03 AM

Assuming the filesystem doesn't change during dependency scanning, this change keeps the consistency between stat/read calls for minimized files.

Thinking about it some more though, the original reason for reading files eagerly (even for stat calls) was most likely to avoid inconsistencies when the file changes on the filesystem between stat and read. Is that correct, @arphaman? If so, I think I should abandon this patch.

dexonsmith requested changes to this revision.Dec 2 2021, 1:58 PM

Assuming the filesystem doesn't change during dependency scanning, this change keeps the consistency between stat/read calls for minimized files.

Thinking about it some more though, the original reason for reading files eagerly (even for stat calls) was most likely to avoid inconsistencies when the file changes on the filesystem between stat and read. Is that correct, @arphaman? If so, I think I should abandon this patch.

Agreed; that consistency is important. I don't think stat should be decoupled from reading the file.

This revision now requires changes to proceed.Dec 2 2021, 1:58 PM

Assuming the filesystem doesn't change during dependency scanning, this change keeps the consistency between stat/read calls for minimized files.

Thinking about it some more though, the original reason for reading files eagerly (even for stat calls) was most likely to avoid inconsistencies when the file changes on the filesystem between stat and read. Is that correct, @arphaman? If so, I think I should abandon this patch.

Agreed; that consistency is important. I don't think stat should be decoupled from reading the file.

Yes, exactly, it was to avoid the file system change inconsistencies. it should not be decoupled .

jansvoboda11 abandoned this revision.Dec 3 2021, 12:46 AM

Thanks for confirming!