Does updating a file in the root folder watched by inotify always cause full rescan?

With a very large shared folder and inotify watching the folder it seems any update of a file in the root of the shared folder causes syncthing to do a complete rescan of the whole shared folder.

Is this the correct behavior?

Ping @Zillode, I think we can only rescan by folder, not by file, hence why that happens.

Inotify communicates the name of the updated file so syncthing could detect its a file instead of a folder so it does not have to do a complete treewalk

That is what should happen, as far as I know.

I tested difference in behavior with a changed file in the root and changed file in a small sub folder from the root

Updating \t.txt causes rescan of the whole \ tree taking a couple of minutes

Updating \tmp\t.txt causes a rescan of \tmp only and is in my case much quicker (seconds)

I checked the source

In model.go/internalScanFolderSubs/1233 I see sub = filepath.Dir(sub) throwing away the filename provided by inotify and only using the folder path. Would it be better to differentiate between a folder notification and a file notification?

1 Like

Yay! I think this is one of the reasons (or the only reason?) I was still seeing lots of scanning CPU usage in spite of running syncthing-inotify.