Changeset 279660 in webkit
- Timestamp:
- Jul 7, 2021, 12:54:06 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r279645 r279660 1 2021-07-07 Christopher Reid <chris.reid@sony.com> 2 3 [PlayStation] Don't assume 4KB block size when estimating Network Cache disk usage 4 https://bugs.webkit.org/show_bug.cgi?id=227502 5 6 Reviewed by Chris Dumez. 7 8 Add getVolumeFileBlockSize to fetch the block size from the filesystem. 9 Currently only implemented for Windows and POSIX filesystems. 10 11 * wtf/FileSystem.cpp: 12 * wtf/FileSystem.h: 13 * wtf/playstation/FileSystemPlayStation.cpp: 14 1 15 2021-07-07 Alex Christensen <achristensen@webkit.org> 2 16 -
trunk/Source/WTF/wtf/FileSystem.h
r279645 r279660 124 124 WTF_EXPORT_PRIVATE String parentPath(const String&); 125 125 WTF_EXPORT_PRIVATE std::optional<uint64_t> volumeFreeSpace(const String&); 126 WTF_EXPORT_PRIVATE std::optional<uint32_t> volumeFileBlockSize(const String&); 126 127 WTF_EXPORT_PRIVATE std::optional<int32_t> getFileDeviceId(const CString&); 127 128 WTF_EXPORT_PRIVATE bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath); -
trunk/Source/WTF/wtf/glib/FileSystemGlib.cpp
r278521 r279660 247 247 } 248 248 249 std::optional<uint32_t> volumeFileBlockSize(const String&) 250 { 251 return std::nullopt; 252 } 253 249 254 #if USE(FILE_LOCK) 250 255 bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> lockMode) -
trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp
r278641 r279660 185 185 } 186 186 187 std::optional<uint32_t> volumeFileBlockSize(const String& path) 188 { 189 struct statvfs fileStat; 190 if (!statvfs(fileSystemRepresentation(path).data(), &fileStat)) 191 return fileStat.f_frsize; 192 193 return std::nullopt; 194 } 195 187 196 #if !USE(CF) 188 197 String stringFromFileSystemRepresentation(const char* path) -
trunk/Source/WTF/wtf/win/FileSystemWin.cpp
r279085 r279660 364 364 } 365 365 366 std::optional<uint32_t> volumeFileBlockSize(const String& path) 367 { 368 DWORD sectorsPerCluster, bytesPerSector, freeClusters, totalClusters; 369 if (!GetDiskFreeSpaceW(path.wideCharacters().data(), §orsPerCluster, &bytesPerSector, &freeClusters, &totalClusters)) 370 return std::nullopt; 371 372 return sectorsPerCluster * bytesPerSector; 373 } 374 366 375 MappedFileData::~MappedFileData() 367 376 { -
trunk/Source/WebKit/ChangeLog
r279658 r279660 1 2021-07-07 Christopher Reid <chris.reid@sony.com> 2 3 [PlayStation] Don't assume 4KB block size when estimating Network Cache disk usage 4 https://bugs.webkit.org/show_bug.cgi?id=227502 5 6 Reviewed by Chris Dumez. 7 8 Network Cache disk usage can underestimate the real disk usage on platforms 9 with file blocks larger than 4 KB. 10 Adding call to FileSystem::getVolumeFileBlockSize to use the FileSystem's 11 block size in the estimation. 12 13 * NetworkProcess/cache/NetworkCacheStorage.cpp: 14 * NetworkProcess/cache/NetworkCacheStorage.h: 15 1 16 2021-07-07 Fujii Hironori <Hironori.Fujii@sony.com> 2 17 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp
r279645 r279660 311 311 } 312 312 313 static size_t estimateRecordsSize(unsigned recordCount, unsigned blobCount) 313 uint32_t Storage::volumeBlockSize() const 314 { 315 ASSERT(!RunLoop::isMain()); 316 317 if (!m_volumeBlockSize) 318 m_volumeBlockSize = FileSystem::volumeFileBlockSize(m_basePath).value_or(4 * KB); 319 320 return *m_volumeBlockSize; 321 } 322 323 size_t Storage::estimateRecordsSize(unsigned recordCount, unsigned blobCount) const 314 324 { 315 325 auto inlineBodyCount = recordCount - std::min(blobCount, recordCount); 316 auto headerSizes = recordCount * 4096;326 auto headerSizes = recordCount * volumeBlockSize(); 317 327 auto inlineBodySizes = (maximumInlineBodySize() / 2) * inlineBodyCount; 318 328 return headerSizes + inlineBodySizes; -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h
r278340 r279660 163 163 static bool isHigherPriority(const std::unique_ptr<ReadOperation>&, const std::unique_ptr<ReadOperation>&); 164 164 165 size_t estimateRecordsSize(unsigned recordCount, unsigned blobCount) const; 166 uint32_t volumeBlockSize() const; 167 165 168 const String m_basePath; 166 169 const String m_recordsPath; … … 171 174 size_t m_capacity { std::numeric_limits<size_t>::max() }; 172 175 size_t m_approximateRecordsSize { 0 }; 176 mutable std::optional<uint32_t> m_volumeBlockSize; 173 177 174 178 // 2^18 bit filter can support up to 26000 entries with false positive rate < 1%.
Note:
See TracChangeset
for help on using the changeset viewer.