From 0ee528c5fdfa8d49ebd43774853880f1b2e352d8 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 13 Aug 2024 18:35:46 -0400 Subject: Mitigate asset fetch thread stalls from LLDiskCache mutex contention and trivial cleanup Move LLDiskCache::updateFileAccessTime to LLFilesystem as it's the only user of that function. Change mCacheDir and LLDiskCache::metaDataToFilepath to statics. --- indra/llfilesystem/llfilesystem.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llfilesystem/llfilesystem.h') diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index ea1b9cf3a1..983e452981 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -53,6 +53,13 @@ class LLFileSystem bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); bool remove(); + /** + * Update the "last write time" of a file to "now". This must be called whenever a + * file in the cache is read (not written) so that the last time the file was + * accessed is up to date (This is used in the mechanism for purging the cache) + */ + void updateFileAccessTime(const std::string& file_path); + static bool getExists(const LLUUID& file_id, const LLAssetType::EType file_type); static bool removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error = 0); static bool renameFile(const LLUUID& old_file_id, const LLAssetType::EType old_file_type, -- cgit v1.2.3 From d6190bbf13547800c56828d7670944f1a06af7dd Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Mon, 19 Aug 2024 08:39:35 +0200 Subject: Refactor LLFileSystem for and fix an old issue in LLFile (#2332) --- indra/llfilesystem/llfilesystem.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'indra/llfilesystem/llfilesystem.h') diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index 983e452981..10649b6920 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -38,20 +38,20 @@ class LLFileSystem { public: LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode = LLFileSystem::READ); - ~LLFileSystem(); + ~LLFileSystem() = default; bool read(U8* buffer, S32 bytes); - S32 getLastBytesRead(); - bool eof(); + S32 getLastBytesRead() const; + bool eof() const; bool write(const U8* buffer, S32 bytes); bool seek(S32 offset, S32 origin = -1); S32 tell() const; - S32 getSize(); - S32 getMaxSize(); + S32 getSize() const; + S32 getMaxSize() const; bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); - bool remove(); + bool remove() const; /** * Update the "last write time" of a file to "now". This must be called whenever a @@ -78,8 +78,6 @@ class LLFileSystem S32 mPosition; S32 mMode; S32 mBytesRead; -//private: -// static const std::string idToFilepath(const std::string id, LLAssetType::EType at); }; #endif // LL_FILESYSTEM_H -- cgit v1.2.3