diff --git a/weed/command/mount.go b/weed/command/mount.go index 844937b58f..ba0bada6b6 100644 --- a/weed/command/mount.go +++ b/weed/command/mount.go @@ -117,7 +117,7 @@ func init() { mountOptions.cacheDirForWrite = cmdMount.Flag.String("cacheDirWrite", "", "buffer writes mostly for large files") mountOptions.writeBufferSizeMB = cmdMount.Flag.Int64("writeBufferSizeMB", 0, "global cap on the per-mount write buffer (memory + swap) in MB, 0 means unlimited. Bounds /tmp growth when volume uploads stall") mountOptions.cacheMetaTtlSec = cmdMount.Flag.Int("cacheMetaTtlSec", 60, "metadata cache validity seconds") - mountOptions.dirListCacheEntries = cmdMount.Flag.Int("dirListCacheEntries", meta_cache.DefaultListingCacheEntries, "directory children kept decoded in memory, so reopening a folder rereads nothing; 0 disables") + mountOptions.dirListCacheEntries = cmdMount.Flag.Int("dirListCacheEntries", meta_cache.DefaultListingCacheEntries, "directory children kept decoded in memory, so reopening a folder rereads nothing. A ceiling, not a reservation: only walked directories are held, at roughly half a kilobyte per child. 0 disables") mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center") mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system") mountOptions.defaultPermissions = cmdMount.Flag.Bool("defaultPermissions", true, "enforce permissions by the operating system") diff --git a/weed/mount/meta_cache/listing_cache.go b/weed/mount/meta_cache/listing_cache.go index 93784f5ac1..27fdaa171f 100644 --- a/weed/mount/meta_cache/listing_cache.go +++ b/weed/mount/meta_cache/listing_cache.go @@ -9,9 +9,14 @@ import ( ) // DefaultListingCacheEntries is how many directory children the mount will hold -// decoded in memory across every cached listing. A chunkless entry runs a few -// hundred bytes, so this is tens of megabytes. -const DefaultListingCacheEntries = 200000 +// decoded in memory across every cached listing. +// +// This is a ceiling, not a reservation: nothing is held for a directory that was +// never walked, so a mount over ordinary directories never approaches it. A +// chunkless child measured about 480 bytes, so reaching the default means +// holding something near 450MB, and a mount that wants a tighter bound should +// lower it rather than rely on never walking that far. +const DefaultListingCacheEntries = 1000000 // listingCache keeps directories that have been walked all the way through, so // walking one again costs no store reads and no decoding. It holds only what the