Skip to content

Commit

Permalink
[fix]curvefs/client: warmup process
Browse files Browse the repository at this point in the history
Fixed a bug where warm-up progress may not be added

Signed-off-by: Cyber-SiKu <[email protected]>
  • Loading branch information
Cyber-SiKu authored and wuhongsong committed Nov 10, 2023
1 parent 80a9716 commit bea74e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions curvefs/src/client/warmup/warmup_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ bool WarmupManagerS3Impl::AddWarmupFilelist(fuse_ino_t key,
return false;
}
// add warmup Progress
if (AddWarmupProcess(key, path, type)) {
WriteLockGuard lock(inode2ProgressMutex_);
if (AddWarmupProcessLocked(key, path, type)) {
LOG(INFO) << "add warmup list task:" << key;
WriteLockGuard lock(warmupFilelistDequeMutex_);
auto iter = FindWarmupFilelistByKeyLocked(key);
Expand All @@ -96,7 +97,8 @@ bool WarmupManagerS3Impl::AddWarmupFile(fuse_ino_t key, const std::string& path,
return false;
}
// add warmup Progress
if (AddWarmupProcess(key, path, type)) {
WriteLockGuard lock(inode2ProgressMutex_);
if (AddWarmupProcessLocked(key, path, type)) {
LOG(INFO) << "add warmup single task:" << key;
FetchDentryEnqueue(key, path);
}
Expand Down
5 changes: 2 additions & 3 deletions curvefs/src/client/warmup/warmup_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ class WarmupManager {
* @return true
* @return false warmupProcess has been added
*/
virtual bool AddWarmupProcess(fuse_ino_t key, const std::string& path,
WarmupStorageType type) {
WriteLockGuard lock(inode2ProgressMutex_);
virtual bool AddWarmupProcessLocked(fuse_ino_t key, const std::string& path,
WarmupStorageType type) {
auto retPg = inode2Progress_.emplace(key, WarmupProgress(type, path));
return retPg.second;
}
Expand Down

0 comments on commit bea74e3

Please sign in to comment.