Finder causes readdir on all folders

93 views
Skip to first unread message

meg75

unread,
Jan 26, 2015, 7:53:20 PM1/26/15
to osxfus...@googlegroups.com
I have a networked filesystem on osxfuse and I see that when I open finder on the root (mount point) of my filesystem my readdir callback gets called for every folder I have.  Are there any mount parameters or other ways to prevent this?  Here are the parameters I am currently using:

oallow_root
auto_xattr
novncache
auto_cache
default_permissions
daemon_timeout=300
entry_timeout=0
attr_timeout=0

I tried the nobrowse option, but nothing changed.

Thanks...

Sam Moffatt

unread,
Jan 26, 2015, 11:32:06 PM1/26/15
to osxfus...@googlegroups.com
I'm not aware of any parameters to prevent this from happening. I am curious however, how do you know that it is Finder doing it?

Cheers,

--
You received this message because you are subscribed to the Google Groups "OSXFUSE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-grou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

meg75

unread,
Jan 27, 2015, 5:15:47 PM1/27/15
to osxfus...@googlegroups.com
I have logging in my app.  Start the app.  No calls to readdir.  Start Finder - no calls to readdir.  Select my filesystem in finder - now I see a call to readdir for every folder in my filesystem.  

Sam Moffatt

unread,
Jan 28, 2015, 10:46:00 AM1/28/15
to osxfus...@googlegroups.com
What an odd behaviour. Does sound like a strong correlation though, I wonder if it's looking for .DS_Store files to cache the icons. Have you tried tracing Finder to see what it is doing on a deeper level?

Cheers,

Sam

--
Sam Moffatt

Note: I'm not at my desk, responses may be delayed. Apologies for the typos, smartphones aren't all that smart. 

meg75

unread,
Jan 28, 2015, 7:49:02 PM1/28/15
to osxfus...@googlegroups.com
I setup a test with MyDrive which contains this folder tree: /A/B/C/D/E.  I then monitored the File Activity of finder using Instruments.  Here are the results (filtered for MyDrive).
I would really like to find a way to stop this.  My filesystem is remote and having to retrieve everything anytime finder is used is a killer.

#    Caller                                  Function   FD (return)   Path                        FD (arg0)  FD (arg1)

30   CFURLResourceIsReachable                lstat64                  /Volumes/MyDrive

37   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive

42   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive            24

44   normalizeUserMountpoint                 lstat64                  /Volumes/MyDrive

46   validateVolume                          lstat64                  /Volumes/MyDrive

48   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive

49   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive            24

50   normalizeUserMountpoint                 lstat64                  /Volumes/MyDrive

52   validateVolume                          lstat64                  /Volumes/MyDrive

54   CFURLResourceIsReachable                lstat64                  /Volumes/MyDrive

65   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive

66   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive            24

67   normalizeUserMountpoint                 lstat64                  /Volumes/MyDrive

69   validateVolume                          lstat64                  /Volumes/MyDrive

71   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive

72   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive            24

73   normalizeUserMountpoint                 lstat64                  /Volumes/MyDrive

75   validateVolume                          lstat64                  /Volumes/MyDrive

78   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive/A

79   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive/A          24

80   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive/A/B

81   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive/A/B        24

82   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive/A/B/C

83   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive/A/B/C      24

84   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive/A/B/C/D

85   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive/A/B/C/D    24   

86   _GetDirectoryURLs(_CFURLEnumerator*)    open       24            /Volumes/MyDrive/A/B/C/D/E

87   _GetDirectoryURLs(_CFURLEnumerator*)    close                    /Volumes/MyDrive/A/B/C/D/E  24    

Sam Moffatt

unread,
Jan 28, 2015, 10:12:00 PM1/28/15
to osxfus...@googlegroups.com
Based on what I could find, I feel that it's looking for the .DS_Store files (the call maps to com.apple.coreservicesinternal and previously DesktopServicesPriv). IMHO it's unlikely that you're going to be able to stop this from happening. You could try to copy a .DS_Store file into a directory and see if it is read during the same sort of pattern.

meg75

unread,
Jan 28, 2015, 10:58:09 PM1/28/15
to osxfus...@googlegroups.com
I added a .DS_Store file to each folder and re-ran the test.  The only File I/O was a read of the .DS_Store in the root:


#  Caller            Function      FD              Path              Bytes
0  TPropertyInfo::CreatePropertyList(TCountedPtr<TCFURLInfo> const&, double&, long long&, bool, TPropertyInfoList*) pread 24 /Volumes/MyDrive/.DS_Store 10244

Sam Moffatt

unread,
Jan 29, 2015, 12:03:02 AM1/29/15
to osxfus...@googlegroups.com
Interesting, so it read the one at the root but still did the scan. There goes that hypothesis then. I did a Google search and this seemed interesting:

Something else occurred to me though. When you open Finder, what is your default view? Do you happen to use the "All My Files" view?

meg75

unread,
Jan 29, 2015, 1:44:03 AM1/29/15
to osxfus...@googlegroups.com
Sam, Sam, Sam - I can't thank you enough

I was not using the "All My Files" view, but I did have the "calculate all sizes" checked.  After I unchecked that I reran the tests
and the folders are no longer read.

I have found it a bit difficult to identify these types of issues because OS X treats an osxfuse mount as a "sort of network" filesystem.
Seems that some things apply and others do not.  For example, after you had mentioned the .DS_Store files, I tried this method to disable them:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true


I really did not expect it to work, and I was surprised when it did.  The .DS_Store files stopped being created.  Of course, it did
not solve the problem of having all the folders read.

Again, many thanks.

Michael

Sam Moffatt

unread,
Jan 29, 2015, 2:58:05 PM1/29/15
to osxfus...@googlegroups.com
Good to hear you finally figured it out :)

Cheers,

Sam
Reply all
Reply to author
Forward
0 new messages