Fix relatime performance
This commit is contained in:
parent
0c3f16d0ce
commit
fc21b0882a
@ -160,9 +160,10 @@ void DirBlob::statChildWithSizeAlreadySet(const Key &key, struct ::stat *result)
|
|||||||
|
|
||||||
void DirBlob::updateAccessTimestampForChild(const Key &key, TimestampUpdateBehavior timestampUpdateBehavior) {
|
void DirBlob::updateAccessTimestampForChild(const Key &key, TimestampUpdateBehavior timestampUpdateBehavior) {
|
||||||
std::unique_lock<std::mutex> lock(_mutex);
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
_entries.updateAccessTimestampForChild(key, timestampUpdateBehavior);
|
if (_entries.updateAccessTimestampForChild(key, timestampUpdateBehavior)) {
|
||||||
_changed = true;
|
_changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DirBlob::updateModificationTimestampForChild(const Key &key) {
|
void DirBlob::updateModificationTimestampForChild(const Key &key) {
|
||||||
std::unique_lock<std::mutex> lock(_mutex);
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
|
@ -228,7 +228,7 @@ void DirEntryList::setAccessTimes(const blockstore::Key &key, timespec lastAcces
|
|||||||
found->setLastModificationTime(lastModificationTime);
|
found->setLastModificationTime(lastModificationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirEntryList::updateAccessTimestampForChild(const blockstore::Key &key, TimestampUpdateBehavior timestampUpdateBehavior) {
|
bool DirEntryList::updateAccessTimestampForChild(const blockstore::Key &key, TimestampUpdateBehavior timestampUpdateBehavior) {
|
||||||
ASSERT(timestampUpdateBehavior == TimestampUpdateBehavior::RELATIME, "Currently only relatime supported");
|
ASSERT(timestampUpdateBehavior == TimestampUpdateBehavior::RELATIME, "Currently only relatime supported");
|
||||||
auto found = _findByKey(key);
|
auto found = _findByKey(key);
|
||||||
const timespec lastAccessTime = found->lastAccessTime();
|
const timespec lastAccessTime = found->lastAccessTime();
|
||||||
@ -238,8 +238,12 @@ void DirEntryList::updateAccessTimestampForChild(const blockstore::Key &key, Tim
|
|||||||
.tv_sec = now.tv_sec - 60*60*24,
|
.tv_sec = now.tv_sec - 60*60*24,
|
||||||
.tv_nsec = now.tv_nsec
|
.tv_nsec = now.tv_nsec
|
||||||
};
|
};
|
||||||
if (lastAccessTime < lastModificationTime || lastAccessTime < yesterday)
|
bool changed = false;
|
||||||
|
if (lastAccessTime < lastModificationTime || lastAccessTime < yesterday) {
|
||||||
found->setLastAccessTime(now);
|
found->setLastAccessTime(now);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirEntryList::updateModificationTimestampForChild(const blockstore::Key &key) {
|
void DirEntryList::updateModificationTimestampForChild(const blockstore::Key &key) {
|
||||||
|
@ -40,7 +40,7 @@ namespace cryfs {
|
|||||||
void setMode(const blockstore::Key &key, mode_t mode);
|
void setMode(const blockstore::Key &key, mode_t mode);
|
||||||
bool setUidGid(const blockstore::Key &key, uid_t uid, gid_t gid);
|
bool setUidGid(const blockstore::Key &key, uid_t uid, gid_t gid);
|
||||||
void setAccessTimes(const blockstore::Key &key, timespec lastAccessTime, timespec lastModificationTime);
|
void setAccessTimes(const blockstore::Key &key, timespec lastAccessTime, timespec lastModificationTime);
|
||||||
void updateAccessTimestampForChild(const blockstore::Key &key, TimestampUpdateBehavior timestampUpdateBehavior);
|
bool updateAccessTimestampForChild(const blockstore::Key &key, TimestampUpdateBehavior timestampUpdateBehavior);
|
||||||
void updateModificationTimestampForChild(const blockstore::Key &key);
|
void updateModificationTimestampForChild(const blockstore::Key &key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user